Namespaces
Variants
Actions

operator-(std::basic_const_iterator)

From cppreference.com
 
C++
 
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)
 
std::basic_const_iterator
template< std::sized_sentinel_for<Iter> S >
constexpr difference_type operator-( const S& s ) const;
(1) (since C++23)
template< /*not-a-const-iterator*/ S >

    requires std::sized_sentinel_for<S, Iter>
friend constexpr difference_type

    operator-( const S& s, const basic_const_iterator& i );
(2) (since C++23)

Returns the distance between basic_const_iterator and its sentinel.

S satisfies the exposition-only concept /*not-a-const-iterator*/ if and only if it's not a specialization of basic_const_iterator.

[edit] Parameters

i, s - iterator and sentinel to compute the difference of

[edit] Return value

1) base() - s
2) s - i.base()

[edit] Example

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant