9 Iterators library [iterators]

9.5 Common algorithm requirements [commonalgoreq]

9.5.4 Concept IndirectlySwappable [commonalgoreq.indirectlyswappable]

The IndirectlySwappable concept specifies a swappable relationship between the values referenced by two Readable types.

  template <class I1, class I2 = I1>
  concept bool IndirectlySwappable =
    Readable<I1> && Readable<I2> &&
    requires(I1&& i1, I2&& i2) {
      ranges::iter_swap(std::forward<I1>(i1), std::forward<I2>(i2));
      ranges::iter_swap(std::forward<I2>(i2), std::forward<I1>(i1));
      ranges::iter_swap(std::forward<I1>(i1), std::forward<I1>(i1));
      ranges::iter_swap(std::forward<I2>(i2), std::forward<I2>(i2));

Given an object i1 of type I1 and an object i2 of type I2, IndirectlySwappable<I1, I2> is satisfied if after ranges::iter_swap(i1, i2), the value of *i1 is equal to the value of *i2 before the call, and vice versa.