cpp/utility/functional/function ref/operator=: Difference between revisions
From cppreference.com
m another typo. must be c++26 |
Andreas Krug (talk | contribs) m fmt |
||
| Line 1: | Line 1: | ||
{{cpp/utility/functional/function_ref/title | operator{{=}}}} | {{cpp/utility/functional/function_ref/title|operator{{=}}}} | ||
{{cpp/utility/functional/function_ref/navbar}} | {{cpp/utility/functional/function_ref/navbar}} | ||
{{dcl begin}} | {{dcl begin}} | ||
{{dcl | num=1 | since=c++26 | 1= | {{dcl|num=1|since=c++26|1= | ||
constexpr function_ref& operator=( const function_ref& ) noexcept = default; | constexpr function_ref& operator=( const function_ref& ) noexcept = default; | ||
}} | }} | ||
{{dcl | num=2 | since=c++26 | 1= | {{dcl|num=2|since=c++26|1= | ||
template< class T > | template< class T > | ||
constexpr function_ref& operator=( T ) = delete; | constexpr function_ref& operator=( T ) = delete; | ||
| Line 20: | Line 20: | ||
===See also=== | ===See also=== | ||
{{dsc begin}} | {{dsc begin}} | ||
{{dsc inc | cpp/utility/functional/function_ref/dsc constructor}} | {{dsc inc|cpp/utility/functional/function_ref/dsc constructor}} | ||
{{dsc inc | cpp/utility/functional/function/dsc operator{{=}}}} | {{dsc inc|cpp/utility/functional/function/dsc operator{{=}}}} | ||
{{dsc begin}} | {{dsc begin}} | ||
{{langlinks|de|es|fr|it|ja|pt|ru|zh}} | {{langlinks|de|es|fr|it|ja|pt|ru|zh}} | ||
Revision as of 09:47, 4 January 2024
constexpr function_ref& operator=( const function_ref& ) noexcept = default;
|
(1) | (since C++26) |
template< class T >
constexpr function_ref& operator=( T ) = delete;
|
(2) | (since C++26) |
1) Copy assignment operator is explicitly-defaulted.
std::function_ref satisfies copyable and TriviallyCopyable. This defaulted assignment operator performs a shallow copy of the stored thunk-ptr and bound-entity.2) User-defined assignment operator is explicitly-deleted if
T is not the same type as std::function_ref, std::is_pointer_v<T> is false, and T is not a specialization of std::nontype_t. This overload participates in overload resolution only if the constraints are satisfied in the conditions above.Return value
*this
See also
constructs a new function_ref object (public member function) | |
| assigns a new target (public member function of std::function<R(Args...)>)
|