Namespaces
Variants

std::moneypunct<CharT,International>:: thousands_sep, do_thousands_sep

From cppreference.net
헤더에 정의됨 <locale>
public :
char_type thousands_sep ( ) const ;
(1)
protected :
virtual char_type do_thousands_sep ( ) const ;
(2)
1) 공개 멤버 함수, 가장 파생된 클래스의 멤버 함수 do_thousands_sep 를 호출합니다.
2) 통화 값의 정수 부분을 파싱하거나 포맷팅할 때 숫자 그룹 사이의 구분자로 사용될 문자를 반환합니다.

반환값

char_type 형식의 객체로, 천 단위 구분자로 사용됩니다. 일반적인 미국 로캘에서는 ',' 또는 L ',' 입니다.

예제

#include <iomanip>
#include <iostream>
#include <iterator>
#include <locale>
struct space_out : std::moneypunct<char>
{
    pattern do_pos_format() const { return {value, none, none, none}; }
    int do_frac_digits() const { return 0; }
    char_type do_thousands_sep() const { return ' '; }
    string_type do_grouping() const { return "\002"; }
};
int main()
{
    std::cout.imbue(std::locale("en_US.UTF-8"));
    std::cout << "american locale: " << std::showbase
              << std::put_money(12345678.0) << '\n';
    std::cout.imbue(std::locale(std::cout.getloc(), new space_out));
    std::cout << "locale with modified moneypunct: "
              << std::put_money(12345678.0) << '\n';
}

출력:

american locale: $123,456.78
locale with modified moneypunct: 12 34 56 78

참고 항목

[virtual]
천 단위 구분자 사이의 숫자 자릿수를 제공함
(가상 protected 멤버 함수)