std::basic_spanbuf::span(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… std::basic_spanbuf::span πŸ’…

okay bestie, welcome to the std::basic_spanbuf::span(3) page from the C++ Standard Libary manual β€” yes, the manual name is folded right in here like a cute little intro, and this whole page is about std::basic_spanbuf::span. slay. πŸ’–

🌸 NAME 🌸

std::basic_spanbuf::span β€” literally std::basic_spanbuf::span, no cap.

✨ Synopsis ✨

std::span<CharT> span() const noexcept;   (1) (since C++23)
void span( std::span<CharT> s ) noexcept; (2) (since C++23)

okay so overload (1) gets a span referencing the written area if std::ios_base::out is set in the open mode, or a span referencing the underlying buffer otherwise. overload (2) makes the basic_spanbuf perform I/O on the buffer referenced by s, and it sets pointers to the get area, the put area, or both. 🫢

πŸ’… get area pointer setup πŸ’…

Set bits in open mode (affecting pointers to get area):

  • std::ios_base::in β€” after setting: eback() returns s.data(), gptr() returns s.data(), and egptr() returns s.data() + s.size().

πŸ’… put area pointer setup πŸ’…

Set bits in open mode (affecting pointers to put area):

  • std::ios_base::out && !std::ios_base::ate β€” after setting: pbase() returns s.data(), pptr() returns s.data(), and epptr() returns s.data() + s.size().
  • std::ios_base::out && std::ios_base::ate β€” after setting: pbase() returns s.data(), pptr() returns s.data() + s.size(), and epptr() returns s.data() + s.size().

🫢 Parameters 🫢

  • s β€” a std::span that references the user-provided buffer.

πŸ’– Return value πŸ’–

  1. std::span<CharT>(pbase(), pptr()) if std::ios_base::out is set in the open mode, or a std::span<CharT> that references the whole underlying buffer otherwise.
  2. (none)

πŸ¦‹ Example πŸ¦‹

This section is incomplete Reason: no example

πŸ‘‘ See also πŸ‘‘

  • str β€” replaces or obtains a copy of the associated character string (public member function of std::basic_stringbuf<CharT,Traits,Allocator>).
  • view β€” obtains a view over the underlying character sequence (C++20) (public member function of std::basic_stringbuf<CharT,Traits,Allocator>).
  • str β€” marks the buffer frozen and returns the beginning pointer of the input sequence (public member function of std::strstreambuf).

πŸŽ€ Category πŸŽ€

  • Todo no example

xoxo bestie πŸ’– β€” source/version: http://cppreference.com, date: 2024.06.10, and this iconic page is std::basic_spanbuf::span(3). πŸŽ€βœ¨

πŸ“¦ where this page comes from