public member function
<locale>
string_type truename() const;
Return string representing true
Returns the string used to represent the boolean value
true.
For the standard specialization of
char the function returns
"true".
For the standard specialization of
wchar_t the function returns
L"true".
During its operation, the version of this function in the generic template simply calls the virtual protected member
do_truename, which is the member function in charge of performing the actions described above.
Parameters
none
Return value
The string used to represent the boolean value
true.
string_type is a member alias of
basic_string<charT>, where
charT is the template parameter (i.e., the facet's character type).
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
// numpunct::truename example
#include <iostream>
#include <locale>
using namespace std;
int main ()
{
const numpunct<char>& punct_facet = use_facet<numpunct<char> >(cout.getloc());
cout << "2+2=4 is ";
if (2+2==4)
cout << punct_facet.truename();
else
cout << punct_facet.falsename();
cout << endl;
return 0;
}
|
Output:
See also
- numpunct::falsename
- Return string representing false (public member function)
- boolalpha
- Alphanumerical bool values (function
)