std::basic_stringbuf::view(3)
π std::basic_stringbuf::view(3) π
πΈ NAME πΈ
std::basic_stringbuf::view β std::basic_stringbuf::view
Okay bestie, welcome to the C++ Standard Libary page for std::basic_stringbuf::view β yes, that manual name is spelled βLibaryβ in the header, and we are respecting the typo. π
π¦ Synopsis π¦
std::basic_string_view<CharT, Traits> view() const noexcept; (since
C++20)
This creates and returns a std::basic_string_view over the underlying character sequence. Slay. β¨
- For input-only streams, the returned view represents the range
[eback(), egptr()). - For input/output or output-only streams, it references the characters from
pbase()to the last character in the sequence regardless ofegptr()andepptr(). - If the stream is neither input nor output, it returns
std::basic_string_view<CharT, Traits>{}.
The member character sequence in a buffer open for writing can be over-allocated for efficiency purposes. In that case, only the initialized characters are referenced: these characters are the ones that were obtained from the string argument of the constructor, the string argument used by the most recent call to a setter overload of str(), or from a write operation. A typical implementation that uses over-allocation maintains a high-watermark pointer to track the end of the initialized part of the buffer and the returned view references the characters from pbase() to the high-watermark pointer. Iconic implementation detail, honestly. π
π Parameters π
(none) β literally none, bestie. π«Ά
β¨ Return value β¨
A view over the underlying character sequence. That's the whole vibe. π
π Notes π
Using the return value is undefined behavior if the underlying character sequence is destroyed or invalidated, unless the return value is empty. Not a drill β undefined behavior is giving βdo not touchβ energy. π
This function is typically accessed through std::basic_istringstream::view(), std::basic_ostringstream::view(), or std::basic_stringstream::view().
π See also π
strβ replaces or obtains a copy of the associated character string (public member function).operator basic_string_view(C++17) β returns a non-modifiablestring_viewinto the entire string (public member function ofstd::basic_string<CharT,Traits,Allocator>).
Cute sign-off: source/version/date served with sparkle β http://cppreference.com, 2024.06.10, and the page tag std::basic_stringbuf::view(3). Mwah, bye bestie! ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms