tud-zih-energy/otf2xx

How to detect that no element was found

Closed this issue · 3 comments

My question is how to detect if there is no element to be found for the key in the definition::container

Currently when you use find() with a key that does not exist it returns the undefined_ class member of the container.
which is a default constructed object of the value type.

However is_valid() doesn't work as @bmario and/or @tilsche already told me because the data_pointer of the default constructed object is not guaranteed to be null

Also, container::find() returns an iterator? Compare that to container::end() ?

the registry.find() uses container.operator[reference::undefined()] to return something when nothing can be found, but using has() and get() in conjunction is working splendidly