std::function<R(Args...)>::assign

From cppreference.com
< cpp‎ | utility‎ | functional‎ | function
 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
Function objects
Function invocation
(C++17)(C++23)
Identity function object
(C++20)
Transparent operator wrappers
(C++14)
(C++14)
(C++14)
(C++14)  
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)
(C++14)

Old binders and adaptors
(until C++17*)
(until C++17*)
(until C++17*)
(until C++17*)  
(until C++17*)
(until C++17*)(until C++17*)(until C++17*)(until C++17*)
(until C++20*)
(until C++20*)
(until C++17*)(until C++17*)
(until C++17*)(until C++17*)

(until C++17*)
(until C++17*)(until C++17*)(until C++17*)(until C++17*)
(until C++20*)
(until C++20*)
 
 
template< class F, class Alloc >
void assign( F&& f, const Alloc& alloc );
(since C++11)
(removed in C++17)

Initializes the target with f. The alloc is used to allocate memory for any internal data structures that the function might use.

Equivalent to function(std::allocator_arg, alloc, std::forward<F>(f)).swap(*this);.

Parameters

f - callable function to initialize the target with
alloc - allocator to use to allocate memory for the internal data structures

Return value

(none)

Exceptions

May throw implementation-defined exceptions.

See also

assigns a new target
(public member function)