virtual iter_type do_put(iter_type next, bool intl,
ios_base& x, E fill, string_type& val) const;
virtual iter_type do_put(iter_type next, bool intl,
ios_base& x, E fill, long double& val) const;
The first virtual protected member function generates sequential elements beginning at next
to produce a monetary
output field from the string_type
object val
. The sequence controlled by val
must begin with one or more
decimal digits, optionally preceded by a minus sign (-
), which represents the amount. The function returns an iterator
designating the first element beyond the generated monetary output field.
The second virtual protected member function behaves the same as the first, except that it effectively first converts val
to a sequence of decimal digits, optionally preceded by a minus sign, then converts that sequence as above.
The format of a monetary output field is determined by the locale facet fac
returned by the (effective) call use_facet
<
moneypunct
<E, intl>(x.
getloc
())
. Specifically:
fac.
pos_format
()
determines the order in which components of the field are generated for a non-negative
value.fac.
neg_format
()
determines the order in which components of the field are generated for a negative value.fac.
curr_symbol
()
determines the sequence of elements to generate for a currency symbol.fac.
positive_sign
()
determines the sequence of elements to generate for a positive sign.fac.
negative_sign
()
determines the sequence of elements to generate for a negative sign.fac.
grouping
()
determines how digits are grouped to the left of any decimal point.fac.
thousands_sep
()
determines the element that separates groups of digits to the left of any decimal point.fac.
decimal_point
()
determines the element that separates the integer digits from any fraction digits.fac.
frac_digits
()
determines the number of significant fraction digits to the right of any decimal point.If the sign string (fac.negative_sign
or fac.positive_sign
) has more than one element, only the first element is
generated where the element equal to money_base::
sign
appears in the format pattern (fac.neg_format
or
fac.pos_format
). Any remaining elements are generated at the end of the monetary output field.
If x.
flags
() &
showbase
is nonzero, the string fac.curr_symbol
is generated where the element equal to
money_base::
symbol
appears in the format pattern. Otherwise, no currency symbol is generated.
If no grouping constraints are imposed by fac.grouping()
(its first element has the value CHAR_MAX
), then no
instances of fac.thousands_sep()
are generated in the value portion of the monetary output field (where the
element equal to money_base::
value
appears in the format pattern). If fac.frac_digits()
is zero, then no
instance of fac.decimal_point()
is generated after the decimal digits. Otherwise, the resulting monetary output field
places the low-order fac.frac_digits()
decimal digits to the right of the decimal point.
Padding occurs as for any numeric output field, except that if x.flags() & x.
internal
is nonzero, any internal
padding is generated where the element equal to money_base::
space
appears in the format pattern, if the element does appear.
Otherwise, internal padding occurs before the generated sequence. The padding character is fill
.
The function calls x.width(0)
to reset the field width to zero.