std::default_sentinel_t, std::default_sentinel
Min standard notice:
Header: <iterator>
- default_sentinel_t is an empty class type used to denote the end of a range. It can be used together with iterator types that know the bound of their range (e.g., std::counted_iterator).
# Declarations
struct default_sentinel_t {};
(since C++20)
inline constexpr default_sentinel_t default_sentinel{};
(since C++20)
# Example
#include <algorithm>
#include <iostream>
#include <iterator>
#include <list>
int main()
{
std::list<int> l{3, 1, 4, 1, 5, 9, 2, 6};
std::ranges::copy(std::counted_iterator(std::begin(l), 4),
std::default_sentinel, std::ostream_iterator<int>{std::cout, " "});
std::cout << '\n';
}