|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
copyable_function()noexcept; | (1) | (since C++26) |
copyable_function(std::nullptr_t)noexcept; | (2) | (since C++26) |
copyable_function(const copyable_function& other); | (3) | (since C++26) |
copyable_function( copyable_function&& other)noexcept; | (4) | (since C++26) |
template<class F> copyable_function( F&& f); | (5) | (since C++26) |
template<class T,class...CArgs> explicit copyable_function(std::in_place_type_t<T>, CArgs&&...args); | (6) | (since C++26) |
template<class T,class U,class...CArgs> explicit copyable_function(std::in_place_type_t<T>, | (7) | (since C++26) |
Creates a newstd::copyable_function.
std::copyable_function.std::copyable_function whose target is a copy of the target ofother. Otherwise, constructs an emptystd::copyable_function ifother is empty.std::copyable_function whose target is that ofother.other is in a valid but unspecified state after move construction.VT bestd::decay_t<F>. Iff is a null function pointer, a null pointer to member value, or an emptystd::copyable_function (may be any other specialization), then constructs an emptystd::copyable_function. Otherwise, constructs astd::copyable_function whose target is of typeVT and direct-non-list-initialized withstd::forward<F>(f).VT is neither same ascopyable_function nor a specialization ofstd::in_place_type_t, and/*is-callable-from*/<VT> (see below) istrue.VT bestd::decay_t<T>. Constructs astd::copyable_function whose target is of typeVT and direct-non-list-initialized withstd::forward<CArgs>(args)....VT is not the same type asT orstd::is_copy_constructible_v<VT> is nottrue.VT bestd::decay_t<T>. Constructs astd::copyable_function whose target is of typeVT and direct-non-list-initialized withil,std::forward<CArgs>(args)....VT is not the same type asT orstd::is_copy_constructible_v<VT> is nottrue.For constructors(5-7), the behavior is undefined unlessVT satisfies bothDestructible andCopyConstructible requirements.
The constant/*is-callable-from*/<VT> is dependent oncv,ref, andnoex in the template parameter ofstd::copyable_function as below:
| cvrefnoexcept(noex) | /*is-callable-from*/<VT> |
| noexcept(false) | std::is_invocable_r_v<R, VT, Args...>&& std::is_invocable_r_v<R, VT&, Args...> |
| noexcept(true) | std::is_nothrow_invocable_r_v<R, VT, Args...>&& std::is_nothrow_invocable_r_v<R, VT&, Args...> |
| constnoexcept(false) | std::is_invocable_r_v<R,const VT, Args...>&& std::is_invocable_r_v<R,const VT&, Args...> |
| constnoexcept(true) | std::is_nothrow_invocable_r_v<R,const VT, Args...>&& std::is_nothrow_invocable_r_v<R,const VT&, Args...> |
| &noexcept(false) | std::is_invocable_r_v<R, VT&, Args...> |
| &noexcept(true) | std::is_nothrow_invocable_r_v<R, VT&, Args...> |
| const&noexcept(false) | std::is_invocable_r_v<R,const VT&, Args...> |
| const&noexcept(true) | std::is_nothrow_invocable_r_v<R,const VT&, Args...> |
| &&noexcept(false) | std::is_invocable_r_v<R, VT, Args...> |
| &&noexcept(true) | std::is_nothrow_invocable_r_v<R, VT, Args...> |
| const&&noexcept(false) | std::is_invocable_r_v<R,const VT, Args...> |
| const&&noexcept(true) | std::is_nothrow_invocable_r_v<R,const VT, Args...> |
Contents |
| other | - | anotherstd::copyable_function to copy or move from |
| f | - | a function or aCallable object to wrap |
| args | - | arguments to construct the target object |
| il | - | std::initializer_list to construct the target object |
VT is a function pointer type or a specialization ofstd::reference_wrapper.| This section is incomplete Reason: no example |
constructs a newstd::function instance(public member function of std::function<R(Args...)>)[edit] | |
constructs a newstd::move_only_function object(public member function of std::move_only_function)[edit] |