---
name: "std::money_put"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::money_put/3cxx"
---

# std::money\_put(3cxx)

Primary class template money\_put.

## NAME

std::money\_put\< \_CharT, \_OutIter \> - Primary class template money\_put.

## SYNOPSIS

`#include <locale>`

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

### Public Types

**typedef** \_CharT **char\_type**\
 Public typedefs.  **typedef** **\_OutIter** **iter\_type**\
 Public typedefs.  **typedef** **basic\_string**\< \_CharT \> **string\_type**\
 Public typedefs.

### Public Member Functions

**money\_put** (size\_t **\_\_refs**=0)\
 Constructor performs initialization.  template\<bool \_Intl\> **\_OutIter** **\_M\_insert** (**iter\_type** **\_\_s**, **ios\_base** &**\_\_io**, **char\_type** \_\_fill, const **string\_type** &\_\_digits) const\
 **iter\_type** **put** (**iter\_type** **\_\_s**, bool **\_\_intl**, **ios\_base** &**\_\_io**, **char\_type** \_\_fill, const **string\_type** &\_\_digits) const\
 Format and output a monetary value.  **iter\_type** **put** (**iter\_type** **\_\_s**, bool **\_\_intl**, **ios\_base** &**\_\_io**, **char\_type** \_\_fill, long double **\_\_units**) const\
 Format and output a monetary value.

### Static Public Attributes

**static** **locale::id** **id**\
 Numpunct facet id.

### Protected Member Functions

**virtual** **~money\_put** ()\
 Destructor.  template\<bool \_Intl\> **iter\_type** **\_M\_insert** (**iter\_type** **\_\_s**, **ios\_base** &**\_\_io**, **char\_type** \_\_fill, const **string\_type** &\_\_digits) const\
 **virtual** **iter\_type** **do\_put** (**iter\_type** **\_\_s**, bool **\_\_intl**, **ios\_base** &**\_\_io**, **char\_type** \_\_fill, const **string\_type** &\_\_digits) const\
 Format and output a monetary value.  **virtual** **iter\_type** **do\_put** (**iter\_type** **\_\_s**, bool **\_\_intl**, **ios\_base** &**\_\_io**, **char\_type** \_\_fill, long double **\_\_units**) const\
 Format and output 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 \_OutIter\>

class std::money\_put\< \_CharT, \_OutIter \>"Primary class template money\_put.

This facet encapsulates the code to format and output a monetary amount.

The money\_put 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\_put facet.

## Member Typedef Documentation

### template\<typename \_CharT , typename \_OutIter \> typedef \_CharT std::money\_put\< \_CharT, \_OutIter \>::char\_type

Public typedefs.

### template\<typename \_CharT , typename \_OutIter \> typedef \_OutIter std::money\_put\< \_CharT, \_OutIter \>::iter\_type

Public typedefs.

### template\<typename \_CharT , typename \_OutIter \> typedef basic\_string\<\_CharT\> std::money\_put\< \_CharT, \_OutIter \>::string\_type

Public typedefs.

## Constructor & Destructor Documentation

### template\<typename \_CharT , typename \_OutIter \> std::money\_put\< \_CharT, \_OutIter \>::money\_put (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 \_OutIter \> virtual std::money\_put\< \_CharT, \_OutIter \>::~money\_put ()` [inline]`, ` [protected]`, ` [virtual]`

Destructor.

## Member Function Documentation

### template\<typename \_CharT , typename \_OutIter \> \_OutIter std::money\_put\< \_CharT, \_OutIter \>::do\_put (iter\_type \_\_s, bool \_\_intl, ios\_base & \_\_io, char\_type \_\_fill, const string\_type & \_\_digits) const` [protected]`, ` [virtual]`

Format and output a monetary value. This function formats *digits* as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and writes the resulting characters to *\_\_s*. For example, the string `1001` in a US locale would write `$10.01` to *\_\_s*.

This function is a hook for derived classes to change the value returned.

**See also**

put().

**Parameters**

*\_\_s* The stream to write to. \
 *\_\_intl* Parameter to use\_facet\<moneypunct\<CharT,intl\> \>. \
 *\_\_io* Source of facets and io state. \
 *\_\_fill* char\_type to use for padding. \
 *\_\_digits* Place to store result of parsing.

**Returns**

Iterator after writing.

### template\<typename \_CharT , typename \_OutIter \> \_OutIter std::money\_put\< \_CharT, \_OutIter \>::do\_put (iter\_type \_\_s, bool \_\_intl, ios\_base & \_\_io, char\_type \_\_fill, long double \_\_units) const` [protected]`, ` [virtual]`

Format and output a monetary value. This function formats *units* as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and writes the resulting characters to *\_\_s*. For example, the value 1001 in a US locale would write `$10.01` to *\_\_s*.

This function is a hook for derived classes to change the value returned.

**See also**

put().

**Parameters**

*\_\_s* The stream to write to. \
 *\_\_intl* Parameter to use\_facet\<moneypunct\<CharT,intl\> \>. \
 *\_\_io* Source of facets and io state. \
 *\_\_fill* char\_type to use for padding. \
 *\_\_units* Place to store result of parsing.

**Returns**

Iterator after writing.

Referenced by **std::money\_put\< \_CharT, \_OutIter \>::put()**, and **std::money\_put\< \_CharT, \_OutIter \>::put()**.

### template\<typename \_CharT , typename \_OutIter \> iter\_type std::money\_put\< \_CharT, \_OutIter \>::put (iter\_type \_\_s, bool \_\_intl, ios\_base & \_\_io, char\_type \_\_fill, const string\_type & \_\_digits) const` [inline]`

Format and output a monetary value. This function formats *digits* as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and writes the resulting characters to *\_\_s*. For example, the string `1001` in a US locale would write `$10.01` to *\_\_s*.

This function works by returning the result of do\_put().

**Parameters**

*\_\_s* The stream to write to. \
 *\_\_intl* Parameter to use\_facet\<moneypunct\<CharT,intl\> \>. \
 *\_\_io* Source of facets and io state. \
 *\_\_fill* char\_type to use for padding. \
 *\_\_digits* Place to store result of parsing.

**Returns**

Iterator after writing.

References **std::money\_put\< \_CharT, \_OutIter \>::do\_put()**.

### template\<typename \_CharT , typename \_OutIter \> iter\_type std::money\_put\< \_CharT, \_OutIter \>::put (iter\_type \_\_s, bool \_\_intl, ios\_base & \_\_io, char\_type \_\_fill, long double \_\_units) const` [inline]`

Format and output a monetary value. This function formats *units* as a monetary value according to moneypunct and ctype facets retrieved from io.getloc(), and writes the resulting characters to *\_\_s*. For example, the value 1001 in a US locale would write `$10.01` to *\_\_s*.

This function works by returning the result of do\_put().

**Parameters**

*\_\_s* The stream to write to. \
 *\_\_intl* Parameter to use\_facet\<moneypunct\<CharT,intl\> \>. \
 *\_\_io* Source of facets and io state. \
 *\_\_fill* char\_type to use for padding. \
 *\_\_units* Place to store result of parsing.

**Returns**

Iterator after writing.

References **std::money\_put\< \_CharT, \_OutIter \>::do\_put()**.

## Member Data Documentation

### template\<typename \_CharT , typename \_OutIter \> locale::id std::money\_put\< \_CharT, \_OutIter \>::id` [static]`

Numpunct facet id.

## Author

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