std::experi...::function)(3)

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

πŸ’… std::experimental::swap(std::experimental::function) πŸ’…

okay so bestie, this is a page straight out of the C++ Standard Libary (their spelling, not mine, don't come for me 😭) and it's about one very specific little swap. Let's get into it.


🌸 NAME 🌸

std::experimental::swap(std::experimental::function) β€” literally just std::experimental::swap(std::experimental::function) again, that's the whole name, no notes πŸ’€

✨ Synopsis ✨

Here's the signature, copy it exactly bestie, character for character:

template< class R, class... Args >

void swap( std::experimental::function<R(Args...)> &lhs,

           std::experimental::function<R(Args...)> &rhs );

So what is this? It overloads the swap algorithm for std::experimental::function. It exchanges the state of lhs with that of rhs β€” and the way it does that is, effectively, it just calls lhs.swap(rhs). That's it. That's the whole vibe 🫢

πŸŽ€ Parameters πŸŽ€

  • lhs, rhs β€” polymorphic function wrappers whose states to swap. yeah. both of them. the states get swapped. iconic behaviour honestly πŸ’…

🌈 Return value 🌈

(none) β€” nothing, nada, zero, it just does the thing and dips πŸ‘‘

πŸ”₯ Exceptions πŸ”₯

May throw implementation-defined exceptions. so like, it might throw, but which ones is between your implementation and the compiler, iykyk πŸ™ˆ

πŸ¦‹ Example πŸ¦‹

This section is incomplete Reason: no example

😭😭 no example bestie, they really left us hanging. (The category section is out here doing a whole "Todo: no example" callout about it, so at least we're not alone in our grief.)

⭐ See also ⭐

  • swap β€” swaps the contents (public member function)

and that's the page!! short and sweet, main character energy for a swap overload fr fr πŸŒΈπŸ’–

sign-off time πŸŽ€ this little cutie came from http://cppreference.com, dated 2024.06.10, and the header/footer both say std::experi...::function)(3) because the title got truncated and honestly? relatable. stay slaying, bestie πŸ’…βœ¨
πŸ“¦ where this page comes from