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. |
| Заголовочный файл <locale>
|
||
| template< class CharT > class numpunct; |
||
Гранью std::numpunct инкапсулирует числовые предпочтения пунктуации. Поток операций ввода / вывода использовать std::numpunct через std::num_get и std::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.
| Определено в файле <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. (public функция-член) | |
| разрушает 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. (protected функция-член) | |
| | |
| Вызывает 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. (public функция-член) | |
| Вызывает 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. (public функция-член) | |
| Вызывает 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. (public функция-член) | |
| Вызывает 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. (public функция-член) | |
| Вызывает 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. (public функция-член) | |
[править] Охраняемые функций-членов
| [virtual] |
обеспечивает характера для использования в качестве десятичной точки 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. (virtual protected функция-член) |
| [virtual] |
обеспечивает знак, используемый в качестве разделителя тысяч 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. (virtual protected функция-член) |
| [virtual] |
обеспечивает количество цифр между каждой парой тысяч
сепараторов 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. (virtual protected функция-член) |
| [virtual] |
предоставляет строку, используемую в качестве имени логического 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. (virtual protected функция-член) |
| [virtual] |
предоставляет строку, используемую в качестве имени логического 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. (virtual protected функция-член) |
[править] Член объектов
| static std::locale::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. (public объект-член) |
[править] Пример
В следующем примере строка представления 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'; }
Вывод:
default locale: true, false locale with modified numpunct: oui, non
[править] См. также
| создает 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. (шаблон класса) | |
