STD::NUM_GET(3)

πŸ’– std::num_get< _CharT, _InIter > πŸ’–

okay so bestie, we're in the Library Functions Manual, section 3 (that's the C++ library section, iykyk), and today's main character is std::num_get< _CharT, _InIter >. pull up a chair, grab a strawberry πŸ“, this one's a whole vibe.


πŸŽ€ NAME πŸŽ€

std::num_get< _CharT, _InIter > β€” the Primary class template num_get.


✨ SYNOPSIS ✨

#include <locale>

Also, just so we're clear: it inherits std::locale::facet. πŸ‘‘

🌸 Public Types

These are the Public typedefs, two of them, both iconic:

  • typedef _CharT char_type β€” Public typedefs.
  • typedef _InIter iter_type β€” Public typedefs.

🌈 Public Member Functions

  • num_get (size_t __refs=0) β€” Constructor performs initialization.
  • template<typename _ValueT> _InIter _M_extract_int (_InIter __beg, _InIter __end, ios_base &__io, ios_base::iostate &__err, _ValueT &__v) const
  • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, bool &__v) const β€” Numeric parsing.
  • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, void *&__v) const β€” Numeric parsing.
    • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, long &__v) const β€” Numeric parsing.
    • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned short &__v) const β€” Numeric parsing.
    • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned int &__v) const β€” Numeric parsing.
    • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned long &__v) const β€” Numeric parsing.
    • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, long long &__v) const β€” Numeric parsing.
    • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned long long &__v) const β€” Numeric parsing.
    • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, float &__v) const β€” Numeric parsing.
    • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, double &__v) const β€” Numeric parsing.
    • iter_type get (iter_type __in, iter_type __end, ios_base &__io, ios_base::iostate &__err, long double &__v) const β€” Numeric parsing.

πŸ’œ Static Public Attributes

  • static locale::id id β€” Numpunct facet id.

πŸ¦‹ Protected Member Functions

  • virtual ~num_get () β€” Destructor.
  • iter_type _M_extract_float (iter_type, iter_type, ios_base &, ios_base::iostate &, string &) const
  • template<typename _ValueT> iter_type _M_extract_int (iter_type, iter_type, ios_base &, ios_base::iostate &, _ValueT &) const
  • template<typename _CharT2> __gnu_cxx::__enable_if< __is_char< _CharT2 >::__value, int >::__type _M_find (const _CharT2 *, size_t __len, _CharT2 __c) const
  • template<typename _CharT2> __gnu_cxx::__enable_if<!__is_char< _CharT2 >::__value, int >::__type _M_find (const _CharT2 *__zero, size_t __len, _CharT2 __c) const
    • virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &, bool &) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, long &__v) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned short &__v) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned int &__v) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned long &__v) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, long long &__v) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, unsigned long long &__v) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &, float &) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &, double &) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &, long double &) const β€” Numeric parsing.
    • virtual iter_type do_get (iter_type, iter_type, ios_base &, ios_base::iostate &, void *&) const β€” Numeric parsing.

🧚 Static Protected Member Functions

  • static __c_locale _S_clone_c_locale (__c_locale &__cloc) throw ()
  • static void _S_create_c_locale (__c_locale &__cloc, const char *__s, __c_locale __old=0)
  • static void _S_destroy_c_locale (__c_locale &__cloc)
  • static __c_locale _S_get_c_locale ()
  • static const char * _S_get_c_name () throw ()
  • static __c_locale _S_lc_ctype_c_locale (__c_locale __cloc, const char *__s)

🌟 DETAILED DESCRIPTION 🌟

template<typename _CharT, typename _InIter>
class std::num_get< _CharT, _InIter >

Primary class template num_get.

So like, what is this thing? This facet encapsulates the code to parse and return a number from a string. That's the whole job. It's the little engine that runs when you do the istream numeric extraction operators β€” you know, when you casually do cin >> my_number and it just... works. that's her. she did that. πŸ’…

And here's the tea: the num_get template uses protected virtual functions to actually produce the results. The public accessors don't do the work themselves β€” they just forward the call to the virtual functions. And those virtual functions are hooks for developers to implement the behavior they require from the num_get facet. so if you wanna customize the whole numeric-parsing situation, the hooks are right there waiting for you. no cap. 🫢


πŸŽ€ MEMBER TYPEDEF DOCUMENTATION πŸŽ€

template<typename _CharT, typename _InIter> typedef _CharT std::num_get< _CharT, _InIter >::char_type

Public typedefs.

template<typename _CharT, typename _InIter> typedef _InIter std::num_get< _CharT, _InIter >::iter_type

Public typedefs.


✨ CONSTRUCTOR & DESTRUCTOR DOCUMENTATION ✨

template<typename _CharT, typename _InIter> std::num_get< _CharT, _InIter >::num_get (size_t __refs = 0) [inline], [explicit]

Constructor performs initialization. This is the constructor provided by the standard.

Parameters

  • __refs β€” Passed to the base facet class.

template<typename _CharT, typename _InIter> virtual std::num_get< _CharT, _InIter >::~num_get () [inline], [protected], [virtual]

Destructor. that's it, that's the whole note. she's protected, she's virtual, she's inline. leave her be. 😌


🌈 MEMBER FUNCTION DOCUMENTATION 🌈

heads up bestie, all of these do_get overloads share the exact same little description block, so I'm giving you the full tea on each one, no skimping. 🫢

template<typename _CharT, typename _InIter> virtual iter_type std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, long & __v) const [inline], [protected], [virtual]

Numeric parsing. Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also

get() for more details.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading.

template<typename _CharT, typename _InIter> virtual iter_type std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, long long & __v) const [inline], [protected], [virtual]

Numeric parsing. Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also

get() for more details.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading.

template<typename _CharT, typename _InIter> virtual iter_type std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned int & __v) const [inline], [protected], [virtual]

Numeric parsing. Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also

get() for more details.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading.

template<typename _CharT, typename _InIter> virtual iter_type std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned long & __v) const [inline], [protected], [virtual]

Numeric parsing. Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also

get() for more details.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading.

template<typename _CharT, typename _InIter> virtual iter_type std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned long long & __v) const [inline], [protected], [virtual]

Numeric parsing. Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also

get() for more details.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading.

template<typename _CharT, typename _InIter> virtual iter_type std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned short & __v) const [inline], [protected], [virtual]

Numeric parsing. Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also

get() for more details.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading.

template<typename _CharT, typename _InIter> _InIter std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, bool & __v) const [protected], [virtual]

Numeric parsing. Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

See also

get() for more details.

and that's where part 1 wraps up, bestie β€” no sign-off yet, we're only getting started ✨

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. ✨

References

std::ios_base::_M_getloc(), std::ios_base::boolalpha, std::ios_base::eofbit, std::ios_base::failbit, std::ios_base::flags(), and std::ios_base::goodbit.

Referenced by

  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
  • std::num_get< _CharT, istreambuf_iterator< _CharT, _Traits > >::get()
bestie yes it's the same line eleven times 😭 that is genuinely what the docs say, they're just Like That, and we do not edit the source. eleven. times. πŸ’€

do_get β€” the double one πŸŽ€

template<typename _CharT, typename _InIter> _InIter std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, double & __v) const [protected],  [virtual]

Numeric parsing. It takes your input stream and parses it straight into the variable v. This one is a hook β€” a little trapdoor that derived classes can use to change the value that gets returned. customisation slay ✨

See also

get() for more details β€” go peek at it, it's got the full lore.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. πŸ’…

References

std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::ios_base::eofbit, and std::basic_string< _CharT, _Traits, _Alloc >::reserve().


do_get β€” the float one πŸ¦‹

template<typename _CharT, typename _InIter> _InIter std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, float & __v) const [protected],  [virtual]

Numeric parsing. Parses the input stream into the variable v. Same deal as the others β€” it's a hook so derived classes can swap out what comes back. no cap, same energy, different type 🫢

See also

get() for more details.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. ⭐

References

std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::ios_base::eofbit, and std::basic_string< _CharT, _Traits, _Alloc >::reserve().


do_get β€” the long double one πŸ’œ

template<typename _CharT, typename _InIter> _InIter std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, long double & __v) const [protected],  [virtual]

Numeric parsing. Parses the input stream into the variable v. Hook for derived classes to change the returned value, yes bestie, exactly like the last two. the template really said copy-paste-and-thrive πŸ’…

See also

get() for more details.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. 🌸

References

std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::ios_base::eofbit, and std::basic_string< _CharT, _Traits, _Alloc >::reserve().


do_get β€” the void *& one πŸ”₯

template<typename _CharT, typename _InIter> _InIter std::num_get< _CharT, _InIter >::do_get (iter_type __beg, iter_type __end, ios_base & __io, ios_base::iostate & __err, void *& __v) const [protected],  [virtual]

Numeric parsing. Parses the input stream into the variable v. Hook for derived classes to change the value returned. a whole pointer, getting parsed, in this economy 😭 iconic honestly

See also

get() for more details.

Parameters

  • __beg β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. πŸ“

References

std::ios_base::basefield, std::ios_base::flags(), and std::ios_base::hex.


get β€” the bool & one πŸ‘‘

template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, bool & __v) const [inline]

Numeric parsing. Parses the input stream into the bool v. How? By calling num_get::do_get(). delegation, we love to see it ✨

Here's the actual tea, bestie:

  • If ios_base::boolalpha is set, it tries to read ctype<CharT>::truename() or ctype<CharT>::falsename(). If it works, it sets v to true or false. If reading the string fails, it sets err to ios_base::failbit. And if the stream gets emptied, it sets err to ios_base::eofbit.
  • If ios_base::boolalpha is not set, it proceeds like it's reading a long β€” except: if the value is 1 it sets v to true, if the value is 0 it sets v to false, and otherwise it sets err to ios_base::failbit. not 0, not 1? failbit. no in-between, periodt.

Parameters

  • __in β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. πŸ¦‹

Referenced by

std::basic_istream< _CharT, _Traits >::operator>>().


get β€” the double & one 🌈

template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, double & __v) const [inline]

Numeric parsing. Parses the input stream into the integral variable v. And it does it by calling num_get::do_get(). (yes, the docs say "integral" here even though it's a double. we report, we don't fix πŸ’€)

The input characters are parsed like the scanf g specifier. The matching type length modifier is also used too.

The decimal point character used is numpunct::decimal_point(). Digit grouping gets interpreted according to numpunct::grouping() and numpunct::thousands_sep(). And if the pattern of digit groups isn't consistent, it sets err to ios_base::failbit. inconsistent grouping = straight to failbit jail 🚨

If parsing the string gives you a valid value for v, then v is set. Otherwise it sets err to ios_base::failbit and leaves v unaltered β€” untouched, unbothered, exactly as it was. πŸ™ˆ If the stream is emptied, it sets err to ios_base::eofbit.

Parameters

  • __in β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. πŸ’–


get β€” the float & one 🧚

template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, float & __v) const [inline]

Numeric parsing. Parses the input stream into the integral variable v, by calling num_get::do_get(). same "integral" wording, same chaos, we move πŸ’…

The input characters are parsed like the scanf g specifier, and the matching type length modifier is also used.

Decimal point character = numpunct::decimal_point(). Digit grouping follows numpunct::grouping() and numpunct::thousands_sep(). If the digit-group pattern isn't consistent β†’ err gets ios_base::failbit.

Valid value for v? Then v is set. Not valid? err gets ios_base::failbit and v stays unaltered. Stream emptied? err gets ios_base::eofbit. ✨

Parameters

  • __in β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. πŸŽ€


get β€” the long & one πŸ”₯

template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, long & __v) const [inline]

Numeric parsing. Parses the input stream into the integral variable v. Calls num_get::do_get() to do it.

Parsing is affected by the flag settings in io. πŸ‘€

The basic parse is affected by the value of io.flags() & ios_base::basefield:

  • Equal to ios_base::oct β†’ parses like the scanf o specifier.
  • Else if equal to ios_base::hex β†’ parses like the X specifier.
  • Else if basefield is equal to 0 β†’ parses like the i specifier.
  • Otherwise β†’ parses like d for signed and u for unsigned types.

The matching type length modifier is also used.

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit. consistent grouping or failbit, there is no third option bestie

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied. 🌸

Parameters

  • __in β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. ⭐


get β€” the long double & one πŸ’œ

template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, long double & __v) const [inline]

Numeric parsing. Parses the input stream into the integral variable v, by calling num_get::do_get().

Input characters are parsed like the scanf g specifier. The matching type length modifier is also used.

Decimal point character used is numpunct::decimal_point(). Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). Inconsistent digit-group pattern β†’ err gets ios_base::failbit. 😀

Valid value for v β†’ v is set. Otherwise err gets ios_base::failbit and v is left unaltered. Stream emptied β†’ err gets ios_base::eofbit. 🫢

Parameters

  • __in β€” Start of input stream.
  • __end β€” End of input stream.
  • __io β€” Source of locale and flags.
  • __err β€” Error flags to set.
  • __v β€” Value to format and insert.

Returns

Iterator after reading. 🌈


get β€” the long long & one 🧚

template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, long long & __v) const [inline]

Numeric parsing. Parses the input stream into the integral variable v. Yep β€” by calling num_get::do_get().

Parsing is affected by the flag settings in io.

The basic parse is affected by the value of io.flags() & ios_base::basefield:

  • Equal to ios_base::oct β†’ parses like the scanf o specifier.
  • Else if equal to ios_base::hex β†’ parses like the X specifier.
  • Else if basefield is equal to 0 β†’ parses like the i specifier.
  • Otherwise β†’ parses like d for signed and u for unsigned types.

The matching type length modifier is also used. πŸ’…

and that's where this part of the page cuts off β€” more coming, don't go anywhere bestie 🫢

Digit grouping</p> is read through numpunct::grouping() and numpunct::thousands_sep(), okay? And if the pattern of digit groups isn't consistent β€” like, the groups don't follow the vibe β€” it sets err to ios_base::failbit. 🫠

If parsing the string yields a valid value for v, then v is set. Otherwise it sets err to ios_base::failbit and leaves v unaltered, untouched, not a single change, bestie. And it sets err to ios_base::eofbit if the stream is emptied. That's the whole drama. πŸ’…

Parameters

  • __in β€” start of input stream, the beginning of the journey ✨
  • __end β€” end of input stream, the finish line 🏁
  • __io β€” source of locale and flags, the whole setup
  • __err β€” error flags to set, where the bad news goes
  • __v β€” value to format and insert

Returns

Iterator after reading. That's it, that's the return. 🌸


template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned long & __v) const [inline]

Numeric parsing, round two, and this time it's unsigned long. It parses the input stream into the integral variable v, and the way it does that is by calling num_get::do_get(). Lowkey just delegating, and honestly? Valid. πŸ‘‘

The parsing is affected by the flag settings in io.

The basic parse is affected by the value of io.flags() & ios_base::basefield. So:

  • If it's equal to ios_base::oct, it parses like the scanf o specifier.
  • Else if it's equal to ios_base::hex, it parses like the X specifier.
  • Else if basefield is equal to 0, it parses like the i specifier.
  • Otherwise, it parses like d for signed types and u for unsigned types.

And the matching type length modifier is also used. No skipping steps. ✨

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, it sets err to ios_base::failbit.

If parsing the string yields a valid value for v, v is set. Otherwise, err gets ios_base::failbit and v is left unaltered. And if the stream gets emptied, err is set to ios_base::eofbit. πŸ¦‹

Parameters

  • __in β€” start of input stream
  • __end β€” end of input stream
  • __io β€” source of locale and flags
  • __err β€” error flags to set
  • __v β€” value to format and insert

Returns

Iterator after reading. πŸŽ€


template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned long long & __v) const [inline]

Numeric parsing again, now for unsigned long long. Parses the input stream into the integral variable v, by calling num_get::do_get(). Same energy, bigger number. πŸ”₯

Parsing is affected by the flag settings in io.

The basic parse is affected by the value of io.flags() & ios_base::basefield:

  • Equal to ios_base::oct? Parses like the scanf o specifier.
  • Else equal to ios_base::hex? Parses like the X specifier.
  • Else basefield equal to 0? Parses like the i specifier.
  • Otherwise? Parses like d for signed and u for unsigned types.

Plus the matching type length modifier is also used. πŸ’«

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for v, v is set. Otherwise sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied. πŸ™ˆ

Parameters

  • __in β€” start of input stream
  • __end β€” end of input stream
  • __io β€” source of locale and flags
  • __err β€” error flags to set
  • __v β€” value to format and insert

Returns

Iterator after reading. 🌈


template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, unsigned short & __v) const [inline]

Numeric parsing, but smol this time β€” unsigned short. Parses the input stream into the integral variable v by calling num_get::do_get(). Same brain, tinier box. πŸ“

Parsing is affected by the flag settings in io.

The basic parse is affected by the value of io.flags() & ios_base::basefield:

  • If equal to ios_base::oct, parses like the scanf o specifier.
  • Else if equal to ios_base::hex, parses like the X specifier.
  • Else if basefield equal to 0, parses like the i specifier.
  • Otherwise, parses like d for signed and u for unsigned types.

The matching type length modifier is also used, obviously. πŸ’…

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied. 🌸

Parameters

  • __in β€” start of input stream
  • __end β€” end of input stream
  • __io β€” source of locale and flags
  • __err β€” error flags to set
  • __v β€” value to format and insert

Returns

Iterator after reading. 🧚


template<typename _CharT, typename _InIter> iter_type std::num_get< _CharT, _InIter >::get (iter_type __in, iter_type __end, ios_base & __io, ios_base::iostate & __err, void *& __v) const [inline]

Okay bestie, this one's the pointer one, and it's a whole different flavor. Numeric parsing β€” it parses the input stream into the pointer variable v, and yes, it does so by calling num_get::do_get(). πŸ‘‘

The input characters are parsed like the scanf p specifier. Periodt.

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, sets err to ios_base::failbit.

⚠️ Real talk: the digit grouping effect for pointers is a bit ambiguous in the standard and shouldn't be relied on. See DR 344. Do not build your whole life on it. 😭

If parsing the string yields a valid value for v, v is set. Otherwise, sets err to ios_base::failbit and leaves v unaltered. Sets err to ios_base::eofbit if the stream is emptied. πŸ’œ

Parameters

  • __in β€” start of input stream
  • __end β€” end of input stream
  • __io β€” source of locale and flags
  • __err β€” error flags to set
  • __v β€” value to format and insert

Returns

Iterator after reading. ✨


πŸŽ€ Member Data Documentation πŸŽ€

template<typename _CharT, typename _InIter> locale::id std::num_get< _CharT, _InIter >::id [static]

Numpunct facet id. That's the whole thing, she's short and she knows it. πŸ‘‘


🌟 Author 🌟

Generated automatically by Doxygen for libstdc++ from the source code. Not a human, not a vibe curator, just Doxygen doing its lil thing. 🫢


And that's a wrap on this one, bestie! This whole page comes to you from the libstdc++ manual β€” that's the source and the version, right there in the footer, along with the page name std::num_g..., _InIter >(3). So if you ever need to cite it: libstdc++, std::num_g..., _InIter >(3). Slay, go parse something. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • centos-stream 10: gcc-toolset-16-libstdc++-docs 16.2.1-1.3.el10 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms