# Reference Section of Boost.Any

A class whose instances can hold instances of any type that satisfies ValueType requirements.

A class whose instances can hold instances of any type that satisfies ValueType requirements.

this->empty() is true.

const ValueType &

Makes a copy of `value`, so that the initial content of the new instance is equivalent in both type and value to `value`.

`std::bad_alloc` or any exceptions arising from the copy constructor of the contained type.

const `any` &

Copy constructor that copies content of `other` into new instance, so that any content is equivalent in both type and value to the content of `other`, or empty if `other` is empty.

`May` fail with a `std::bad_alloc` exception or any exceptions arising from the copy constructor of the contained type.

any
&&

Move constructor that moves content of `other` into new instance and leaves `other` empty.

other->empty() is true

`Nothing.`

ValueType &&
typename std::enable_if<!std::is_same< `any` &, ValueType >::value >::type *
0
typename std::enable_if<!std::is_const< ValueType >::value >::type *
0

Forwards `value`, so that the initial content of the new instance is equivalent in both type and value to `value` before the forward.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type.

Releases any and all resources used in management of instance.

`Nothing.`

`any` & ``any` &`

Exchange of the contents of `*this` and `rhs`.

`*this`

`Nothing.`

`any` & `const `any` &`

Copies content of `rhs` into current instance, discarding previous content, so that the new content is equivalent in both type and value to the content of `rhs`, or empty if `rhs.empty()`.

`std::bad_alloc` or any exceptions arising from the copy constructor of the contained type. Assignment satisfies the strong guarantee of exception safety.

`any` & ``any` &&`

Moves content of `rhs` into current instance, discarding previous content, so that the new content is equivalent in both type and value to the content of `rhs` before move, or empty if `rhs.empty()`.

`rhs->empty()` is true

`Nothing.`

`any` & `ValueType &&`

Forwards `rhs`, discarding previous content, so that the new content of is equivalent in both type and value to `rhs` before forward.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type. Assignment satisfies the strong guarantee of exception safety.

bool

`true` if instance is empty, otherwise `false`.

`Nothing.`

void

this->empty() is true

const boost::typeindex::type_info &

Useful for querying against types known either at compile time or only at runtime.

the `typeid` of the contained value if instance is non-empty, otherwise `typeid(void)`.

void ``any` &` ``any` &`

Exchange of the contents of `lhs` and `rhs`.

`Nothing.`

ValueType * ``any` *`

Pointer to a ValueType stored in `operand`, nullptr if `operand` does not contain specified `ValueType`.

const ValueType * `const `any` *`

Const pointer to a ValueType stored in `operand`, nullptr if `operand` does not contain specified `ValueType`.

ValueType ``any` &`

ValueType stored in `operand`

`boost::bad_any_cast` if `operand` does not contain specified ValueType.

ValueType `const `any` &`

`ValueType` stored in `operand`

`boost::bad_any_cast` if `operand` does not contain specified `ValueType`.

ValueType ``any` &&`

`ValueType` stored in `operand`, leaving the `operand` empty.

`boost::bad_any_cast` if `operand` does not contain specified `ValueType`.

std::bad_cast

The exception thrown in the event of a failed boost::any_cast of an boost::any, boost::anys::basic_any or boost::anys::unique_any value.

const char *

A class with customizable Small Object Optimization whose instances can hold instances of any type that satisfies ValueType requirements. Use boost::any instead if not sure.

std::size_t
std::size_t
A class with customizable Small Object Optimization whose instances can hold instances of any type that satisfies ValueType requirements. Use boost::any instead if not sure.

boost::anys::basic_any is the drop-in replacement for boost::any that provides control over Small Object Optimization via `OptimizeForSize` and `OptimizeForAlignment` template parameters.

There are certain applications that require boost::any functionality, do know the typical/maximal size of the stored object and wish to avoid dynamic memory allocation overhead. For the convenience such applications may create a typedef for boost::anys::basic_any with the `OptimizeForSize` and `OptimizeForAlignment` template parameters set to typical/maximal size and alignment of types respectively. Memory allocation would be avoided for storing nothrow move constructible types with size and alignment less than or equal to the `OptimizeForSize` and `OptimizeForAlignment` values.

Otherwise just use boost::any.

std::size_t
std::size_t

this->empty() is true.

const ValueType &

Makes a copy of `value`, so that the initial content of the new instance is equivalent in both type and value to `value`.

Does not dynamically allocate if `ValueType` is nothrow move constructible and `sizeof(value) <= OptimizeForSize` and `alignof(value) <= OptimizeForAlignment`.

`std::bad_alloc` or any exceptions arising from the copy constructor of the contained type.

const `basic_any` &

Copy constructor that copies content of `other` into new instance, so that any content is equivalent in both type and value to the content of `other`, or empty if `other` is empty.

`May` fail with a `std::bad_alloc` exception or any exceptions arising from the copy constructor of the contained type.

basic_any
&&

Move constructor that moves content of `other` into new instance and leaves `other` empty.

other->empty() is true

`Nothing.`

ValueType &&
typename std::enable_if<!std::is_same< `basic_any` &, ValueType >::value >::type *
0
typename std::enable_if<!std::is_const< ValueType >::value >::type *
0

Forwards `value`, so that the initial content of the new instance is equivalent in both type and value to `value` before the forward.

Does not dynamically allocate if `ValueType` is nothrow move constructible and `sizeof(value) <= OptimizeForSize` and `alignof(value) <= OptimizeForAlignment`.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type.

Releases any and all resources used in management of instance.

`Nothing.`

`basic_any` & ``basic_any` &`

Exchange of the contents of `*this` and `rhs`.

`*this`

`Nothing.`

`basic_any` & `const `basic_any` &`

Copies content of `rhs` into current instance, discarding previous content, so that the new content is equivalent in both type and value to the content of `rhs`, or empty if `rhs.empty()`.

`std::bad_alloc` or any exceptions arising from the copy constructor of the contained type. Assignment satisfies the strong guarantee of exception safety.

`basic_any` & ``basic_any` &&`

Moves content of `rhs` into current instance, discarding previous content, so that the new content is equivalent in both type and value to the content of `rhs` before move, or empty if `rhs.empty()`.

`rhs->empty()` is true

`Nothing.`

`basic_any` & `ValueType &&`

Forwards `rhs`, discarding previous content, so that the new content of is equivalent in both type and value to `rhs` before forward.

Does not dynamically allocate if `ValueType` is nothrow move constructible and `sizeof(value) <= OptimizeForSize` and `alignof(value) <= OptimizeForAlignment`.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type. Assignment satisfies the strong guarantee of exception safety.

bool

`true` if instance is empty, otherwise `false`.

`Nothing.`

void

this->empty() is true

const boost::typeindex::type_info &

Useful for querying against types known either at compile time or only at runtime.

the `typeid` of the contained value if instance is non-empty, otherwise `typeid(void)`.

void std::size_t std::size_t ``basic_any`< OptimizeForSize, OptimizeForAlignment > &` ``basic_any`< OptimizeForSize, OptimizeForAlignment > &`

Exchange of the contents of `lhs` and `rhs`.

`Nothing.`

ValueType * std::size_t std::size_t ``basic_any`< Size, Alignment > *`

Pointer to a ValueType stored in `operand`, nullptr if `operand` does not contain specified `ValueType`.

const ValueType * std::size_t std::size_t `const `basic_any`< OptimizeForSize, OptimizeForAlignment > *`

Const pointer to a ValueType stored in `operand`, nullptr if `operand` does not contain specified `ValueType`.

ValueType std::size_t std::size_t ``basic_any`< OptimizeForSize, OptimizeForAlignment > &`

ValueType stored in `operand`

`boost::bad_any_cast` if `operand` does not contain specified ValueType.

ValueType std::size_t std::size_t `const `basic_any`< OptimizeForSize, OptimizeForAlignment > &`

`ValueType` stored in `operand`

`boost::bad_any_cast` if `operand` does not contain specified `ValueType`.

ValueType std::size_t std::size_t ``basic_any`< OptimizeForSize, OptimizeForAlignment > &&`

`ValueType` stored in `operand`, leaving the `operand` empty.

`boost::bad_any_cast` if `operand` does not contain specified `ValueType`.

Forward declarations of Boost.Any library types.

A class whose instances can hold instances of any type (including non-copyable and non-movable types).

Helper type for providing emplacement type to the constructor.
A class whose instances can hold instances of any type (including non-copyable and non-movable types).

this->has_value() is false.

unique_any
&&

Move constructor that moves content of `other` into new instance and leaves `other` empty.

other->has_value() is false.

`Nothing.`

T &&
typename std::enable_if<!std::is_same< T &&, `boost::any` && >::value >::type *
nullptr

Forwards `value`, so that the content of the new instance has type `std::decay_t<T>` and value is the `value` before the forward.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type.

BoostAny &&
typename std::enable_if< std::is_same< BoostAny &&, `boost::any` && >::value >::type *
nullptr

Moves the content of `boost::any` into *this.

`value.empty()` is true.

`Nothing.`

class...
in_place_type_t
< T >
Args &&...

Inplace constructs `T` from forwarded `args...`, so that the content of `*this` is equivalent in type to `std::decay_t<T>`.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type.

class...
in_place_type_t
< T >
std::initializer_list< U >
Args &&...

Inplace constructs `T` from `li` and forwarded `args...`, so that the initial content of `*this` is equivalent in type to `std::decay_t<T>`.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type.

Releases any and all resources used in management of instance.

`Nothing.`

`unique_any` & ``unique_any` &&`

Moves content of `rhs` into current instance, discarding previous content, so that the new content is equivalent in both type and value to the content of `rhs` before move, or empty if `rhs.empty()`.

`rhs->empty()` is true

`Nothing.`

`unique_any` & `T &&`

Forwards `rhs`, discarding previous content, so that the new content of is equivalent in both type and value to `rhs` before forward.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type. Assignment satisfies the strong guarantee of exception safety.

std::decay< T >::type & class... `Args &&...`

Inplace constructs `T` from forwarded `args...`, discarding previous content, so that the content of `*this` is equivalent in type to `std::decay_t<T>`.

reference to the content of `*this`.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type.

std::decay< T >::type & class... `std::initializer_list< U >` `Args &&...`

Inplace constructs `T` from `li` and forwarded `args...`, discarding previous content, so that the content of `*this` is equivalent in type to `std::decay_t<T>`.

reference to the content of `*this`.

`std::bad_alloc` or any exceptions arising from the move or copy constructor of the contained type.

void

this->has_value() is false.

void ``unique_any` &`

Exchange of the contents of `*this` and `rhs`.

`*this`

`Nothing.`

bool

`true` if instance is not empty, otherwise `false`.

`Nothing.`

const boost::typeindex::type_info &

Useful for querying against types known either at compile time or only at runtime.

the `typeid` of the contained value if instance is non-empty, otherwise `typeid(void)`.

`in_place_type_t`< T >
void ``unique_any` &` ``unique_any` &`

Exchange of the contents of `lhs` and `rhs`.

`Nothing.`

T * ``unique_any` *`

Pointer to a `T` stored in `operand`, nullptr if `operand` does not contain specified `T`.

const T * `const `unique_any` *`

Const pointer to a `T` stored in `operand`, nullptr if `operand` does not contain specified `T`.

T ``unique_any` &`

`T` stored in `operand`

`boost::bad_any_cast` if `operand` does not contain specified `T`.

T `const `unique_any` &`

`T` stored in `operand`

`boost::bad_any_cast` if `operand` does not contain specified `T`.

T ``unique_any` &&`

`T` stored in `operand`

`boost::bad_any_cast` if `operand` does not contain specified `T`.