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