std::indirectly_swappable(3cxx)
β¨ NAME β¨
std::indirectly_swappable β it's the [alg.req.ind.swap] concept, bestie, and yes its whole government name is indirectly_swappable π
This page lives in the 3cxx manual (that's the libstdc++ one, iykyk).
πΈ SYNOPSIS πΈ
#include <iterator>
π¦ Concept definition π¦
template<typename _I1, typename _I2 _I1>
concept std::indirectly_swappable = indirectly_readable<_I1> && indirectly_readable<_I2>
&& requires(const _I1 __i1, const _I2 __i2)
{
ranges::iter_swap(__i1, __i1);
ranges::iter_swap(__i2, __i2);
ranges::iter_swap(__i1, __i2);
ranges::iter_swap(__i2, __i1);
}
okay so real talk: that template line above is exactly what the source says, typo and all. I am not touching it. Not my business. Copy it verbatim or perish π
π DESCRIPTION π
[alg.req.ind.swap], concept indirectly_swappable. That's the whole vibe β it's a concept, it's about swapping things indirectly, and it's living in the <iterator> header like the icon it is. π
π Detailed Description π
[alg.req.ind.swap], concept indirectly_swappable.
Basically: this concept checks that both _I1 and _I2 are indirectly_readable, and then it demands proof β a requires expression with const _I1 __i1 and const _I2 __i2 β that all four of these actually compile:
ranges::iter_swap(__i1, __i1);ranges::iter_swap(__i2, __i2);ranges::iter_swap(__i1, __i2);ranges::iter_swap(__i2, __i1);
All four, no skipping. If any one of them doesn't compile, the concept just says no and moves on. Periodt. β¨
π«Ά AUTHOR π«Ά
Generated automatically by Doxygen for libstdc++ from the source code. No human wrote this, it just appeared, main character energy fr fr π
k bye bestie, this page was served to you fresh from libstdc++ β go swap some iterators, you got this π¦π
π¦ where this page comes from
- ubuntu resolute: libstdc++-13-doc 13.4.0-10ubuntu1
- ubuntu resolute: libstdc++-16-doc 16-20260322-1ubuntu1
- ubuntu stonking: libstdc++-13-doc 13.5.0-1ubuntu1
- ubuntu stonking: libstdc++-16-doc 16.2.0-3ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms