A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../algorithm/ranges/../../iterator/ranges/iter_swap.html below:

std::ranges::iter_swap - cppreference.com

namespace ranges {

    inline namespace /* unspecified */ {
        inline constexpr /* unspecified */
            iter_swap = /* unspecified */;
    }

}
(since C++20)
(customization point object)

Call signature

template< class I1, class I2 >
constexpr void iter_swap( I1&& i1, I2&& i2 ) noexcept(/* see below */);

(since C++20)

Helper function

(exposition only*)

Swaps values denoted by two iterators.

The effect of the exposition-only helper function iter-exchange-move is equivalent to

ranges::iter_swap(i1, i2) is expression-equivalent to:

  1. (void)iter_swap(i1, i2), if i1 or i2 has a class or enumeration type and the expression is well-formed, where the overload resolution of iter_swap is performed with the additional candidate void iter_swap(auto, auto) = delete;[1], excluding std::ranges::iter_swap itself.
  2. Otherwise, ranges::swap(*i1, *i2) if both I1 and I2 model indirectly_readable and if std::iter_reference_t<I1> and std::iter_reference_t<I2> model swappable_with.
  3. Otherwise, (void)(*i1 = iter-exchange-move(i2, i1)), if std::indirectly_movable_storable<I1, I2> and std::indirectly_movable_storable<I2, I1> are both modeled, except that i1 is only evaluated once.
  4. Otherwise, ranges::iter_swap(i1, i2) is ill-formed, which can result in substitution failure when ranges::iter_swap(i1, i2) appears in the immediate context of a template instantiation.
  1. ↑ This precludes calling unconstrained std::iter_swap.
Customization point objects

The name ranges::iter_swap denotes a customization point object, which is a const function object of a literal semiregular class type. See CustomizationPointObject for details.

[edit] Example [edit] See also swaps the objects pointed to by two adjusted underlying iterators
(function template) [edit] swaps the objects pointed to by two underlying iterators
(function template) [edit] swaps the elements pointed to by two iterators
(function template) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4