
Discover more from Daily bit(e) of C++
Random C++ knowledge organized in arbitrary order.
Over 1,000 subscribers
Already have an account? Sign in
Daily bit(e) of C++ | std::ranges::subrange
Daily bit(e) of C++ #321, The convenience adapter for adapting another range, or a pair of an iterator and a sentinel into a range: std::ranges::subrange.
The std::ranges::subrange is a convenience wrapper that can construct a range from another range or a pair of an iterator and a sentinel.
To maintain the sized property of a range, the size can be passed as an additional argument.
One use case for std::ranges::subrange is to adapt algorithms and methods that return a pair of iterators.