std::indirectly_swappable(3)
Hey bestie! Welcome to the std::indirectly_swappable(3) page from the C++ Standard Library. This is the manual for that concept, and we're gonna vibe through it together. π
πΈ NAME πΈ
std::indirectly_swappable β that's it, that's the name. Literally std::indirectly_swappable. No cap. β¨
β¨ Synopsis β¨
- Defined in header
<iterator>
template< class I1, class I2 = I1 >
concept indirectly_swappable =
std::indirectly_readable<I1> &&
std::indirectly_readable<I2> &&
requires( const I1 i1, const I2 i2 )
{ (since C++20)
ranges::iter_swap(i1, i1);
ranges::iter_swap(i1, i2);
ranges::iter_swap(i2, i1);
ranges::iter_swap(i2, i2);
};
So basically, the concept indirectly_swappable specifies a relationship between two types that respectively model std::indirectly_readable, and their referenced types can be swapped. It's giving "you can swap the things they point to" energy. π
Semantic requirements
I1 and I2 model indirectly_swappable only if all concepts it subsumes are modeled. Like, no shortcuts, bestie β if it says it subsumes something, you gotta model that too. Periodt. π―
Equality preservation
Expressions declared in requires expressions of the standard library concepts are required to be equality-preserving (except where stated otherwise). Translation: those expressions gotta keep equality intact, unless the fine print says otherwise. Ngl, it's the law. βοΈ
π See also π
indirectly_readable(C++20) (concept) β specifies that a type is indirectly readable by applyingoperator *. So like, it tells you a type can be read indirectly by usingoperator *. π§iter_swap(C++20) (customization point object) β swaps the values referenced by two dereferenceable objects. So it swaps the values that two dereferenceable objects point to. π
This page is from http://cppreference.com, version 2024.06.10, and it's all about std::indirectly_swappable(3). Hope that helped, bestie! Stay iconic. πβ¨
π¦ 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