std::numpunct
来自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 <locale>
|
||
| template< class CharT > class numpunct; |
||
方面std::numpunct封装数字标点符号的喜好。流I / O操作使用std::numpunctstd::num_getstd::num_put为,解析数字输入和格式的数字输出.
Original:
The facet std::numpunct encapsulates numeric punctuation preferences. Stream I/O operations use std::numpunct through std::num_get and std::num_put for parsing numeric input and formatting numeric output.
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.
两个专业所提供的标准库
Original:
Two specializations are provided by the standard library
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.
| Defined in header
<locale> | |
| std::numpunct<char> | 提供等值的“C”语言环境的偏好
Original: provides equivalents of the "C" locale preferences The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| std::numpunct<wchar_t> | 提供宽字符当量的“C”语言环境的偏好
Original: provides wide character equivalents of the "C" locale preferences The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
目录 |
[编辑] 会员类型
| 会员类型
Original: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
char_type
|
charT
|
string_type
|
std::basic_string<charT> |
[编辑] 成员函数
| 构造一个新numpunct方面 Original: constructs a new numpunct facet The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
| 解构一个numpunct方面 Original: destructs a numpunct facet The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (受保护的成员函数) | |
| | |
| 调用 do_decimal_point Original: invokes do_decimal_point The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
| 调用 do_thousands_sep Original: invokes do_thousands_sep The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
| 调用 do_grouping Original: invokes do_grouping The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
| 调用 do_truename Original: invokes do_truename The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员函数) | |
| 调用 do_falsename Original: invokes do_falsename 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>
|
提供要使用的字符作为小数点 Original: provides the character to use as decimal point 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>
|
使用千位分隔符的字符 Original: provides the character to use as thousands separator 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>
|
每个对成千上万之间提供的数字的位数
分隔符 Original: provides the numbers of digits between each pair of thousands
separators 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. (虚拟保护成员函数) |
| [虚拟的] </ 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. (虚拟保护成员函数) |
[编辑] 会员对象
| static std::locale::id id |
“ID”的语言环境 Original: id of the locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (公共成员对象) |
[编辑] 为例
下面的示例更改true和false的字符串表示形式
Original:
The following example changes the string representations of true and false
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 <iostream> #include <locale> struct french_bool : std::numpunct<char> { string_type do_truename() const { return "oui"; } string_type do_falsename() const { return "non"; } }; int main() { std::cout << "default locale: " << std::boolalpha << true << ", " << false << '\n'; std::cout.imbue(std::locale(std::cout.getloc(), new french_bool())); std::cout << "locale with modified numpunct: " << std::boolalpha << true << ", " << false << '\n'; }
Output:
default locale: true, false locale with modified numpunct: oui, non
[编辑] 另请参阅
| 创建名为locale的一个numpunct方面的 Original: creates a numpunct facet for the named locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
