# _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 | ) | `[inline]`

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 199 of file _value.h.

References value::content, and value::type().

Referenced by value_cast().

template<typename ValueType>

const ValueType* value_cast | ( | const value * | v | ) | `[inline]`

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 212 of file _value.h.

References value_cast().

template<typename ValueType>

ValueType value_cast | ( | const value & | v | ) | `[inline]`

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 225 of file _value.h.

References value_cast().