public member function
<locale>
string_type falsename() const;
String representation of false
Returns the string used to represent the boolean value false
.
Internally, this function simply calls the virtual protected member do_falsename, which for the standard specializations returns:
Return value
The string used to represent the boolean value false
.
Member type string_type is a basic_string type with the same character type as the facet (defined as an alias of basic_string<charT>
, where charT
is numpunct's template parameter).
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
// numpunct::falsename example
#include <iostream> // std::cout
#include <string> // std::string
#include <locale> // std::locale, std::numpunct, std::use_facet
int main ()
{
const std::numpunct<char>& punct_facet =
std::use_facet<std::numpunct<char> >(std::cout.getloc());
std::string str = "2+2=5 is ";
if (2+2==5)
str+=punct_facet.truename();
else
str+=punct_facet.falsename();
std::cout << str << '\n';
return 0;
}
|
Output:
Data races
The facet is accessed.
Exception safety
Strong guarantee: No side effects in case an exception is thrown.