std::experimental::fundamentals_v1::any Class Reference
Technical Specifications » Library Fundamentals TS » Type-safe container of any type

`#include <any>`

## Public Member Functions

| any () noexcept
template<typename _ValueType , typename _Tp = _Decay<_ValueType>, typename _Mgr = _Manager<_Tp>, typename enable_if< is_constructible< _Tp, _ValueType && >::value, bool >::type = true>
| any (_ValueType &&__value)
template<typename _ValueType , typename _Tp = _Decay<_ValueType>, typename _Mgr = _Manager<_Tp>, typename enable_if<!is_constructible< _Tp, _ValueType && >::value, bool >::type = false>
| any (_ValueType &&__value)
| any (any &&__other) noexcept
| any (const any &__other)
| ~any ()
void | clear () noexcept
bool | empty () const noexcept
template<typename _ValueType >
enable_if_t<!is_same< any, decay_t< _ValueType > >::value, any & > | operator= (_ValueType &&__rhs)
any & | operator= (any &&__rhs) noexcept
any & | operator= (const any &__rhs)
void | swap (any &__rhs) noexcept
const type_info & | type () const noexcept

## Static Public Member Functions

template<typename _Tp >
static constexpr bool | __is_valid_cast ()

## Friends

template<typename _Tp >
enable_if_t< is_object< _Tp >::value, void * > | __any_caster (const any *__any)

## Detailed Description

A type-safe container of any type.

An `any` object's state is either empty or it stores a contained object of CopyConstructible type.

Definition at line 92 of file experimental/any.

## Constructor & Destructor Documentation

## any() [1/5]

std::experimental::fundamentals_v1::any::any | ( |  | ) |

inline noexcept

Default constructor, creates an empty object.

Definition at line 131 of file experimental/any.

## any() [2/5]

std::experimental::fundamentals_v1::any::any | ( | const any & | __other | ) |

inline

Copy constructor, copies the state of `__other`.

Definition at line 134 of file experimental/any.

## any() [3/5]

std::experimental::fundamentals_v1::any::any | ( | any && | __other | ) |

inline noexcept

Move constructor, transfer the state from `__other`.

Postcondition
  `__other.empty()` (this postcondition is a GNU extension)

Definition at line 151 of file experimental/any.

## any() [4/5]

template<typename _ValueType , typename _Tp = _Decay<_ValueType>, typename _Mgr = _Manager<_Tp>, typename enable_if< is_constructible< _Tp, _ValueType && >::value, bool >::type = true>

std::experimental::fundamentals_v1::any::any | ( | _ValueType && | __value | ) |

inline

Construct with a copy of `__value` as the contained object.

Definition at line 168 of file experimental/any.

## any() [5/5]

template<typename _ValueType , typename _Tp = _Decay<_ValueType>, typename _Mgr = _Manager<_Tp>, typename enable_if<!is_constructible< _Tp, _ValueType && >::value, bool >::type = false>

std::experimental::fundamentals_v1::any::any | ( | _ValueType && | __value | ) |

inline

Construct with a copy of `__value` as the contained object.

Definition at line 181 of file experimental/any.

## ~any()

std::experimental::fundamentals_v1::any::~any | ( |  | ) |

inline

Destructor, calls `clear()`

Definition at line 190 of file experimental/any.

## Member Function Documentation

## __is_valid_cast()

template<typename _Tp >

static constexpr bool std::experimental::fundamentals_v1::any::__is_valid_cast | ( |  | ) |

inline static constexpr

Definition at line 289 of file experimental/any.

## clear()

void std::experimental::fundamentals_v1::any::clear | ( |  | ) |

inline noexcept

If not empty, destroy the contained object.

Definition at line 232 of file experimental/any.

## empty()

bool std::experimental::fundamentals_v1::any::empty | ( |  | ) | const

inline noexcept

Reports whether there is a contained object or not.

Definition at line 274 of file experimental/any.

## operator=() [1/3]

template<typename _ValueType >

enable_if_t<!is_same< any, decay_t< _ValueType > >::value, any & > std::experimental::fundamentals_v1::any::operator= | ( | _ValueType && | __rhs | ) |

inline

Store a copy of `__rhs` as the contained object.

Definition at line 223 of file experimental/any.

## operator=() [2/3]

any & std::experimental::fundamentals_v1::any::operator= | ( | any && | __rhs | ) |

inline noexcept

Move assignment operator.

Postcondition
  `__rhs.empty()` (not guaranteed for other implementations)

Definition at line 206 of file experimental/any.

## operator=() [3/3]

any & std::experimental::fundamentals_v1::any::operator= | ( | const any & | __rhs | ) |

inline

Copy the state of another object.

Definition at line 195 of file experimental/any.

## swap()

void std::experimental::fundamentals_v1::any::swap | ( | any & | __rhs | ) |

inline noexcept

Exchange state with another object.

Definition at line 242 of file experimental/any.

## type()

const type_info & std::experimental::fundamentals_v1::any::type | ( |  | ) | const

inline noexcept

The `typeid` of the contained object, or `typeid(void)` if empty.

Definition at line 278 of file experimental/any.

The documentation for this class was generated from the following file:

- experimental/any