STD::RANGES::SUBRANGE(3)
okay so bestie, welcome to the Library Functions Manual page for std::range...t, _Kind >(3) π this is all about the std::ranges::subrange class template, and it's literally so iconic.
β¨ NAME β¨
std::ranges::subrange< _It, _Sent, _Kind > β the ranges::subrange class template. it's giving range subview realness, no cap.
πΈ SYNOPSIS πΈ
#include <ranges>
Inherits std::ranges::view_interface< _Derived >. (so it's in the view_interface clique, periodt)
π Public Member Functions π
here's the whole squad of member functions, every single one, bestie:
constexpr subrange (__detail::__convertible_to_non_slicing< _It > auto
__i, _Sent __s) noexcept(is_nothrow_constructible_v< _It,
decltype(__i)> &&is_nothrow_constructible_v< _Sent, _Sent & >)
constexpr subrange (__detail::__convertible_to_non_slicing< _It > auto
__i, _Sent __s, __size_type __n)
noexcept(is_nothrow_constructible_v< _It, decltype(__i)>
&&is_nothrow_constructible_v< _Sent, _Sent & >)
template<__detail::__different_from< subrange > _Rng>
requires _S_store_sizeconstexpr subrange (_Rng &&__r)
noexcept(noexcept(subrange(__r, ranges::size(__r)))) &&sized_range<
_Rng >"
template<__detail::__different_from< subrange > _Rng>
requires (!_S_store_size)constexpr subrange (_Rng &&__r)
noexcept(noexcept(subrange(ranges::begin(__r), ranges::end(__r))))"
template<borrowed_range _Rng>
requires (_Kind == subrange_kind::sized)constexpr subrange (_Rng
&&__r, __size_type __n)
noexcept(noexcept(subrange(ranges::begin(__r), ranges::end(__r),
__n)))"
constexpr subrange & advance (iter_difference_t< _It > __n)
constexpr decltype(auto) back ()
constexpr decltype(auto) back () const
constexpr _It begin ()
constexpr _It begin () const
constexpr auto cbegin ()
constexpr auto cbegin () const
constexpr auto cend ()
constexpr auto cend () const
constexpr auto data () const
noexcept(noexcept(ranges::begin(_M_derived())))
constexpr auto data () noexcept(noexcept(ranges::begin(_M_derived())))
constexpr bool empty () const
constexpr bool empty () noexcept(noexcept(_S_empty(_M_derived())))
constexpr _Sent end () const
constexpr decltype(auto) front ()
constexpr decltype(auto) front () const
constexpr subrange next (iter_difference_t< _It > __n=1) &&
constexpr subrange next (iter_difference_t< _It > __n=1) const &
template<__detail::__different_from< subrange > _PairLike> constexpr
operator _PairLike () const
constexpr operator bool () const
noexcept(noexcept(ranges::empty(_M_derived())))
constexpr operator bool ()
noexcept(noexcept(ranges::empty(_M_derived())))
template<random_access_range _Range = _Derived> constexpr decltype(auto)
operator[] (range_difference_t< _Range > __n)
template<random_access_range _Range = const _Derived> constexpr
decltype(auto) operator[] (range_difference_t< _Range > __n) const
constexpr subrange prev (iter_difference_t< _It > __n=1) const
constexpr __size_type size () const
constexpr auto size () noexcept(noexcept(_S_size(_M_derived())))
π«Ά Friends π«Ά
struct views::_Drop
πΈ Detailed Description πΈ
okay so the actual class template definition is this masterpiece:
template<input_or_output_iterator _It, sentinel_for< _It > _Sent = _It,
subrange_kind _Kind = sized_sentinel_for<_Sent, _It> ?
subrange_kind::sized : subrange_kind::unsized>
requires (_Kind == subrange_kind::sized || !sized_sentinel_for<_Sent,
_It>)
class std::ranges::subrange< _It, _Sent, _Kind >"The ranges::subrange
class template.
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. (so it's the Doxygen machine's work, not a human, but it ate and left no crumbs)
mwah π this was libstdc++, page std::range...t, _Kind >(3). no date bestie, it's timeless β¨
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms