STD::RANGES::SINGLE_VIEW(3cxx)
π std::ranges::single_view< _Tp > β the manual page, bestie π
okay so welcome to the std::ranges::single_view< _Tp >(3cxx) manual page, bestie π. This is the 3cxx manual for std::ranges::single_view< _Tp >, and it is literally about a view that contains exactly one element. No cap. Periodt.
πΈ NAME πΈ
std::ranges::single_view< _Tp > - A view that contains exactly one element.
Thatβs the whole name line. One element. Thatβs the assignment. π
β¨ SYNOPSIS β¨
The synopsis is giving exactly this, so keep it in your notes:
#include <ranges>
Inherits std::ranges::view_interface< single_view< _Tp > >.
So yeah, it inherits std::ranges::view_interface< single_view< _Tp > > β that line is part of the synopsis, and we do not skip synopsis lines in this group chat. π«Ά
π«Ά Public Member Functions π«Ά
Hereβs the full member-function lineup, in the exact order the page gives it. No merging, no skipping, no βweβll come back to that.β We are thorough. π
π constexpr single_view (_Tp &&__t) π
constexpr single_view (_Tp &&__t)
noexcept(is_nothrow_move_constructible_v< _Tp >)
This one is constexpr, takes _Tp &&__t, and its noexcept is exactly is_nothrow_move_constructible_v< _Tp >. Iconic.
π constexpr single_view (const _Tp &__t) π
constexpr single_view (const _Tp &__t)
noexcept(is_nothrow_copy_constructible_v< _Tp >)
This one is constexpr, takes const _Tp &__t, and its noexcept is exactly is_nothrow_copy_constructible_v< _Tp >. Slay.
π template<typename... _Args> in-place constructor π
template<typename... _Args>
requires constructible_from<_Tp, _Args...>constexpr single_view
(in_place_t, _Args &&... __args)
noexcept(is_nothrow_constructible_v< _Tp, _Args... >)"
Okay this one has a requires constructible_from<_Tp, _Args...> and takes in_place_t, _Args &&... __args. Its noexcept is is_nothrow_constructible_v< _Tp, _Args... >. And yes, that trailing " is literally in the original β I am not fixing it, I am respecting the lore. π
π back() π
constexpr decltype(auto) back ()
constexpr decltype(auto) back (). Thatβs the whole line. No noexcept listed here, so we do not invent one.
π begin() const π
constexpr const _Tp * begin () const noexcept
This is the const one: return type const _Tp *, and itβs const noexcept.
π begin() non-const π
constexpr _Tp * begin () noexcept
Non-const begin(): return type _Tp *, noexcept.
π data() const π
constexpr const _Tp * data () const noexcept
const data(): return type const _Tp *, const noexcept.
π data() non-const π
constexpr _Tp * data () noexcept
Non-const data(): return type _Tp *, noexcept.
π empty() π
constexpr bool empty () noexcept(noexcept(_S_empty(_M_derived())))
Returns bool, and its noexcept is noexcept(_S_empty(_M_derived())). That nested noexcept is a whole mood. π
π end() const π
constexpr const _Tp * end () const noexcept
const end(): return type const _Tp *, const noexcept.
π end() non-const π
constexpr _Tp * end () noexcept
Non-const end(): return type _Tp *, noexcept.
π front() π
constexpr decltype(auto) front ()
constexpr decltype(auto) front (). Again, no noexcept in the line, so we do not add one.
π operator bool() π
constexpr operator bool ()
noexcept(noexcept(ranges::empty(_M_derived())))
Conversion to bool, with noexcept equal to noexcept(ranges::empty(_M_derived())).
π operator[] π
constexpr decltype(auto) operator[] (range_difference_t< _Range > __n)
Takes range_difference_t< _Range > __n and returns decltype(auto). Yes, _Range is what the page says, so keep it. No editing. π
β Static Public Member Functions β
Static public member functions β plural heading, one function. The math is mathing. π§
β size() β
static constexpr size_t size () noexcept
Itβs static, constexpr, noexcept, and returns size_t. Thatβs the whole static section.
π Detailed Description π
Now the detailed description, where things get a little unhinged but we still keep every character:
template<copy_constructible _Tp>
requires is_object_v<_Tp>
class std::ranges::single_view< _Tp >"A view that contains exactly one
element.
So the template parameter is copy_constructible _Tp, the requirement is is_object_v<_Tp>, and the class is std::ranges::single_view< _Tp >. The original also has that " right after the > in the code block, and the description wraps as A view that contains exactly one / element. β Iβm keeping it exactly like that. No cap.
π§ Author π§
Author credit, quoted exactly: Generated automatically by Doxygen for libstdc++ from the source code.
Doxygen really said βI got thisβ and generated it automatically for libstdc++ from the source code. Respect. π«Ά
Final sign-off, bestie: the footer on this page is libstdcstd::ranges::single_view< _Tp >(3cxx) β thatβs the source/version-and-date line energy, and thereβs no separate date printed, so thatβs the whole footer vibe. Go forth and contain exactly one element. π
β¨
π¦ where this page comes from
- ubuntu resolute: libstdc++-12-doc 12.5.0-9ubuntu1
- ubuntu resolute: libstdc++-13-doc 13.4.0-10ubuntu1
- ubuntu stonking: libstdc++-12-doc 12.5.0-9ubuntu1
- ubuntu stonking: libstdc++-13-doc 13.5.0-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms