std::num_get (3) - Linux Manuals
std::num_get: std::num_get
NAME
Synopsis
Defined in header <locale>
template<
class CharT,
class InputIt = std::istreambuf_iterator<CharT>
> class num_get;
Class std::num_get encapsulates the rules for parsing string representations of numeric values. Specifically, types bool, unsigned short, unsigned int, long, unsigned long, long long, unsigned long long, float, double, long double, and void* are supported. The standard formatting input operators (such as cin >> n;) use the std::num_get facet of the I/O stream's locale to parse the text representations of the numbers.
std-num get-inheritance.svg
Inheritance diagram
Type requirements
-
InputIt must meet the requirements of LegacyInputIterator.
Specializations
Two standalone (locale-independent) full specializations and two partial specializations are provided by the standard library:
Defined in header <locale>
std::num_get<char> creates narrow string parsing of numbers
std::num_get<wchar_t> creates wide string parsing of numbers
std::num_get<char, InputIt> creates narrow string parsing of numbers using custom input iterator
std::num_get<wchar_t, InputIt> creates wide string parsing of numbers using custom input iterator
In addition, every locale object constructed in a C++ program implements its own (locale-specific) versions of these specializations.
Member types
Member type Definition
char_type CharT
iter_type InputIt
Member functions
constructor (public member function)
destructor (protected member function)
get (public member function)
Member objects
static std::locale::id id (public member object)
Protected member functions
do_get parses a number from an input stream
[virtual]
Example
// Run this code
Output:
See also
numpunct (class template)
num_put (class template)