Standard C++ Library Reference ISO/IEC (VERSION3)

num_put::do_put
virtual iter_type do_put(iter_type next, ios_base& iosbase,
Elem fill, long val) const;
virtual iter_type do_put(iter_type next, ios_base& iosbase,
Elem fill, unsigned long val) const;
virtual iter_type do_put(iter_type next, ios_base& iosbase,
Elem fill, double val) const;
virtual iter_type do_put(iter_type nextp ios_base& iosbase,
Elem fill, long double val) const;
virtual iter_type do_put(iter_type nextp ios_base& iosbase,
Elem fill, const void *val) const;
virtual iter_type do_put(iter_type next, ios_base& iosbase,
Elem fill, bool val) const;
The first virtual protected member function generates sequential elements beginning at next to produce an integer
output field from the value of val. The function returns an iterator designating the next place to insert an element
beyond the generated integer output field.
The integer output field is generated by the same rules used by the print functions for generating a series of char
elements to a file. (Each such char element is assumed to map to an equivalent element of type Elem by a simple,
one-to-one, mapping.) Where a print function pads a field with either spaces or the digit 0, however, do_put instead
uses fill. The equivalent print conversion specification is determined as follows:
If iosbase.flags() & ios_base::basefield == ios_base::oct, the conversion specification is
lo.
If iosbase.flags() & ios_base::basefield == ios_base::hex, the conversion specification is
lx.
Otherwise, the conversion specification is ld.
If iosbase.width() is nonzero, a field width of this value is prepended. The function then calls
iosbase.width(0) to reset the field width to zero.
Padding occurs only if the minimum number of elements N required to specify the output field is less than
iosbase.width(). Such padding consists of a sequence of N - width() copies of fill. Padding then occurs as
follows:
If iosbase.flags() & ios_base::adjustfield == ios_base::left, the flag - is prepended.
(Padding occurs after the generated text.)
If iosbase.flags() & ios_base::adjustfield == ios_base::internal, the flag 0 is
prepended. (For a numeric output field, padding occurs where the print functions pad with 0.)
Otherwise, no additional flag is prepended. (Padding occurs before the generated sequence.)
Finally:
If iosbase.flags() & ios_base::showpos is nonzero, the flag + is prepended to the conversion
specification.
If iosbase.flags() & ios_base::showbase is nonzero, the flag # is prepended to the conversion
specification.
The format of an integer output field is further determined by the locale facet fac returned by the call use_facet
<numpunct<Elem>(iosbase. getloc()). Specifically:
fac.grouping() determines how digits are grouped to the left of any decimal point
fac.thousands_sep() determines the sequence that separates groups of digits to the left of any decimal
point
If no grouping constraints are imposed by fac.grouping() (its first element has the value CHAR_MAX) then no