any& operator=( const any& rhs ); | (1) | (since C++17) |
any& operator=( any&& rhs ) noexcept; | (2) | (since C++17) |
template<typename ValueType> any& operator=( ValueType&& rhs ); | (3) | (since C++17) |
Assigns contents to the contained value.
rhs
, as if by any(rhs).swap(*this)
.rhs
, as if by any(std::move(rhs)).swap(*this)
. rhs
is left in a valid but unspecified state after the assignment.rhs
, as if by any(std::forward<ValueType>(rhs)).swap(*this)
. This overload only participates in overload resolution if std::decay_t<ValueType>
is not the same type as any
and std::is_copy_constructible_v<std::decay_t<ValueType>>
is true
. .ValueType | - | contained value type |
Type requirements | ||
-std::decay_t<ValueType> must meet the requirements of CopyConstructible. |
rhs | - | object whose contained value to assign |
*this
.
bad_alloc
or any exception thrown by the constructor of the contained type. If an exception is thrown, there are no effects (strong exception guarantee). constructs an any object (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/any/operator=