function
<ios> <iostream>
std::noboolalpha
ios_base& noboolalpha (ios_base& str);
No alphanumerical bool values
Clears the boolalpha format flag for the str stream.
When the boolalpha format flag is not set, bool
values are insterted/extracted as integral values (0
and 1
) instead of their textual representations: true and false.
This flag can be set with the boolalpha manipulator.
For standard streams, the boolalpha flag is not set on initialization.
Parameters
- str
- Stream object whose format flag is affected.
Because this function is a manipulator, it is designed to be used alone with no arguments in conjunction with the insertion (<<
) and extraction (>>
) operations on streams (see example below).
Return Value
Argument str.
Example
1 2 3 4 5 6 7 8 9
|
// modify boolalpha flag
#include <iostream> // std::cout, std::boolalpha, std::noboolalpha
int main () {
bool b = true;
std::cout << std::boolalpha << b << '\n';
std::cout << std::noboolalpha << b << '\n';
return 0;
}
| |
Output:
Data races
Modifies str. Concurrent access to the same stream object may cause data races.
Exception safety
Basic guarantee: if an exception is thrown, str is in a valid state.