Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/optional-ref.hpp"
Optional or switchable link to an existing object.
This reference wrapper is accessed like a functor, but has the ability to be disabled. This disabled state is managed automatically by ctor and dtor, can be detected through bool
check and – contrary to a NULL
pointer – produces a real exception instead of crashing.
Definition at line 52 of file optional-ref.hpp.
Public Member Functions | |
OptionalRef (T &target) | |
void | clear () |
bool | isValid () const |
void | link_to (T &target) |
operator bool () const | |
T & | operator() () const |
bool | points_to (T const &target) const |
Friends | |
bool | operator!= (OptionalRef const &r1, OptionalRef const &r2) |
bool | operator!= (T const &otherTarget, OptionalRef const &ref) |
bool | operator!= (OptionalRef const &ref, T const &otherTarget) |
bool | operator== (OptionalRef const &r1, OptionalRef const &r2) |
bool | operator== (OptionalRef const &ref, T const &otherTarget) |
bool | operator== (T const &otherTarget, OptionalRef const &ref) |
Private Attributes | |
T * | ref_ |
|
inlineexplicit |
target | ...not allowing implicit conversion from T& |
Definition at line 70 of file optional-ref.hpp.
|
friend |