Namespaces
Variants
Actions

operator==(std::common_iterator)

From cppreference.com
 
 
Iterator library
Iterator concepts
Iterator primitives
Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
(C++20)
(C++20)
(C++20)
Utilities
(C++20)
Iterator adaptors
Range access
(C++11)(C++14)
(C++14)(C++14)  
(C++11)(C++14)
(C++14)(C++14)  
(C++17)(C++20)
(C++17)
(C++17)
 
 
template <class I2, std::sentinel_for<I> S2>

    requires std::sentinel_for<S, I2>
friend constexpr bool operator==( const common_iterator& x,

                                  const std::common_iterator<I2, S2>& y );
(1) (since C++20)
template <class I2, std::sentinel_for<I> S2>

    requires std::sentinel_for<S, I2> && std::equality_comparable_with<I, I2>
friend constexpr bool operator==( const common_iterator& x,

                                  const std::common_iterator<I2, S2>& y );
(2) (since C++20)

Compares the iterators and/or sentinels held by underlying std::variant member objects var. Two incomparable iterators or two sentinels are considered equal.

The behavior is undefined if either x or y is in an invalid state, i.e. x.var.valueless_by_exception() || y.var.valueless_by_exception() is equal to true.

Let i be x.var.index() and j be y.var.index().

1) If i == j (i.e. both x and y hold iterators or both hold sentinels), returns true, otherwise returns std::get<i>(x.var) == std::get<j>(y.var).
2) If i == 1 && j == 1 (i.e. both x and y hold sentinels), returns true, otherwise returns std::get<i>(x.var) == std::get<j>(y.var).

The != operator is synthesized from operator==.

These function templates are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::common_iterator<I> is an associated class of the arguments.

Contents