Mirror reflection library 0.5.13
|
Locator allows to get the value of a container's element. More...
#include <mirror/doc/concepts_container.hpp>
Public Types | |
typedef BooleanConstantType | safe |
Indicating whether this is a safe locator type. | |
typedef BooleanConstantType | mutating |
Indicating whether this is a mutating locator type. | |
typedef unspecified | value_type |
The type of the element pointed to by this Locator. | |
Public Member Functions | |
bool | dereferencable (void) const |
Returns true if the locator is dereferencable. | |
operator bool (void) const | |
Shorthand for dereferencable() | |
bool | operator! (void) const |
Shorthand for !dereferencable() | |
value_type | get (void) const |
Allows to get the value of the element pointed to by the Locator. |
Locator allows to get the value of a container's element.
Locator is not a meta-object, it is an abstraction for types which allow to access elements in a range or container, like pointers, iterators, etc. but are restricted to point to a particular element and cannot be made to point to another element. Locators also indicate positions inside containers for modifying operations like element insertion and removal. A particular Locator can only be used with the same instance of a container type which was used to instantiate the Locator in the first place.
Some Locators may also refer to special parts of the container (like end()) and do not point to an element. For such locators it is necessary to check the value of dereferencable()
before trying to get or possibly set the value pointed to. Other locators, for example those returned by Traversal's front() member function, always point to an element and it is not necessary to check their dereferencability.