std::boolal...:noboolalpha(3)
β¨ NAME β¨
Okay so this is the std::boolal...:noboolalpha(3) page from the C++ Standard Libary β yes bestie, thatβs the manual name folded in near the top instead of copying the whole header line like a bot π
. The name itself is:
std::boolalpha,std::noboolalpha - std::boolalpha,std::noboolalpha
Lowkey iconic that it just says the same thing twice, but we respect the source β¨.
πΈ Synopsis πΈ
Defined in header <ios>:
std::ios_base& boolalpha( std::ios_base& str ); (1)
std::ios_base& noboolalpha( std::ios_base& str ); (2)
- Enables the
boolalphaflag in the streamstras if by callingstr.setf(std::ios_base::boolalpha). - Disables the
boolalphaflag in the streamstras if by callingstr.unsetf(std::ios_base::boolalpha).
std::boolalpha is an I/O manipulator, so it may be called with an expression such as
out << std::boolalpha
for any out of type std::basic_ostream, or with an expression such as
in >> std::boolalpha
for any in of type std::basic_istream.
π«Ά Parameters π«Ά
strβ reference to I/O stream
π Return value π
str (reference to the stream after manipulation).
π Example π
Hereβs the code, bestie β run it, donβt just look at it π:
// Run this code
#include <iostream>
#include <sstream>
int main()
{
// boolalpha output
std::cout << "default true: " << true << '\n'
<< "default false: " << false << '\n'
<< std::boolalpha
<< "boolalpha true: " << true << '\n'
<< "boolalpha false: " << false << '\n'
<< std::noboolalpha
<< "noboolalpha true: " << true << '\n'
<< "noboolalpha false: " << false << '\n';
// boolalpha parse
bool b1, b2;
std::istringstream is("true false");
is >> std::boolalpha >> b1 >> b2;
std::cout << '"' << is.str() << "\" parsed as: "
<< std::boolalpha << b1 << ' ' << b2 << '\n';
}
π Output: π
default true: 1
default false: 0
boolalpha true: true
boolalpha false: false
noboolalpha true: 1
noboolalpha false: 0
"true false" parsed as: true false
π See also π
resetiosflagsβ clears the specifiedios_baseflags (function)setiosflagsβ sets the specifiedios_baseflags (function)do_truenameβ provides the string to use as the name of the booleantrueandfalsedo_falsenameβ (virtual protected member function ofstd::numpunct<CharT>) [virtual]
And thatβs the whole page, bestie π. Source/version/date sign-off: http://cppreference.com, 2024.06.10, std::boolal...:noboolalpha(3). Periodt β¨
π¦ 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