Bayes Filters Library
|
The class any describes a type-safe container for single values of any type. More...
#include <any.h>
Classes | |
class | holder |
class | placeholder |
Public Member Functions | |
any () noexcept | |
Constructs an empty object. More... | |
any (const any &other) | |
Copies content of other into a new instance, so that any content is equivalent in both type and value to those of other prior to the constructor call, or empty if other is empty. More... | |
any (any &&other) noexcept | |
Moves content of other into a new instance, so that any content is equivalent in both type and value to those of other prior to the constructor call, or empty if other is empty. More... | |
template<typename ValueType > | |
any (const ValueType &value) | |
Constructs an object with initial content an object of type std::decay_t<ValueType>, direct-initialized from std::forward<ValueType>(value). More... | |
template<typename ValueType > | |
any (ValueType &&value, typename std::enable_if<!std::is_same< any &, ValueType >::value >::type *=nullptr, typename std::enable_if<!std::is_const< ValueType >::value >::type *=nullptr) | |
Constructs an object with initial content an object of type std::decay_t<ValueType>, direct-initialized from std::forward<ValueType>(value). More... | |
any & | operator= (const any &rhs) |
Assigns contents to the contained value. More... | |
any & | operator= (any &&rhs) noexcept |
Assigns contents to the contained value. More... | |
template<class ValueType > | |
any & | operator= (ValueType &&rhs) |
Assigns contents to the contained value. More... | |
~any () noexcept | |
Destruct the object. More... | |
void | reset () noexcept |
If not empty, destroys the contained object. More... | |
any & | swap (any &rhs) noexcept |
Swaps the content of two any objects. More... | |
bool | has_value () const noexcept |
Checks whether the object contains a value. More... | |
const std::type_info & | type () const noexcept |
Queries the contained type. More... | |
Private Attributes | |
placeholder * | content |
Friends | |
template<typename ValueType > | |
ValueType * | any_cast (any *operand) noexcept |
Performs type-safe access to the contained object. More... | |
The class any describes a type-safe container for single values of any type.
An object of class any stores an instance of any type that satisfies the constructor requirements or is empty, and this is referred to as the state of the class any object. The stored instance is called the contained object. Two states are equivalent if they are either both empty or if both are not empty and if the contained objects are equivalent. The non-member any_cast functions provide type-safe access to the contained object.
|
inlinenoexcept |
Constructs an empty object.
Postconditions: this->empty().
Definition at line 85 of file any.h.
Referenced by operator=(), and reset().
|
inline |
Copies content of other into a new instance, so that any content is equivalent in both type and value to those of other prior to the constructor call, or empty if other is empty.
Throws: may fail with a std::bad_alloc exception or any exceptions arising from the copy constructor of the contained type.
|
inlinenoexcept |
|
inline |
Constructs an object with initial content an object of type std::decay_t<ValueType>, direct-initialized from std::forward<ValueType>(value).
If std::is_copy_constructible<std::decay_t<ValueType>>::value is false, the program is ill-formed.
Throws: std::bad_alloc or any exceptions arising from the copy constructor of the contained type.
|
inline |
Constructs an object with initial content an object of type std::decay_t<ValueType>, direct-initialized from std::forward<ValueType>(value).
If std::is_copy_constructible<std::decay_t<ValueType>>::value is false, the program is ill-formed.
Throws: std::bad_alloc or any exceptions arising from the copy constructor of the contained type.
|
inlinenoexcept |
|
inlinenoexcept |
Assigns contents to the contained value.
Assigns by moving the state of rhs, as if by any(std::move(rhs)).swap(*this). rhs is left in a valid but unspecified state after the assignment.
Postconditions: rhs->empty()
rhs | object whose contained value to assign |
Definition at line 168 of file any.h.
Assigns contents to the contained value.
Assigns by copying the state of rhs, as if by any(rhs).swap(*this).
Throws: std::bad_alloc or any exceptions arising from the copy constructor of the contained type. Assignment satisfies the strong guarantee of exception safety.
rhs | object whose contained value to assign |
Definition at line 152 of file any.h.
References any().
|
inline |
Assigns contents to the contained value.
Assigns the type and value of rhs, as if by any(std::forward<ValueType>(rhs)).swap(*this). This overload only participates in overload resolution if std::decay_t<ValueType> is not the same type as any and std::is_copy_constructible_v<std::decay_t<ValueType>> is true.
Throws: 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.
rhs | object whose contained value to assign |
Definition at line 192 of file any.h.
References any().
|
inlinenoexcept |
Swaps the content of two any objects.
other | object to swap with |
Definition at line 223 of file any.h.
References content, and bfl::any::swap().
Referenced by operator=(), and bfl::any::swap().
|
inlinenoexcept |
Queries the contained type.
The typeid of the contained value if instance is non-empty, otherwise typeid(void).
Definition at line 246 of file any.h.
References content, and bfl::any::any::placeholder::type().
Referenced by bfl::any::any_cast().
|
friend |
|
private |