std::function::assign(3)
π NAME π
std::function::assign β std::function::assign, bestie. This is the std::function::assign(3) page from the C++ Standard Libary manual (yes, that's the manual name, spelling exactly as it appears up top π
).
β¨ Synopsis β¨
template< class F, class Alloc > (since C++11)
void assign( F&& f, const Alloc& alloc ); (removed in C++17)
π¨ Okay so lowkey important: this overload is marked (removed in C++17). It was around since C++11 and then got removed in C++17 β no cap, keep that in mind.
So this one initializes the target with f. The alloc is used to allocate memory for any internal data structures that the function might use.
It's equivalent to function(std::allocator_arg, alloc, std::forward<F>(f)).swap(*this); β that's the exact vibe, periodt.
πΈ Parameters πΈ
fβ the callable function to initialize the target with. That's the whole point, bestie.allocβ the allocator to use to allocate memory for the internal data structures.
π Return value π
(none) β literally no return value, it's giving void energy π«Ά.
π¦ Exceptions π¦
May throw implementation-defined exceptions. So like, the implementation decides the details β no extra lore from this page.
π See also π
operator=β assigns a new target (public member function).
Mwah π β source/version: http://cppreference.com; date: 2024.06.10; page: std::function::assign(3). That's the whole manual page, bestie πβ¨
π¦ 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