std::experi...::optional)(3)
π NAME π
okay bestie, the official name is std::experimental::swap(std::experimental::optional) β and the page literally repeats it right after: std::experimental::swap(std::experimental::optional). yes, we love a name that says itself twice π
β¨
This is the std::experi...::optional)(3) page, living in the C++ Standard Libary manual. (That manual name is literally C++ Standard Libary, no cap.) π«Ά
β¨ Synopsis β¨
First up, the header tea:
Defined in header <experimental/optional>
template< class T >
void swap( optional<T>& lhs, optional<T>& rhs ) (library
fundamentals TS)
noexcept(/* see below */);
So this overloads the std::swap algorithm for std::experimental::optional. It exchanges the state of lhs with that of rhs. Effectively calls lhs.swap(rhs). periodt π
πΈ Parameters πΈ
lhs,rhsβ optional objects whose states to swap
like, those are the two cuties whose states are getting swapped, okay? π¦
π Return value π
(none)
literally nothing comes back. it's giving "the swap is the point" energy πβ¨
π₯ Exceptions π₯
the noexcept specification is exactly this:
noexcept(noexcept(lhs.swap(rhs)))
ngl that double-noexcept is a whole vibe, but that's the spec bestie π
π§ Example π§
This section is incomplete Reason: no example
no example yet π the page is leaving us on read, fr fr π
π See also π
swapexchanges the contents β (public member function)
iykyk, it's the member-function version of the same "exchange the contents" moment π
π Categories π
- Noindexed pages
- conditionally noexcept
- Todo no example
mwah π that's the whole page! it came from http://cppreference.com, dated 2024.06.10, and the footer title is literally std::experi...::optional)(3) β bye bestie, slay your optional swaps responsibly π«Άππ
π¦ 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