GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::numpunct::truename,do_truename,falsename,do_falsename(3) C++ Standard Libary std::numpunct::truename,do_truename,falsename,do_falsename(3)

std::numpunct::truename,do_truename,falsename,do_falsename - std::numpunct::truename,do_truename,falsename,do_falsename


Defined in header <locale>
public: (1)
string_type truename() const;
public: (2)
string_type falsename() const;
protected: (3)
virtual string_type do_truename() const;
protected: (4)
virtual string_type do_falsename() const;


1-2) Public member function, calls the member function do_truename and do_falsename
of the most derived class respectively.
3) Returns the string to be used as the representation of the boolean value true.
4) Returns the string to be used as the representation of the boolean value false.


1,3) The object of type string_type to use as the representation of true. The
standard specializations of std::numpunct return "true" and L"true".
2,4) The object of type string_type to use as the representation of false. The
standard specializations of std::numpunct return "false" and L"false".

// Run this code


#include <iostream>
#include <locale>
#include <iomanip>


struct custom_tf : std::numpunct<char> {
std::string do_truename() const { return "t"; }
std::string do_falsename() const { return "f"; }
};


int main()
{
std::cout << std::boolalpha;


// default boolalpha output
std::cout << "Default locale," << '\n'
<< " boolalpha true: " << true << '\n'
<< " boolalpha false: " << false << "\n\n";


// with custom_tf applied to locale
std::cout.imbue(std::locale(std::cout.getloc(), new custom_tf));
std::cout << "Locale with modified numpunct," << '\n'
<< " boolalpha true: " << true << '\n'
<< " boolalpha false: " << false << '\n';
}


Default locale,
boolalpha true: true
boolalpha false: false


Locale with modified numpunct,
boolalpha true: t
boolalpha false: f

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.