std::numpunct<CharT>::decimal_point, do_decimal_point
From cppreference.com
| ヘッダー <locale> で定義 |
||
| public: char_type decimal_point() const; |
(1) | |
| protected: virtual char_type do_decimal_point() const; |
(2) | |
1) 公開メンバ関数。最派生クラスのメンバ関数
do_decimal_point を呼び出します。2) 整数部と小数部の間の小数点として使用される文字を返します。
[編集] 戻り値
小数点として使用される char_type 型の値。std::numpunct の標準特殊化は、'.' および L'.' を返します。
[編集] 例
このコードを実行
#include <iostream> #include <locale> struct slash : std::numpunct<char> { char do_decimal_point() const { return '/'; } // separate with slash }; int main() { std::cout.precision(10); std::cout << "default locale: " << 1234.5678 << '\n'; std::cout.imbue(std::locale(std::cout.getloc(), new slash)); std::cout << "locale with modified numpunct: " << 1234.5678 << '\n'; }
出力
default locale: 1234.5678 locale with modified numpunct: 1234/5678