STD::MONEY_GET(3)
πΈ std::money_get< _CharT, _InIter > β Primary class template money_get πΈ
okay bestie, welcome to the Library Functions Manual, section 3 π this one's a whole template class and she's thriving. Sit down, grab a boba, we're parsing money.
β¨ NAME β¨
std::money_get< _CharT, _InIter > β Primary class template money_get. that's it, that's her, she's the main character π
πΈ SYNOPSIS πΈ
#include <locale>
She inherits std::locale::facet. family lineage? iconic. π
π Public Types
Public typedefs, all of them, no crumbs left behind:
typedef _CharT char_typeβ Public typedefs.typedef _InIter iter_typeβ Public typedefs.typedef basic_string< _CharT > string_typeβ Public typedefs.
π¦ Public Member Functions
money_get (size_t __refs=0)β Constructor performs initialization.template<bool _Intl> _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 _InIter _M_extract (iter_type __beg, iter_type __end, ios_base &__io, ios_base::iostate &__err, string &__units) constβ yes that is the whole signature, do not perceive it, just accept it.iter_type get (iter_type __s, iter_type __end, bool __intl, ios_base &__io, ios_base::iostate &__err, long double &__units) constβ Read and parse a monetary value.iter_type get (iter_type __s, iter_type __end, bool __intl, ios_base &__io, ios_base::iostate &__err, string_type &__digits) constβ Read and parse a monetary value.
β Static Public Attributes
static locale::id idβ Numpunct facet id. (yes she says "numpunct" here, it's literally what the original says, we don't question the elders π«Ά)
π Protected Member Functions
virtual ~money_get ()β Destructor.template<bool _Intl> iter_type _M_extract (iter_type __s, iter_type __end, ios_base &__io, ios_base::iostate &__err, string &__digits) constvirtual iter_type do_get (iter_type __s, iter_type __end, bool __intl, ios_base &__io, ios_base::iostate &__err, long double &__units) constβ Read and parse a monetary value.virtual iter_type do_get (iter_type __s, iter_type __end, bool __intl, ios_base &__io, ios_base::iostate &__err, string_type &__digits) constβ Read and parse a monetary value.
π§ 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::money_get< _CharT, _InIter >
Primary class template money_get.
This facet encapsulates the code to parse and return a monetary amount from a string. lowkey a whole vibe, honestly.
The money_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 money_get facet. like, she hands you the mic and says "you do it bestie" π€β¨
π Member Typedef Documentation π
template<typename _CharT, typename _InIter> typedef _CharT std::money_get< _CharT, _InIter >::char_typeβ Public typedefs.template<typename _CharT, typename _InIter> typedef _InIter std::money_get< _CharT, _InIter >::iter_typeβ Public typedefs.template<typename _CharT, typename _InIter> typedef basic_string<_CharT> std::money_get< _CharT, _InIter >::string_typeβ Public typedefs.
π Constructor & Destructor Documentation π
template<typename _CharT, typename _InIter> std::money_get< _CharT, _InIter >::money_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.
References std::locale::facet::facet().
template<typename _CharT, typename _InIter> virtual std::money_get< _CharT, _InIter >::~money_get () [inline], [protected], [virtual]
Destructor. she's protected AND virtual AND inline, triple threat, ate π
π₯ Member Function Documentation π₯
template<typename _CharT, typename _InIter> _InIter std::money_get< _CharT, _InIter >::do_get (iter_type __s, iter_type __end, bool __intl, ios_base & __io, ios_base::iostate & __err, long double & __units) const [protected], [virtual]
Read and parse a monetary value. This function reads and parses characters representing a monetary value. This function is a hook for derived classes to change the value returned.
See also: get() for details.
References std::basic_string< _CharT, _Traits, _Alloc >::c_str().
Referenced by get(), and get().
template<typename _CharT, typename _InIter> _InIter std::money_get< _CharT, _InIter >::do_get (iter_type __s, iter_type __end, bool __intl, ios_base & __io, ios_base::iostate & __err, string_type & __digits) const [protected], [virtual]
Read and parse a monetary value. This function reads and parses characters representing a monetary value. This function is a hook for derived classes to change the value returned.
See also: get() for details.
References std::ios_base::_M_getloc(), std::use_facet(), and std::__ctype_abstract_base< _CharT >::widen().
template<typename _CharT, typename _InIter> iter_type std::money_get< _CharT, _InIter >::get (iter_type __s, iter_type __end, bool __intl, ios_base & __io, ios_base::iostate & __err, long double & __units) const [inline]
Read and parse a monetary value. This function reads characters from __s, interprets them as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and returns the result in units as an integral value moneypunct::frac_digits() * the actual amount. For example, the string $10.01 in a US locale would store 1001 in units.
Any characters not part of a valid money amount are not consumed. (she's polite like that π)
If a money value cannot be parsed from the input stream, setserr=(err|io.failbit). If the stream is consumed before finishing parsing, setserr=(err|io.failbit|io.eofbit).unitsis unchanged if parsing fails.
This function works by returning the result of do_get().
Parameters
__sβ Start of characters to parse.__endβ End of characters to parse.__intlβ Parameter touse_facet<moneypunct<CharT,intl> >.__ioβ Source of facets and io state.__errβ Error field to set if parsing fails.__unitsβ Place to store result of parsing.
Returns: Iterator referencing first character beyond valid money amount.
References do_get().
template<typename _CharT, typename _InIter> iter_type std::money_get< _CharT, _InIter >::get (iter_type __s, iter_type __end, bool __intl, ios_base & __io, ios_base::iostate & __err, string_type & __digits) const [inline]
Read and parse a monetary value. This function reads characters from __s, interprets them as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and returns the result in digits. For example, the string $10.01 in a US locale would store 1001 in digits.
Any characters not part of a valid money amount are not consumed.
If a money value cannot be parsed from the input stream, setserr=(err|io.failbit). If the stream is consumed before finishing parsing, setserr=(err|io.failbit|io.eofbit).
This function works by returning the result of do_get().
Parameters
__sβ Start of characters to parse.__endβ End of characters to parse.__intlβ Parameter touse_facet<moneypunct<CharT,intl> >.__ioβ Source of facets and io state.__errβ Error field to set if parsing fails.__digitsβ Place to store result of parsing.
Returns: Iterator referencing first character beyond valid money amount.
References do_get().
ngl bestie, note the difference: thelong doubleversion saysunitsis unchanged if parsing fails. This one doesn't say that. we report, we do not editorialize π
π Member Data Documentation π
template<typename _CharT, typename _InIter> locale::id std::money_get< _CharT, _InIter >::id [static]
Numpunct facet id. static, iconic, she's not going anywhere π«Ά
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. not a human, a robot, and honestly? she ate.
that's the whole page, fr fr. source/version: libstdc++, manual section 3, and the footer didn't hand us a date so we're saying it's timeless π take care of her, she parses your money πΈβ¨
π¦ 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-15-libstdc++-docs 15.2.1-8.1.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
- 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
- centos-stream 10: libstdc++-docs 14.4.1-4.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 43: libstdc++-docs 15.2.1-2.fc43 Β· 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 43: libstdc++-docs 15.3.1-1.fc43 Β· 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.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