STD::NUM_GET(3cxx)

πŸ’… std::num_get< _CharT, _InIter > β€” the C++ standard library manual, page (3cxx)

okay so bestie, welcome to the glow-up era of this page. It's std::num_get< _CharT, _InIter >, from the (3cxx) section of the manual β€” i.e. the C++ standard library docs β€” and she's the fairy godmother who turns your messy string of characters into an actual number. Periodt. Let's get into it πŸ’–


✨ NAME ✨

std::num_get< _CharT, _InIter > β€” the Primary class template num_get. That's her. That's the whole name. Iconic, lowkey.

✨ SYNOPSIS ✨

#include <locale>

Inherits from std::locale::facet. So she's a facet, she's got the family connections, she belongs to the locale. Main character energy fr fr πŸŽ€

🌸 Public Types

  • typedef _CharT char_type β€” "Public typedefs." aka the character type she's working with, slay.
  • typedef _InIter iter_type β€” "Public typedefs." aka the iterator type she takes in and hands back, obsessed.

🌸 Public Member Functions

  • num_get (size_t __refs=0) β€” Constructor performs initialization. (Yes, that's what it says, and yes, that is genuinely what a constructor does 😭)
  • template<typename _ValueT > _InIter _M_extract_int (_InIter __beg, _InIter __end, ios_base &__io, ios_base::iostate &__err, _ValueT &__v) const β€” the internal integer-extracting bestie.
  • 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.

and then the whole group chat of get overloads, all of them Numeric parsing, all of them carrying:

  • 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.

and then the floaties πŸ’…:

  • 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." She has an id. She's that girl. πŸ¦‹

🌸 Protected Member Functions

  • virtual ~num_get () β€” Destructor. (the sad part 😭)
  • iter_type _M_extract_float (iter_type, iter_type, ios_base &, ios_base::iostate &, string &) const β€” the float-extracting machinery, protected, mysterious, doing her thing.
  • template<typename _ValueT > iter_type _M_extract_int (iter_type, iter_type, ios_base &, ios_base::iostate &, _ValueT &) const β€” same energy, but for ints.

and these two absolute legends with the wildest signatures on the whole page:

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

no cap, I am not explaining that any further than the page does, because the page doesn't. It's giving SFINAE, it's giving __enable_if, it's giving iykyk 🌈

then the do_get girlies, every single one of them virtual, every single one of them Numeric parsing:

  • 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

the C-locale management crew, all static, all protected, all doing the behind-the-scenes work so you don't have to:

  • static __c_locale _S_clone_c_locale (__c_locale &__cloc) throw () β€” clones the C locale.
  • static void _S_create_c_locale (__c_locale &__cloc, const char *__s, __c_locale __old=0) β€” creates a C locale, with __old defaulting to 0.
  • static void _S_destroy_c_locale (__c_locale &__cloc) β€” destroys it. bye bestie πŸ’€
  • static __c_locale _S_get_c_locale () β€” grabs the C locale.
  • static const char * _S_get_c_name () throw () β€” grabs the C locale's name, as a const char *.
  • static __c_locale _S_lc_ctype_c_locale (__c_locale __cloc, const char *__s) β€” the LC_CTYPE-flavored C locale getter.

πŸ¦‹ Detailed Description πŸ¦‹

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

She's the Primary class template num_get.

So what does she actually do? This facet encapsulates the code to parse and return a number from a string. That's it. That's her whole job. It is used by the istream numeric extraction operators β€” so when you do the >> thing and pull a number out of a stream, she's the one behind the curtain making it happen. πŸ’–

The num_get template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the num_get facet.

Translation for the besties: public get() = the front door, protected virtual do_get() = the actual work room, and you're allowed to redecorate the work room because they're hooks. Slay.


πŸŽ€ Member Typedef Documentation πŸŽ€

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

Public typedefs. That's the entire note. She said what she said ✨

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

Public typedefs. Again. Same energy. Same three words. We love a consistent queen πŸ‘‘


πŸ’œ 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. She's explicit, she's inline, she's initialized, she's ready.

Parameters:

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

That's the whole parameter list. One (1) parameter. She's low maintenance 🫢

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

Destructor. Also inline, also protected, also virtual. She leaves the group chat the same way she joined it: with three qualifiers. 😭


πŸ”₯ Member Function Documentation πŸ”₯

okay so here's where it gets repetitive in the most loyal, thorough way possible, because every single do_get overload gets its own writeup and they all say the exact same thing. Respect the grind. πŸ”₯

Every one of these is Numeric parsing. Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned. And every single one says See also get() for more details.

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.

(and yes, the bool one is where this part of the page stops β€” part 2 is coming, don't you dare touch that dial πŸ’–)

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::_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, _InIter >::get(), std::num_get< _CharT, _InIter >::get(), std::num_get< _CharT, _InIter >::get(), std::num_get< _CharT, _InIter >::get(), std::num_get< _CharT, _InIter >::get(), std::num_get< _CharT, _InIter >::get(), std::num_get< _CharT, _InIter >::get(), std::num_get< _CharT, _InIter >::get(), std::num_get< _CharT, _InIter >::get(), std::num_get< _CharT, _InIter >::get(), and std::num_get< _CharT, _InIter >::get().


do_get for double πŸ’…

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. Parses the input stream into the variable v. This function is a hook for derived classes to change the value returned.

bestie, it's literally a hook β€” you override it if you want custom parsing behavior. no cap. πŸͺ

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 for float πŸŽ€

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. 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.

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


do_get for long double 🌸

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. 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.

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


do_get for void* πŸ‘‘

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. 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.

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


get for bool πŸ¦‹

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. It does so by calling num_get::do_get().

If ios_base::boolalpha is set, attempts to read ctype<CharT>::truename() or ctype<CharT>::falsename(). Sets v to true or false if successful. Sets err to ios_base::failbit if reading the string fails. Sets err to ios_base::eofbit if the stream is emptied.

If ios_base::boolalpha is not set, proceeds as with reading a long, except if the value is 1, sets v to true, if the value is 0, sets v to false, and otherwise set err to ios_base::failbit.

so like, boolalpha is the difference between reading "true"/"false" and reading "1"/"0". got it? πŸ’–

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.

References std::num_get< _CharT, _InIter >::do_get().


get for double ✨

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. It does so by calling num_get::do_get().

yes bestie, it says β€œintegral variable” for a double. that’s what the page says. i don’t make the rules 😭

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

The decimal point character used is numpunct::decimal_point(). 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.

References std::num_get< _CharT, _InIter >::do_get().


get for float πŸŽ€

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. It does so by calling num_get::do_get().

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

The decimal point character used is numpunct::decimal_point(). 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.

References std::num_get< _CharT, _InIter >::do_get().


get for long πŸ”₯

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. It does so 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. If equal to ios_base::oct, parses like the scanf o specifier. Else if equal to ios_base::hex, parses like 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.

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.

basefield is the vibe check for octal/hex/decimal. slay. πŸ’…

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.

References std::num_get< _CharT, _InIter >::do_get().


get for long double 🌈

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. It does so by calling num_get::do_get().

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

The decimal point character used is numpunct::decimal_point(). 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.

References std::num_get< _CharT, _InIter >::do_get().


get for long long ⭐

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. It does so 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. If equal to ios_base::oct, parses like the scanf o specifier. Else if equal to ios_base::hex, parses like 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.

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.

References std::num_get< _CharT, _InIter >::do_get().

...and if the parse lands you a valid value for v, bestie, v gets set. If not? err gets set to ios_base::failbit and v stays exactly as it was β€” untouched, unbothered, main character energy πŸ’…. Oh and if the stream gets emptied out, err gets ios_base::eofbit. That's the whole vibe check.

  • __in β€” start of the input stream 🎬
  • __end β€” end of the input stream 🏁
  • __io β€” the source of the locale and the flags ✨
  • __err β€” the error flags that get set 🚩
  • __v β€” the value to format and insert 🫢

Returns: the iterator after reading. πŸ‘‘

References: std::num_get< _CharT, _InIter >::do_get().


🌸 get β€” unsigned int & __v

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 int & __v) const [inline]

Okay so this one is numeric parsing, and what it does is parse the input stream into the integral variable v β€” by calling num_get::do_get(), the way it always does. πŸŽ€

The parsing is affected by the flag settings in io. Yep, all of it.

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

  • if that equals ios_base::oct, it parses like the scanf o specifier
  • else if it equals ios_base::hex, it parses like the X specifier
  • else if basefield equals 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, obvs. ✨

Digit grouping gets interpreted according to numpunct::grouping() and numpunct::thousands_sep(). And listen β€” if the pattern of digit groups isn't consistent, it sets err to ios_base::failbit. So don't be out here grouping digits all willy-nilly, it's not the vibe. 😭

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. And it sets err to ios_base::eofbit if the stream is emptied.

  • __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. πŸ‘‘

References: std::num_get< _CharT, _InIter >::do_get().


πŸ¦‹ get β€” unsigned long & __v

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]

Same iconic setup, different type: numeric parsing, and it parses the input stream into the integral variable v via a call to num_get::do_get(). 🫢

Parsing is affected by the flag settings in io. Always.

The basic parse depends on 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 if 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 used too. Not optional, bestie.

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, err gets ios_base::failbit. Consistency is literally the whole thing. πŸ’…

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

  • __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. πŸ‘‘

References: std::num_get< _CharT, _InIter >::do_get().


πŸ’œ get β€” unsigned long long & __v

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]

The long long girlie of the family 🧚 β€” numeric parsing, parses the input stream into the integral variable v, does it by calling num_get::do_get().

Parsing is affected by the flag settings in io. Yes babe, again.

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

  • ios_base::oct β†’ parses like the scanf o specifier
  • ios_base::hex β†’ parses like the X specifier
  • 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, periodt.

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If that pattern of digit groups isn't consistent β†’ err gets ios_base::failbit. No cap.

If parsing yields a valid value for v, v is set. Otherwise err gets ios_base::failbit and v is left unaltered. If the stream is emptied, err gets ios_base::eofbit.

  • __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. πŸ‘‘

References: std::num_get< _CharT, _InIter >::do_get().


πŸ“ get β€” unsigned short & __v

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]

Tiny but mighty πŸŽ€ β€” numeric parsing, parses the input stream into the integral variable v, 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 equal to 0 β†’ parses like the i specifier
  • otherwise β†’ parses like d for signed and u for unsigned types

And don't forget the matching type length modifier, it's used too. ✨

Digit grouping is interpreted according to numpunct::grouping() and numpunct::thousands_sep(). If the pattern of digit groups isn't consistent, err gets set to ios_base::failbit. That's the rule, iykyk.

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

  • __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. πŸ‘‘

References: std::num_get< _CharT, _InIter >::do_get().


πŸ”₯ get β€” void *& __v

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]

The pointer one!! πŸ‘‘ Numeric parsing β€” it parses the input stream into the pointer variable v, and yes, it does that by calling num_get::do_get().

The input characters are parsed like the scanf p specifier. That's the whole mood here.

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.

⚠️ Okay heads up bestie β€” note that the digit grouping effect for pointers is a bit ambiguous in the standard and shouldn't be relied on. See DR 344. Like, it's giving "undefined behaviour adjacent", so don't build your whole app on it, k? πŸ’€

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

  • __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. πŸ‘‘

References: std::num_get< _CharT, _InIter >::do_get().


🧚 MEMBER DATA DOCUMENTATION 🧚

⭐ id

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

Numpunct facet id. That's it, that's the whole description β€” short and iconic, we love a concise queen. πŸ’…


🌈 AUTHOR 🌈

Generated automatically by Doxygen for libstdc++ from the source code. Not me hand-typing it with tears in my eyes β€” a robot did it, slay. πŸ€–βœ¨


And that's the page, bestie!! 🫢 Go forth and parse responsibly. This little beauty came to you from libstdc++ (that's the source/version flex, and that std::num_get< _CharT, _InIter >(3cxx) up in the corner is the page + section situation) β€” dated whenever the manpage gen last ran. Stay hydrated, group your digits consistently, and never trust a pointer's thousands separator. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from