public member function
<locale>

std::numpunct::decimal_point

char_type decimal_point() const;
Decimal point character
Returns the character used to represent the decimal radix separator.

Internally, this function simply calls the virtual protected member do_decimal_point, which for the standard specializations returns
特化返回 11。
numpunct<char>'.'
numpunct<wchar_t>L'.'

引數



返回值

The character used as decimal separator.
Member type char_type is the facet's character type (defined as an alias of numpunct's template parameter, charT).

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
// numpunct::decimal_point example
#include <iostream>       // std::cout
#include <locale>         // std::locale, std::numpunct, std::use_facet

int main ()
{
  int nUnits=11;
  int nQuarters=7;
  char point = std::use_facet< std::numpunct<char> >(std::cout.getloc()).decimal_point();
  std::cout << nUnits << " units and " << nQuarters << " quarters total ";
  std::cout << (nUnits+nQuarters/4) << point << (25*(nQuarters%4)) << '\n';
  return 0;
}

輸出

11 units and 7 quarters total 12.75


資料競爭

訪問此分面。

異常安全

強異常保證: 如果丟擲異常,則沒有副作用。

另見