std::indirectly_swappable(3)

πŸ“¦
version 2024.07.05 Β· 3 versions
, in nixpkgs unstable, opensuse-leap 16.0

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 applying operator *. So like, it tells you a type can be read indirectly by using operator *. 🧚
  • 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