<any>
标头声明多个用于处理此 any
class 的 Free 函数。
函数
名称 | DESCRIPTION |
---|---|
any_cast |
将对象设为 any 。 |
make_any |
采用值并创建 any 对象。 |
swap |
交换两个 any 对象的元素。 |
any_cast
将对象设为 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
采用值并创建 any
对象。
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
交换两个 any
对象的元素。
void swap(any& left, any& right) noexcept;
参数
left
一个 any
类型的对象。
right
一个 any
类型的对象。
要求
标头<any>:
命名空间:std
标准:C++17(至少使用 /std:c++17
进行编译。)