Namespaces
Variants

std:: numpunct_byname

From cppreference.net
헤더 파일에 정의됨 <locale>
template < class CharT >
class numpunct_byname : public std:: numpunct < CharT > ;

std::numpunct_byname 는 생성 시 지정된 로캘의 숫자 구두점 기본 설정을 캡슐화하는 std::numpunct 패싯입니다.

목차

특수화

표준 라이브러리는 다음과 같은 특수화를 제공함을 보장합니다:

헤더 파일에 정의됨 <locale>
std :: numpunct_byname < char > 로케일별 std::numpunct narrow 문자 입출력 패싯
std :: numpunct_byname < wchar_t > 로케일별 std::numpunct wide 문자 입출력 패싯

중첩 타입

유형 정의
char_type CharT
string_type std:: basic_string < CharT >

멤버 함수

(constructor)
새로운 numpunct_byname 패싯을 생성합니다
(public member function)
(destructor)
numpunct_byname 패싯을 파괴합니다
(protected member function)

std::numpunct_byname:: numpunct_byname

explicit numpunct_byname ( const char * name, std:: size_t refs = 0 ) ;
explicit numpunct_byname ( const std:: string & name, std:: size_t refs = 0 ) ;
(C++11부터)

지정된 로캘 이름 name 에 대한 새로운 std::numpunct_byname 패싯을 생성합니다.

refs 는 리소스 관리에 사용됩니다: refs == 0 인 경우, 구현은 이 패싯을 포함하는 마지막 std::locale 객체가 소멸될 때 패싯을 파괴합니다. 그렇지 않으면 객체는 파괴되지 않습니다.

매개변수

name - 로캘 이름
refs - 패싯에 연결된 참조 횟수

std::numpunct_byname:: ~numpunct_byname

protected :
~numpunct_byname ( ) ;

페이셋을 파괴합니다.

std::numpunct에서 상속됨

중첩 타입

타입 정의
char_type CharT
string_type std:: basic_string < CharT >

데이터 멤버

멤버 설명
std::locale::id id [static] 패싯 의 식별자

멤버 함수

do_decimal_point 을 호출함
( std::numpunct<CharT> 의 public 멤버 함수)
do_thousands_sep 을 호출함
( std::numpunct<CharT> 의 public 멤버 함수)
do_grouping 을 호출함
( std::numpunct<CharT> 의 public 멤버 함수)
do_truename 또는 do_falsename 을 호출함
( std::numpunct<CharT> 의 public 멤버 함수)

보호된 멤버 함수

소수점으로 사용할 문자를 제공함
( std::numpunct<CharT> 의 virtual protected 멤버 함수)
천 단위 구분자로 사용할 문자를 제공함
( std::numpunct<CharT> 의 virtual protected 멤버 함수)
[virtual]
천 단위 구분자 사이의 숫자 자릿수를 제공함
( std::numpunct<CharT> 의 virtual protected 멤버 함수)
불리언 true false 의 이름으로 사용할 문자열을 제공함
( std::numpunct<CharT> 의 virtual protected 멤버 함수)

예제

이 예제는 나머지 로케일을 변경하지 않고 다른 언어의 숫자 구두점 규칙을 적용하는 방법을 보여줍니다.

#include <iostream>
#include <locale>
int main()
{
    const double number = 1000.25;
    std::wcout << L"default locale: " << number << L'\n';
    std::wcout.imbue(std::locale(std::wcout.getloc(),
                                 new std::numpunct_byname<wchar_t>("ru_RU.UTF8")));
    std::wcout << L"default locale with russian numpunct: " << number << L'\n';
}

출력:

default locale: 1000.25
default locale with russian numpunct: 1 000,25

참고 항목

숫자 구두점 규칙을 정의함
(클래스 템플릿)