Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Helper for accessing a value, employing either conversion or downcast, depending on the relation of the source type (type of the original value) and the target type (type we need within the usage context).
When instantiating AcessCasted<TAR>, we get a template static function AcessCasted<TAR>::access<SRC>(SRC& elm)
, but the actual implementation is chosen using std::type_traits. If no sensible implementation can be selected, EmptyVal<TAR>::create()
is invoked instead, which by default creates a NULL value or similar by using the no-argument ctor of the type TAR. Alternatively, you may define an specialisation of EmptyVal, e.g. throwing an exception instead of creating a NULL value.
Definition in file access-casted-o.hpp.
#include <type_traits>
Classes | |
struct | AccessCasted_O< TAR > |
struct | can_cast< SRC, TAR > |
struct | can_cast< SRC &, TAR & > |
struct | can_cast< SRC *&, TAR * > |
struct | can_cast< SRC *, TAR * > |
struct | EmptyVal< X > |
struct | EmptyVal< X *& > |
struct | hasRTTI< T > |
struct | NullAccessor< RET > |
struct | use_conversion< SRC, TAR > |
struct | use_dynamic_downcast< SRC, TAR > |
struct | use_static_downcast< SRC, TAR > |
Namespaces |