std::boolalpha, std::noboolalpha
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <ios>
|
||
| std::ios_base& boolalpha( std::ios_base& str ); |
(1) | |
| std::ios_base& noboolalpha( std::ios_base& str ); |
(2) | |
流中的
2) boolalpha如果通过调用str使str.setf(std::ios_base::boolalpha)标志Original:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
如果通过调用
boolalpha禁用流中的strstr.unsetf(std::ios_base::boolalpha)标志Original:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
std::boolalpha是一个I / O机械手,它可以被称为与表达,如out << std::boolalpha的任何out类型std::basic_ostream或表达,如in >> std::boolalpha任何类型in的std::basic_istream.Original:
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.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目录 |
[编辑] 参数
| str | - | 参考I / O流
Original: reference to I/O stream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[编辑] 返回值
str(参考操作后到流)Original:
str (reference to the stream after manipulation)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 为例
#include <sstream> #include <locale> #include <iostream> int main() { // boolalpha output std::cout << std::boolalpha << "boolalpha true: " << true << '\n' << "boolalpha false: " << false << '\n'; std::cout << std::noboolalpha << "noboolalpha true: " << true << '\n' << "noboolalpha false: " << false << '\n'; // booalpha parse bool b1, b2; std::istringstream is("true false"); is >> std::boolalpha >> b1 >> b2; std::cout << '\"' << is.str() << "\" parsed as " << b1 << ' ' << b2 << '\n'; }
Output:
boolalpha true: true boolalpha false: false noboolalpha true: 1 noboolalpha false: 0 "true false" parsed as 1 0
[编辑] 另请参阅
| 清除指定的ios_base标志 Original: clears the specified ios_base flags The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) | |
| 设置指定的ios_base标志 Original: sets the specified ios_base flags The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) | |
| [虚拟的] </ SPAN></div></div>
|
提供该字符串的布尔true使用的名称 Original: provides the string to use as the name of the boolean true The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (虚拟保护成员函数of std::numpunct)
|
| [虚拟的] </ SPAN></div></div>
|
提供该字符串的布尔false使用的名称 Original: provides the string to use as the name of the boolean false The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (虚拟保护成员函数of std::numpunct)
|