[locale.money.put]

# 28 Text processing library [[text]](./#text)

## 28.3 Localization library [[localization]](localization#locale.money.put)

### 28.3.4 Standard locale categories [[locale.categories]](locale.categories#locale.money.put)

#### 28.3.4.7 The monetary category [[category.monetary]](category.monetary#locale.money.put)

#### 28.3.4.7.3 Class template money_put [locale.money.put]

#### [28.3.4.7.3.1](#general) General [[locale.money.put.general]](locale.money.put.general)

[ð](#lib:money_put)

namespace std {template<class charT, class OutputIterator = ostreambuf_iterator<charT>>class money_put : public locale::facet {public:using char_type = charT; using iter_type = OutputIterator; using string_type = basic_string<charT>; explicit money_put(size_t refs = 0);

 iter_type put(iter_type s, bool intl, ios_base& f,
 char_type fill, long double units) const;
 iter_type put(iter_type s, bool intl, ios_base& f,
 char_type fill, const string_type& digits) const; static locale::id id; protected:~money_put(); virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill, long double units) const; virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill, const string_type& digits) const; };}

#### [28.3.4.7.3.2](#members) Members [[locale.money.put.members]](locale.money.put.members)

[ð](#lib:money_put,put)

`iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
`

[1](#members-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4340)

*Returns*: do_put(s, intl, f, fill, quant)[.](#members-1.sentence-1)

#### [28.3.4.7.3.3](#virtuals) Virtual functions [[locale.money.put.virtuals]](locale.money.put.virtuals)

[ð](#lib:money_put,do_put)

`iter_type do_put(iter_type s, bool intl, ios_base& str,
                 char_type fill, long double units) const;
iter_type do_put(iter_type s, bool intl, ios_base& str,
                 char_type fill, const string_type& digits) const;
`

[1](#virtuals-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4356)

*Effects*: Writes characters to s according to
the format specified by
a moneypunct<charT, Intl> facet reference mp and
the character mapping specified by
a ctype<charT> facet reference ct obtained from the locale returned by str.getloc(),
and str.flags()[.](#virtuals-1.sentence-1)

The argument units is transformed into
a sequence of wide characters as if byct.widen(buf1, buf1 + sprintf(buf1, "%.0Lf", units), buf2) for character buffers buf1 and buf2[.](#virtuals-1.sentence-2)

If the first character in digits or buf2 is equal to ct.widen('-'),
then the pattern used for formatting is the result of mp.neg_format();
otherwise the pattern is the result of mp.pos_format()[.](#virtuals-1.sentence-3)

Digit characters are written,
interspersed with any thousands separators and decimal point
specified by the format,
in the order they appear (after the optional leading minus sign) indigits or buf2[.](#virtuals-1.sentence-4)

In digits,
only the optional leading minus sign and
the immediately subsequent digit characters
(as classified according to ct)
are used;
any trailing characters
(including digits appearing after a non-digit character)
are ignored[.](#virtuals-1.sentence-5)

Calls str.width(0)[.](#virtuals-1.sentence-6)

[2](#virtuals-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4390)

*Returns*: An iterator pointing immediately after the last character produced[.](#virtuals-2.sentence-1)

[3](#virtuals-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L4394)

*Remarks*: The currency symbol is generated
if and only if (str.flags() & str.showbase) is nonzero[.](#virtuals-3.sentence-1)

If the number of characters generated for the specified format
is less than the value returned by str.width() on entry to the function,
then copies of fill are inserted as necessary
to pad to the specified width[.](#virtuals-3.sentence-2)

For the value af equal to (str.flags() & str.adjustfield),
if (af == str.internal) is true,
the fill characters are placed
where none or space appears in the formatting pattern;
otherwise if (af == str.left) is true,
they are placed after the other characters;
otherwise, they are placed before the other characters[.](#virtuals-3.sentence-3)

[*Note [1](#virtuals-note-1)*:

It is possible, with some combinations of format patterns and flag values,
to produce output that cannot be parsed using num_get<>​::​get[.](#virtuals-3.sentence-4)

â *end note*]
