STD::MONEYPUNCT_BYNAME(3)

πŸŽ€ std::moneypunct_byname< _CharT, _Intl > β€” Library Functions Manual (section 3) πŸŽ€

okay so bestie, welcome to the library functions manual, section 3. This is the iconic page for the class moneypunct_byname β€” the by-name flavour of your fave money-formatting facet. Buckle up, she's long, and this is part 1 of 2. πŸ’…


✨ NAME ✨

std::moneypunct_byname< _CharT, _Intl > β€” class moneypunct_byname [22.2.6.4].


🌸 SYNOPSIS 🌸

#include <locale>

Inherits std::moneypunct< _CharT, _Intl >. πŸ’–

πŸ‘‘ Public Types

  • enum { _S_minus, _S_zero, _S_end }
  • typedef __moneypunct_cache< _CharT, _Intl > __cache_type
  • typedef _CharT char_type
  • enum part { none, space, symbol, sign, value }
  • typedef basic_string< _CharT > string_type

πŸ¦‹ Public Member Functions

  • moneypunct_byname (const char *__s, size_t __refs=0) β€” construct her from a C string name.
  • moneypunct_byname (const string &__s, size_t __refs=0) β€” same energy, but with a string.
  • string_type curr_symbol () const β€” Return currency symbol string.
  • char_type decimal_point () const β€” Return decimal point character.
  • int frac_digits () const β€” Return number of digits in fraction.
  • string grouping () const β€” Return grouping specification.
  • string_type negative_sign () const β€” Return negative sign string.
  • string_type positive_sign () const β€” Return positive sign string.
  • char_type thousands_sep () const β€” Return thousands separator character.
  • pattern pos_format () const β€” Return pattern for money values.
  • pattern neg_format () const β€” Return pattern for money values.

πŸ’œ Static Public Member Functions

  • static pattern _S_construct_pattern (char __precedes, char __space, char __posn) throw ()

🌈 Static Public Attributes

  • static const char * _S_atoms
  • static const pattern _S_default_pattern
  • static locale::id id β€” Numpunct facet id.
  • static const bool intl

🧚 Protected Member Functions

  • void _M_initialize_moneypunct (__c_locale __cloc=0, const char *__name=0)
  • void _M_initialize_moneypunct (__c_locale, const char *)
  • void _M_initialize_moneypunct (__c_locale, const char *)
  • void _M_initialize_moneypunct (__c_locale, const char *)
  • void _M_initialize_moneypunct (__c_locale, const char *)
  • virtual string_type do_curr_symbol () const β€” Return currency symbol string.
  • virtual char_type do_decimal_point () const β€” Return decimal point character.
  • virtual int do_frac_digits () const β€” Return number of digits in fraction.
  • virtual string do_grouping () const β€” Return grouping specification.
  • virtual pattern do_neg_format () const β€” Return pattern for money values.
  • virtual string_type do_negative_sign () const β€” Return negative sign string.
  • virtual pattern do_pos_format () const β€” Return pattern for money values.
  • virtual string_type do_positive_sign () const β€” Return positive sign string.
  • virtual char_type do_thousands_sep () const β€” Return thousands separator character.

πŸ’« 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, bool _Intl>
  class std::moneypunct_byname< _CharT, _Intl >

"class moneypunct_byname [22.2.6.4]." β€” that's literally the whole vibe. periodt. πŸ’…


πŸ’– Member Function Documentation πŸ’–

template<typename _CharT, bool _Intl> string_type std::moneypunct< _CharT, _Intl >::curr_symbol () const [inline], [inherited]

Return currency symbol string. She hands you back a string_type to use as a currency symbol, and she does it by returning moneypunct<char_type>::do_curr_symbol(). ✨

Returns: string_type representing a currency symbol.

References do_curr_symbol().

template<typename _CharT, bool _Intl> char_type std::moneypunct< _CharT, _Intl >::decimal_point () const [inline], [inherited]

Return decimal point character. Gives you a char_type to use as a decimal point, and does it by returning moneypunct<char_type>::do_decimal_point(). πŸ“

Returns: char_type representing a decimal point.

References do_decimal_point().

template<typename _CharT, bool _Intl> virtual string_type std::moneypunct< _CharT, _Intl >::do_curr_symbol () const [inline], [protected], [virtual], [inherited]

Return currency symbol string. Returns a string_type to use as a currency symbol. This one is a hook β€” derived classes can override it to change the value that gets returned. πŸŽ€

See also: curr_symbol() for details.

Returns: string_type representing a currency symbol.

Referenced by curr_symbol().

template<typename _CharT, bool _Intl> virtual char_type std::moneypunct< _CharT, _Intl >::do_decimal_point () const [inline], [protected], [virtual], [inherited]

Return decimal point character. Returns a char_type to use as a decimal point. Hook for derived classes to change the returned value. πŸ’œ

Returns: char_type representing a decimal point.

Referenced by decimal_point().

template<typename _CharT, bool _Intl> virtual int std::moneypunct< _CharT, _Intl >::do_frac_digits () const [inline], [protected], [virtual], [inherited]

Return number of digits in fraction. Returns the exact number of digits that make up the fractional part of a money amount. Another hook β€” derived classes, this one's for you. πŸ¦‹

See also: frac_digits() for details.

Returns: Number of digits in amount fraction.

Referenced by frac_digits().

template<typename _CharT, bool _Intl> virtual string std::moneypunct< _CharT, _Intl >::do_grouping () const [inline], [protected], [virtual], [inherited]

Return grouping specification. Returns a string representing groupings for the integer part of a number. Hook for derived classes to change the returned value. 🌸

See also: grouping() for details.

Returns: String representing grouping specification.

Referenced by grouping().

template<typename _CharT, bool _Intl> virtual pattern std::moneypunct< _CharT, _Intl >::do_neg_format () const [inline], [protected], [virtual], [inherited]

Return pattern for money values. Returns a pattern describing the formatting of a negative valued money amount. Hook for derived classes to change the returned value. 😭

See also: neg_format() for details.

Returns: Pattern for money values.

Referenced by neg_format().

template<typename _CharT, bool _Intl> virtual string_type std::moneypunct< _CharT, _Intl >::do_negative_sign () const [inline], [protected], [virtual], [inherited]

Return negative sign string. Returns a string_type to use as a sign for negative amounts. Hook for derived classes to change the returned value. πŸ’€

See also: negative_sign() for details.

Returns: string_type representing a negative sign.

Referenced by negative_sign().

template<typename _CharT, bool _Intl> virtual pattern std::moneypunct< _CharT, _Intl >::do_pos_format () const [inline], [protected], [virtual], [inherited]

Return pattern for money values. Returns a pattern describing the formatting of a positive valued money amount. Hook for derived classes to change the returned value. 🌈

See also: pos_format() for details.

Returns: Pattern for money values.

Referenced by pos_format().

template<typename _CharT, bool _Intl> virtual string_type std::moneypunct< _CharT, _Intl >::do_positive_sign () const [inline], [protected], [virtual], [inherited]

Return positive sign string. Returns a string_type to use as a sign for positive amounts. Hook for derived classes to change the returned value. 🫢

See also: positive_sign() for details.

Returns: string_type representing a positive sign.

Referenced by positive_sign().

template<typename _CharT, bool _Intl> virtual char_type std::moneypunct< _CharT, _Intl >::do_thousands_sep () const [inline], [protected], [virtual], [inherited]

Return thousands separator character. Returns a char_type to use as a thousands separator. Hook for derived classes to change the returned value. ⭐

Returns: char_type representing a thousands separator.

Referenced by thousands_sep().

template<typename _CharT, bool _Intl> int std::moneypunct< _CharT, _Intl >::frac_digits () const [inline], [inherited]

Return number of digits in fraction. Returns the exact number of digits that make up the fractional part of a money amount, by returning moneypunct<char_type>::do_frac_digits(). πŸ’–

The fractional part of a money amount is optional. But if it is present, there must be frac_digits() digits. no cap.

Returns: Number of digits in amount fraction.

References do_frac_digits().

template<typename _CharT, bool _Intl> string std::moneypunct< _CharT, _Intl >::grouping () const [inline], [inherited]

Return grouping specification. Returns a string representing groupings for the integer part of an amount. Groupings tell you where thousands separators should be inserted. ✨

Each char in the returned string is interpreted as an integer, not as a character. Those numbers represent the number of digits in a group. The first char in the string is the number of digits in the least significant group. If a char is negative, that means an unlimited number of digits for that group. And if more chars from the string are needed to group a number, the last char just gets used over and over again. πŸ”

For example, if grouping() returns \003\002 and it's applied to the number 123456789, that corresponds to 12,34,56,789. Heads up though: if the string was 32, that would put more than 50 digits into the least significant group, assuming the character set is ASCII. 😳

The string is returned by calling moneypunct<char_type>::do_grouping().

Returns: string representing grouping specification.

References do_grouping().

template<typename _CharT, bool _Intl> pattern std::moneypunct< _CharT, _Intl >::neg_format () const [inline], [inherited]

Return pattern for money values. Returns a pattern describing the formatting of a positive or negative valued money amount. It does this by returning moneypunct<char_type>::do_pos_format() or moneypunct<char_type>::do_neg_format(). πŸŽ€

The pattern has 4 fields describing the ordering of symbol, sign, value, and none or space. There must be one of each in the pattern. The none and space enums may not appear in the first field, and space may not appear in the final field.

lowkey important, bestie: those field-ordering rules are not a suggestion. don't put none or space first, and don't put space last. fr fr. πŸ’…

okay that's the vibe so far and there's more coming β€” part 2 is right behind this one πŸ‘‘

okay so continuing the pattern tea β˜•: the parts of a money string must appear in the order indicated by the fields of the pattern. The symbol field indicates that the value of curr_symbol() may be present. The sign field indicates that the value of positive_sign() or negative_sign() must be present. The value field indicates that the absolute value of the money amount is present. none indicates 0 or more whitespace characters, except at the end, where it permits no whitespace. space indicates that 1 or more whitespace characters must be present. πŸ’… periodt

For example, for the US locale and pos_format() pattern {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() == '+', and value 10.01, and options set to force the symbol, the corresponding string is $+10.01. iconic ✨

Returns: Pattern for money values.

References: do_neg_format().


πŸ’– negative_sign()

template<typename _CharT, bool _Intl> string_type std::moneypunct< _CharT, _Intl >::negative_sign () const [inline],  [inherited]

Return negative sign string. This function returns a string_type to use as a sign for negative amounts. It does so by returning returning moneypunct<char_type>::do_negative_sign(). (yes bestie, it literally says β€œreturning returning” β€” we keep it exactly 😭)

If the return value contains more than one character, the first character appears in the position indicated by neg_format() and the remainder appear at the end of the formatted string.

Returns: string_type representing a negative sign.

References: do_negative_sign().


🌸 pos_format()

template<typename _CharT, bool _Intl> pattern std::moneypunct< _CharT, _Intl >::pos_format () const [inline],  [inherited]

Return pattern for money values. This function returns a pattern describing the formatting of a positive or negative valued money amount. It does so by returning returning moneypunct<char_type>::do_pos_format() or moneypunct<char_type>::do_neg_format().

The pattern has 4 fields describing the ordering of symbol, sign, value, and none or space. There must be one of each in the pattern. The none and space enums may not appear in the first field and space may not appear in the final field. 🚫 no exceptions

The parts of a money string must appear in the order indicated by the fields of the pattern. The symbol field indicates that the value of curr_symbol() may be present. The sign field indicates that the value of positive_sign() or negative_sign() must be present. The value field indicates that the absolute value of the money amount is present. none indicates 0 or more whitespace characters, except at the end, where it permits no whitespace. space indicates that 1 or more whitespace characters must be present.

For example, for the US locale and pos_format() pattern {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() == '+', and value 10.01, and options set to force the symbol, the corresponding string is $+10.01. slay πŸ’…

Returns: Pattern for money values.

References: do_pos_format().


πŸ¦‹ positive_sign()

template<typename _CharT, bool _Intl> string_type std::moneypunct< _CharT, _Intl >::positive_sign () const [inline],  [inherited]

Return positive sign string. This function returns a string_type to use as a sign for positive amounts. It does so by returning returning moneypunct<char_type>::do_positive_sign().

If the return value contains more than one character, the first character appears in the position indicated by pos_format() and the remainder appear at the end of the formatted string.

Returns: string_type representing a positive sign.

References: do_positive_sign().


✨ thousands_sep()

template<typename _CharT, bool _Intl> char_type std::moneypunct< _CharT, _Intl >::thousands_sep () const [inline],  [inherited]

Return thousands separator character. This function returns a char_type to use as a thousands separator. It does so by returning returning moneypunct<char_type>::do_thousands_sep().

Returns: char_type representing a thousands separator.

References: do_thousands_sep().


✨ Member Data Documentation ✨

πŸ’œ id

template<typename _CharT, bool _Intl> locale::id std::moneypunct< _CharT, _Intl >::id [static],  [inherited]

Numpunct facet id. (yes, it says β€œNumpunct” even though this is moneypunct β€” we don’t ask questions, we just report πŸ‘€)


🌸 Author 🌸

Generated automatically by Doxygen for libstdc++ from the source code.


okay that’s the whole page, bestie! the footer says libstdc++ and std::money...rT, _Intl >(3) β€” source/version energy, no date in sight, but it’s giving official manual realness. mwah πŸ’‹πŸ’–

πŸ“¦ 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
  • fedora 44: libstdc++-docs 16.0.1-0.10.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
  • 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