---
name: "std::money_get"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::money_get"
---

# std::money\_get(3)

Primary class template money\_get.

## NAME

std::money\_get\< \_CharT, \_InIter \> - Primary class template money\_get.

## SYNOPSIS

\#include \<locale\>

Inherits **std::locale::facet**.

### Public Types

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

### 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) const\
 virtual **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.

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.

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

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

If a money value cannot be parsed from the input stream, sets err=(err\|io.failbit). If the stream is consumed before finishing parsing, sets err=(err\|io.failbit\|io.eofbit). *units* is 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 to use\_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, sets err=(err\|io.failbit). If the stream is consumed before finishing parsing, sets err=(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 to use\_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()**.

## Member Data Documentation

### template\<typename \_CharT, typename \_InIter\> locale::id std::money\_get\< \_CharT, \_InIter \>::id \[static\]

Numpunct facet id.

## Author

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