std::experi...::operator=(3)
π std::experi...::operator=(3) π
okay so bestie, this is the page for std::experi...::operator=(3) from the C++ Standard Libary manual β yes, that manual name exactly as it appears β and it's all about std::experimental::function::operator=, the assignment operator. It's giving overload buffet, but we're gonna get through every single one together. π«Άβ¨
π NAME π
std::experimental::function::operator= β std::experimental::function::operator=
β¨ Synopsis β¨
Here's the whole overload lineup, with the overload numbers and TS tags exactly where they belong:
function& operator=( const function& other ); (1) (library fundamentals TS)
function& operator=( function&& other ); (2) (library fundamentals TS)
function& operator=( std::nullptr_t ) noexcept; (3) (library fundamentals TS)
template< class F >
function& operator=( F&& f ); (4) (library fundamentals TS)
template< class F >
function& operator=( std::reference_wrapper<F> f ); (5) (library fundamentals TS)
template< class F >
function& operator=( std::reference_wrapper<F> f ) noexcept; (library fundamentals TS v3)
Assigns a new target to std::experimental::function. In the description below, let ALLOCATOR_OF(f) be the allocator specified in the construction of f, or:
- the value of
std::experimental::pmr::get_default_resource()(until library fundamentals TS v3) - the default-constructed
std::pmr::polymorphic_allocator<>value (library fundamentals TS v3)
at the time of construction if no allocator was specified.
1)β Assigns a copy of target ofother, as if by executingfunction(std::allocator_arg, ALLOCATOR_OF(*this), other).swap(*this);.2)β Moves the target ofotherto*this, as if by executingfunction(std::allocator_arg, ALLOCATOR_OF(*this), std::move(other)).swap(*this);.otheris in a valid state with an unspecified value.3)β Destroys the target of*this.*thisis empty after the call. The memory resource returned byget_memory_resource()after the assignment is equivalent to the memory resource before the assignment, but the address may change.4)β Sets the target of*thisto the callablef, as if by executingfunction(std::allocator_arg, ALLOCATOR_OF(*this),std::forward<F>(f)).swap(*this);. This operator does not participate in overload resolution unlessfis Callable for argument typesArgs...and return typeR.5)β Sets the target of*thisto a copy off, as if by executingfunction(std::allocator_arg, ALLOCATOR_OF(*this), f).swap(*this);.
πΈ Parameters πΈ
otherβ anotherstd::experimental::functionobject to copy or move fromfβ a callable to initialize the target with
π§ Type requirements π§
Fmust meet the requirements ofCallable.
π Return value π
*this
π₯ Exceptions π₯
1,2,4)β Exception thrown on needed allocation of the storage or initialization of the target of*this, if any.5)β (none)
π Notes π
The move assignment operator may need to allocate storage if the relevant condition for your version holds:
get_memory_resource() != other.get_memory_resource()(until library fundamentals TS v3)get_allocator() != other.get_allocator()(library fundamentals TS v3)
π·οΈ Category π·οΈ
Noindexed pages
xoxo, signing off from http://cppreference.com π dated 2024.06.10 π page std::experi...::operator=(3) β¨
π¦ 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