std::basic_ios::init(3)
β¨ NAME β¨
std::basic_ios::init β std::basic_ios::init
okay so this is the manual page for std::basic_ios::init(3) from the C++ Standard Libary manual, and it's giving two-stage initialization realness. π
π Synopsis π
protected:
void init( std::basic_streambuf<CharT,Traits>* sb );
This one sets the associated stream buffer to sb and initializes the internal state. Slay. π
The postconditions are as follows π
rdbuf()βsbtie()β null pointerrdstate()βgoodbitifsbis not a null pointer, otherwisebadbitexceptions()βgoodbitflags()βskipws | decwidth()β0precision()β6fill()βwiden(' ')getloc()β a copy of the value returned bystd::locale()
This member function is protected: it is called by the constructors of the derived stream classes std::basic_istream and std::basic_ostream once the associated stream buffer is known. π«Ά
Until this function is called, every member function (including the destructor) of the default-constructed std::basic_ios invokes undefined behavior. No cap, that's the scary part. π
Also note that basic_ios is a virtual base class, and therefore its constructor is not called by the constructors of those directly derived classes β which is why two-stage initialization is necessary. Iykyk. π¦
πΈ Parameters πΈ
sbβ stream buffer to associate to.
π See also π
- constructor β constructs the object (public member function) β¨
π source/version: http://cppreference.com Β· date: 2024.06.10 Β· page: std::basic_ios::init(3) β love u bestie, go init something safely π
π
π¦ 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