std::any::operator=(3)
π NAME π
okay so bestie, welcome to the std::any::operator=(3) page β the C++ Standard Libary one β¨ this is literally the assignment operator for std::any, and its NAME is:
std::any::operator= - std::any::operator=
no cap, itβs a little redundant but thatβs the NAME section and we respect it π
β¨ Synopsis β¨
any& operator=( const any& rhs ); (1) (since C++17)
any& operator=( any&& rhs ) noexcept; (2) (since C++17)
template< typename ValueType > (3) (since C++17)
any& operator=( ValueType&& rhs );
Assigns contents to the contained value. yes queen, thatβs the whole vibe of the function π
- Assigns by copying the state of
rhs, as if byany(rhs).swap(*this). - Assigns by moving the state of
rhs, as if byany(std::move(rhs)).swap(*this).rhsis left in a valid but unspecified state after the assignment. - Assigns the type and value of
rhs, as if byany(std::forward<ValueType>(rhs)).swap(*this). This overload participates in overload resolution only ifstd::decay_t<ValueType>is not the same type asanyandstd::is_copy_constructible_v<std::decay_t<ValueType>>is true.
πΈ Template parameters πΈ
ValueTypeβ contained value type
π¦ Type requirements π¦
std::decay_t<ValueType>must meet the requirements ofCopyConstructible.
π Parameters π
rhsβ object whose contained value to assign
β Return value β
*this
π Exceptions π
1,3) Throws std::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).
π Example π
This section is incomplete Reason: no example
π See also π
constructorβ constructs ananyobject (public member function)
π Category π
* Todo no example
xoxo, your favorite Unix bestie π
source/version/date check: http://cppreference.com, 2024.06.10, and the page itself is std::any::operator=(3). mwah π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms