Muokkaa

Jaa


<any> functions

The <any> header declares several free functions for working with the any class.

Functions

   
any_cast Makes an object into an any.
make_any Takes values and creates an any object.
swap Exchanges the elements of two any objects.

any_cast

Makes an object into an any.

template<class T>
    T any_cast(const any& operand);
template<class T>
    T any_cast(any& operand);
template<class T>
    T any_cast(any&& operand);
template<class T>
    const T* any_cast(const any* operand) noexcept;
template<class T>
    T* any_cast(any* operand) noexcept;

make_any

Takes values and creates an any object.

template <class T, class... Args>
    any make_any(Args&& ...args);
template <class T, class U, class... Args>
    any make_any(initializer_list<U> il, Args&& ...args);

swap

Exchanges the elements of two any objects.

void swap(any& left, any& right) noexcept;

Parameters

left
An object of type any.

right
An object of type any.

Requirements

Header: <any>

Namespace: std

Standard: C++17 (Use at least /std:c++17 to compile.)

See also

<any>
any class
bad_any_cast