![]() |
Home | Libraries | People | FAQ | More |
boost::anys::unique_any — A class whose instances can hold instances of any type (including non-copyable and non-movable types).
// In header: <boost/any/unique_any.hpp> class unique_any { public: // construct/copy/destruct (); (unique_any &&); template<typename T> (, boost::any && >:: = ); template<typename BoostAny> (, boost::any && >:: = ) ; template<typename T, Args> (in_place_type_t< , ); template<typename T, typename U, Args> (in_place_type_t< , , ); unique_any & (unique_any &&); template<typename T> unique_any & (); ~(); // public member functions template<typename T, Args> (); template<typename T, typename U, Args> (, ); () ; (unique_any &) ; () ; () ; };
unique_any
public
construct/copy/destruct();
Postconditions: |
this->has_value() is false. |
(unique_any && other);
Move constructor that moves content of other
into new instance and leaves other
empty.
Postconditions: |
other->has_value() is false. |
Throws: |
Nothing. |
template<typename T> ( value, boost::any && >:: = );
Forwards value
, so that the content of the new instance has type std::decay_t<T>
and value is the value
before the forward.
Throws: |
std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. |
template<typename BoostAny> ( value, boost::any && >:: = ) ;
Moves the content of
into *this.boost::any
Postconditions: |
|
Throws: |
Nothing. |
template<typename T, Args> (in_place_type_t< , args);
Inplace constructs T
from forwarded args...
, so that the content of *this
is equivalent in type to std::decay_t<T>
.
Throws: |
std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. |
template<typename T, typename U, Args> (in_place_type_t< , il, 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>
.
Throws: |
std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. |
unique_any & (unique_any && rhs);
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()
.
Postconditions: |
|
Throws: |
Nothing. |
template<typename T> unique_any & ( rhs);
Forwards rhs
, discarding previous content, so that the new content of is equivalent in both type and value to rhs
before forward.
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. |
~();
Releases any and all resources used in management of instance.
Throws: |
Nothing. |
unique_any
public member functionstemplate<typename T, Args> ( 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>
.
Returns: |
reference to the content of |
Throws: |
std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. |
template<typename T, typename U, Args> ( il, 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>
.
Returns: |
reference to the content of |
Throws: |
std::bad_alloc or any exceptions arising from the move or copy constructor of the contained type. |
() ;
Postconditions: |
this->has_value() is false. |
(unique_any & rhs) ;
Exchange of the contents of *this
and rhs
.
Returns: |
|
Throws: |
Nothing. |
() ;
Returns: |
|
Throws: |
Nothing. |
() ;
Useful for querying against types known either at compile time or only at runtime.
Returns: |
the |