std::function::assign(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸŽ€ 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