std::experi...agate_const)(3)

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

✨ NAME ✨

okay so this page is from the C++ Standard Library manual (the header literally says β€œC++ Standard Libary” β€” typo is canon, not me 😭), and it’s all about std::experimental::swap(std::experimental::propagate_const).

The name is std::experimental::swap(std::experimental::propagate_const) β€” yes, it’s the std::experimental::swap(std::experimental::propagate_const) page, no cap. We’re literally swapping propagate_const besties. πŸ’…


🌸 SYNOPSIS 🌸

The man page tags this synopsis as (library fundamentals TS v2), and the signature is:

template< class T >
constexpr void swap( std::experimental::propagate_const<T>& lhs,
                     std::experimental::propagate_const<T>& rhs ) noexcept(/* see below */);

So this specializes the swap algorithm for std::experimental::propagate_const. It swaps the pointers of lhs and rhs. Equivalent to lhs.swap(rhs). πŸ’–

glow-up note: in library fundamentals TS v3, this overload participates in overload resolution only if std::is_swappable_v<T> is true. (Yes, std::is_swappable_v<T> β€” keep that exact spelling, bestie. 🫢)

πŸŽ€ PARAMETERS πŸŽ€

  • lhs, rhs β€” the propagate_consts whose contents to swap. That’s the whole assignment. iconic.

πŸ¦‹ RETURN VALUE πŸ¦‹

none β€” literally (none). Nothing comes back. Slay.


πŸ’€ EXCEPTIONS πŸ’€

The noexcept specification is:

noexcept(noexcept(lhs.swap(rhs)))

So it’s conditionally noexcept, and the vibes are very β€œdepends on lhs.swap(rhs).” πŸ™ˆ


πŸ”₯ COMPLEXITY πŸ”₯

Constant. O(1) energy, periodt.


🌈 SEE ALSO 🌈

  • swap β€” swaps the values of two objects (function template)
  • swap β€” swaps the wrapped pointer (public member function)

πŸ‘‘ CATEGORY πŸ‘‘

  • * conditionally noexcept

made with πŸ’– from cppreference.com, version/date 2024.06.10, and the footer is still giving truncated std::experi...agate_const)(3) main-character energy. bye bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from