operator==(std::counted_iterator<I>, std::default_sentinel_t)

From cppreference.com
 
 
Iterator library
Iterator concepts
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)

(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)

Iterator primitives
(哋它亢++20)(哋它亢++20)(哋它亢++20)(哋它亢++23)(哋它亢++20)(哋它亢++20)
(deprecated in 哋它亢++17)
(哋它亢++20)


Algorithm concepts and utilities
Indirect callable concepts
Common algorithm requirements
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)  
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
Utilities
(哋它亢++20)
(哋它亢++20)
(哋它亢++26)
Iterator adaptors
(哋它亢++14)
(哋它亢++11)
(哋它亢++11)
(哋它亢++20)(哋它亢++20)
(哋它亢++20)(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++23)
(哋它亢++23)
(哋它亢++23)
(哋它亢++23)
(哋它亢++23)

Iterator operations
(哋它亢++11)  
(哋它亢++11)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
Range access
(哋它亢++11)(哋它亢++14)
(哋它亢++14)(哋它亢++14)  
(哋它亢++11)(哋它亢++14)
(哋它亢++14)(哋它亢++14)  
(哋它亢++17)(哋它亢++20)
(哋它亢++17)
(哋它亢++17)
 
std::counted_iterator
Member functions
(哋它亢++20)
Non-member functions
(哋它亢++20)(哋它亢++20)
operator==(default_sentinel_t)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
Helper classes
(哋它亢++20)
 
friend constexpr bool operator==(
    const counted_iterator& x, std::default_sentinel_t );
(since 哋它亢++20)

Checks if the underlying length (i.e. distance to the end) is equal to 0.

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

The != operator is synthesized from operator==.

Parameters

x - an iterator adaptor

Return value

true if x.count() is equal to 0, false otherwise.

Example

#include <initializer_list>
#include <iterator>
 
int main()
{
    static constexpr auto v = {1, 2, 3, 4};
    constexpr std::counted_iterator<std::initializer_list<int>::iterator>
        it1{v.begin(), 3},
        it2{v.begin(), 0};
    static_assert(it1 != std::default_sentinel);
    static_assert(it2 == std::default_sentinel);
    static_assert(std::default_sentinel != it1);
    static_assert(std::default_sentinel == it2);
}

See also

(哋它亢++20)
compares the distances to the end
(function template)