libstdc++
Type-safe container of any type
Collaboration diagram for Type-safe container of any type:

Classes

class  std::experimental::fundamentals_v1::any
 
class  std::experimental::fundamentals_v1::bad_any_cast
 

Macros

#define __cpp_lib_experimental_any
 

Functions

template<typename _Tp >
void * std::experimental::fundamentals_v1::__any_caster (const any *__any)
 
void std::experimental::fundamentals_v1::__throw_bad_any_cast ()
 
static void std::experimental::fundamentals_v1::any::_Manager_internal< _Tp >::_S_manage (_Op __which, const any *__anyp, _Arg *__arg)
 
static void std::experimental::fundamentals_v1::any::_Manager_external< _Tp >::_S_manage (_Op __which, const any *__anyp, _Arg *__arg)
 
template<typename _ValueType >
_ValueType std::experimental::fundamentals_v1::any_cast (const any &__any)
 
void std::experimental::fundamentals_v1::swap (any &__x, any &__y) noexcept
 
template<typename _ValueType >
_ValueType std::experimental::fundamentals_v1::any_cast (any &__any)
 
template<typename _ValueType , typename enable_if<!is_move_constructible< _ValueType >::value ||is_lvalue_reference< _ValueType >::value, bool >::type = true>
_ValueType std::experimental::fundamentals_v1::any_cast (any &&__any)
 
template<typename _ValueType >
const _ValueType * std::experimental::fundamentals_v1::any_cast (const any *__any) noexcept
 
template<typename _ValueType >
_ValueType * std::experimental::fundamentals_v1::any_cast (any *__any) noexcept
 

Detailed Description

A type-safe container for single values of value types, as described in n3804 "Any Library Proposal (Revision 3)".

Function Documentation

template<typename _ValueType >
_ValueType std::experimental::fundamentals_v1::any_cast ( const any __any)
inline

Access the contained object.

Template Parameters
_ValueTypeA const-reference or CopyConstructible type.
Parameters
__anyThe object to access.
Returns
The contained object.
Exceptions
bad_any_castIf __any.type() != typeid(remove_reference_t<_ValueType>)

Definition at line 363 of file any.

template<typename _ValueType >
_ValueType std::experimental::fundamentals_v1::any_cast ( any __any)
inline

Access the contained object.

Template Parameters
_ValueTypeA reference or CopyConstructible type.
Parameters
__anyThe object to access.
Returns
The contained object.
Exceptions
bad_any_castIf __any.type() != typeid(remove_reference_t<_ValueType>)

Definition at line 386 of file any.

template<typename _ValueType , typename enable_if<!is_move_constructible< _ValueType >::value ||is_lvalue_reference< _ValueType >::value, bool >::type = true>
_ValueType std::experimental::fundamentals_v1::any_cast ( any &&  __any)
inline

Access the contained object.

Template Parameters
_ValueTypeA reference or CopyConstructible type.
Parameters
__anyThe object to access.
Returns
The contained object.
Exceptions
bad_any_castIf __any.type() != typeid(remove_reference_t<_ValueType>)

Definition at line 400 of file any.

template<typename _ValueType >
const _ValueType* std::experimental::fundamentals_v1::any_cast ( const any __any)
inlinenoexcept

Access the contained object.

Template Parameters
_ValueTypeThe type of the contained object.
Parameters
__anyA pointer to the object to access.
Returns
The address of the contained object if __any != nullptr && __any.type() == typeid(_ValueType) , otherwise a null pointer.

Definition at line 447 of file any.

template<typename _ValueType >
_ValueType* std::experimental::fundamentals_v1::any_cast ( any __any)
inlinenoexcept

Access the contained object.

Template Parameters
_ValueTypeThe type of the contained object.
Parameters
__anyA pointer to the object to access.
Returns
The address of the contained object if __any != nullptr && __any.type() == typeid(_ValueType) , otherwise a null pointer.

Definition at line 455 of file any.

void std::experimental::fundamentals_v1::swap ( any __x,
any __y 
)
inlinenoexcept

Exchange the states of two any objects.

Definition at line 350 of file any.