When instantiating AcessCasted<TAR>, we get a template static function AcessCasted<TAR>::access<SRC>(SRC& elm), but the actual implementation is choosed using boost::type_traits. If no viable implementatino 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 fo EmptyVal, e.g. throwing an exception instead of creating a NULL value.
Definition in file accesscasted.hpp.
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_polymorphic.hpp>
#include <boost/type_traits/is_base_of.hpp>


Go to the source code of this file.
Namespaces | |
| namespace | util |
Classes | |
| struct | util::AccessCasted< TAR > |
| struct | util::can_cast< SRC, TAR > |
| struct | util::can_cast< SRC &, TAR & > |
| struct | util::can_cast< SRC *&, TAR * > |
| struct | util::can_cast< SRC *, TAR * > |
| struct | util::EmptyVal< X > |
| struct | util::EmptyVal< X *& > |
| struct | util::has_RTTI< T > |
| struct | util::NullAccessor< RET > |
| struct | util::use_conversion< SRC, TAR > |
| struct | util::use_dynamic_downcast< SRC, TAR > |
| struct | util::use_static_downcast< SRC, TAR > |
1.5.6