function() noexcept;
function(nullptr_t) noexcept;
function(const function& f);
Throws: shall not throw exceptions if f's target is a specialization of reference_Βwrapper or a function pointer. Otherwise, may throw bad_Βalloc or any exception thrown by the copy constructor of the stored callable object. [βNote: Implementations are encouraged to avoid the use of dynamically allocated memory for small callable objects, for example, where f's target is an object holding only a pointer or reference to an object and a member function pointer. βββend noteβ]
function(function&& f);
Postconditions: If !f, *this has no target; otherwise, the target of *this is equivalent to the target of f before the construction, and f is in a valid state with an unspecified value.
Throws: shall not throw exceptions if f's target is a specialization of reference_Βwrapper or a function pointer. Otherwise, may throw bad_Βalloc or any exception thrown by the copy or move constructor of the stored callable object. [βNote: Implementations are encouraged to avoid the use of dynamically allocated memory for small callable objects, for example, where f's target is an object holding only a pointer or reference to an object and a member function pointer. βββend noteβ]
template<class F> function(F f);
Remarks: This constructor template shall not participate in overload resolution unless F is Lvalue-Callable for argument types ArgTypes... and return type R.
Otherwise, *this targets a copy of f initialized with stdβ::βmove(f). [βNote: Implementations are encouraged to avoid the use of dynamically allocated memory for small callable objects, for example, where f is an object holding only a pointer or reference to an object and a member function pointer. βββend noteβ]
Throws: shall not throw exceptions when f is a function pointer or a reference_Βwrapper<T> for some T. Otherwise, may throw bad_Βalloc or any exception thrown by F's copy or move constructor.
template<class F> function(F) -> function<see below>;
Remarks: This deduction guide participates in overload resolution only if &Fβ::βoperator() is well-formed when treated as an unevaluated operand. In that case, if decltype(&Fβ::βoperator()) is of the form R(Gβ::β*)(A...) cv &opt noexceptopt for a class type G, then the deduced type is function<R(A...)>.
[βExample:
void f() {
int i{5};
function g = [&](double) { return i; }; // deduces function<int(double)>
}
βββend exampleβ]
function& operator=(const function& f);
function& operator=(function&& f);
function& operator=(nullptr_t) noexcept;
template<class F> function& operator=(F&& f);
Remarks: This assignment operator shall not participate in overload resolution unless decay_Βt<F> is Lvalue-Callable for argument types ArgTypes... and return type R.
template<class F> function& operator=(reference_wrapper<F> f) noexcept;
~function();