ETL  0.04.19
Classes | Functions
_value.h File Reference
#include <algorithm>
#include <typeinfo>
#include <cassert>

Go to the source code of this file.

Classes

class  value_store_type< T >
class  value
 Abstraction of the concept of a generic value. More...
struct  value::contentholder
class  value::holder< T >
class  bad_value_cast

Functions

template<typename ValueType >
ValueType * value_cast (value *v)
template<typename ValueType >
const ValueType * value_cast (const value *v)
template<typename ValueType >
ValueType value_cast (const value &v)

Function Documentation

template<typename ValueType >
ValueType* value_cast ( value v)

Returns a pointer to the desired value type if the value_type and the internal binary format agree (mediated by using the value_store_type class), otherwise it returns 0.

See Also
value_store_type

Definition at line 200 of file _value.h.

References value::content, value::holder< T >::obj, and value::type().

Referenced by value_cast().

template<typename ValueType >
const ValueType* value_cast ( const value v)

Same as above except tweaked to allow const cast (possibly for purposes involving type agreement... if const impacts a typeid call I do not know...)

Definition at line 213 of file _value.h.

References value_cast().

template<typename ValueType >
ValueType value_cast ( const value v)

Extract a copy of the internal object and will throw a bad_value_cast exception if the types do not agree.

Note
I'm not sure why boost::any didn't use a reference here... there must be a reason...
See Also
bad_value_cast

Definition at line 226 of file _value.h.

References value_cast().