std::basic_...asic_spanbuf(3)
πΈ NAME πΈ
okay bestie, this is the constructor page for std::basic_spanbuf::basic_spanbuf, from the C++ Standard Library manual (the std::basic_...asic_spanbuf(3) page). Itβs giving βhow do I build a basic_spanbuf?β energy, and honestly? iconic. π
β¨ Synopsis β¨
// (1) (since C++23)
basic_spanbuf() : basic_spanbuf(std::ios_base::in | std::ios_base::out) {}
// (2) (since C++23)
explicit basic_spanbuf( std::ios_base::openmode which )
: basic_spanbuf(std::span<CharT>{}, which) {}
// (3) (since C++23)
explicit basic_spanbuf( std::span<CharT> buf,
std::ios_base::openmode which = std::ios_base::in | std::ios_base::out );
// (4) (since C++23)
basic_spanbuf( const basic_spanbuf& ) = delete;
// (5) (since C++23)
basic_spanbuf( basic_spanbuf&& rhs );
π What each overload does π
- Overload (1) β default constructor. Creates a
basic_spanbufthat has no underlying buffer and is opened for both input and output. The pointers to get and put area are set to the null pointer value. π«Ά - Overload (2) β same as (1), except the
basic_spanbufis opened in the mode specified bywhich. - Overload (3) β creates a
basic_spanbufthat manages the underlying buffer referenced bybuf(or has no underlying buffer ifbufis empty) and is opened in the mode specified bywhich. The pointers to get and put area are set as follows, or to the null pointer value if not mentioned in the table:
Get area pointers β set bits in open mode (affecting pointers to get area), return value after setting:
std::ios_base::inβeback()=s.data(),gptr()=s.data(),egptr()=s.data() + s.size()
Put area pointers β set bits in open mode (affecting pointers to put area), return value after setting:
std::ios_base::out && !std::ios_base::ateβpbase()=s.data(),pptr()=s.data(),epptr()=s.data() + s.size()std::ios_base::out && std::ios_base::ateβpbase()=s.data(),pptr()=s.data() + s.size(),epptr()=s.data() + s.size()
- Overload (4) β copy constructor is deleted.
basic_spanbufis not copyable. no cap. - Overload (5) β move constructor. Move-constructs the
std::basic_streambufbase subobject from that ofrhs. The pointers to get and put area, the open mode, and the underlying buffer (if any) are identical to those inrhsbefore construction. It is implementation-defined whetherrhsstill holds the underlying buffer after the move-construction. highkey important.
π Parameters π
bufβ astd::spanreferencing the underlying buffer. πΈrhsβ anotherbasic_spanbuf. π¦whichβ specifies stream open mode. It is a bitmask type, and the following constants are defined: πappβ seek to the end of stream before each writebinaryβ open in binary modeinβ open for readingoutβ open for writingtruncβ discard the contents of the stream when openingateβ seek to the end of stream immediately after opennoreplace(C++23) β open in exclusive mode
π Notes π
These constructors are typically called by the constructors of std::basic_ispanstream, std::basic_ospanstream, and std::basic_spanstream. main character energy, fr fr. π
π¦ Example π¦
This section is incomplete. Reason: no example. π
π See also π
- constructor β constructs the
basic_ispanstream(C++23) (public member function ofstd::basic_ispanstream<CharT,Traits>) - constructor β constructs the
basic_ospanstream(C++23) (public member function ofstd::basic_ospanstream<CharT,Traits>) - constructor β constructs the
basic_spanstream(C++23) (public member function ofstd::basic_spanstream<CharT,Traits>)
π Category π
- Todo no example
source/version/date: http://cppreference.com, 2024.06.10 β page std::basic_...asic_spanbuf(3), byeee bestie, go construct something iconic ππ«Ά
π¦ 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