28 Localization library [localization]

28.4 Standard locale categories [locale.categories]

28.4.3 The numeric category [category.numeric]

28.4.3.1 General [category.numeric.general]

The classes num_­get<> and num_­put<> handle numeric formatting and parsing.
Virtual functions are provided for several numeric types.
Implementations may (but are not required to) delegate extraction of smaller types to extractors for larger types.257
All specifications of member functions for num_­put and num_­get in the subclauses of [category.numeric] only apply to the specializations required in Tables 106 and 107 ([locale.category]), namely num_­get<char>, num_­get<wchar_­t>, num_­get<C, InputIterator>, num_­put<char>, num_­put<wchar_­t>, and num_­put<C, OutputIterator>.
These specializations refer to the ios_­base& argument for formatting specifications ([locale.categories]), and to its imbued locale for the numpunct<> facet to identify all numeric punctuation preferences, and also for the ctype<> facet to perform character classification.
Extractor and inserter members of the standard iostreams use num_­get<> and num_­put<> member functions for formatting and parsing numeric values ([istream.formatted.reqmts], [ostream.formatted.reqmts]).
257)257)
Parsing "-1" correctly into, e.g., an unsigned short requires that the corresponding member get() at least extract the sign before delegating.