num_put::do_put

virtual iter_type do_put(iter_type next, ios_base& x,
    E fill, long val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
    E fill, unsigned long val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
    E fill, double val) const;
virtual iter_type do_put(iter_type nextp ios_base& x,
    E fill, long double val) const;
virtual iter_type do_put(iter_type nextp ios_base& x,
    E fill, const void *val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
    E 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 E 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 x.width() is nonzero, a field width of this value is prepended. The function then calls x.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 x.width(). Such padding consists of a sequence of N - width() copies of fill. Padding then occurs as follows:

Finally:

The format of an integer output field is further determined by the locale facet fac returned by the call use_facet <numpunct<E>(x. getloc()). Specifically:

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 output field. Otherwise, separators are inserted after the print conversion occurs.

The second virtual protected member function:

virtual iter_type do_put(iter_type next, ios_base& x,
    E fill, unsigned long val) const;

behaves the same as the first, except that it replaces a conversion specification of ld with lu.

The third virtual protected member function:

virtual iter_type do_put(iter_type next, ios_base& x,
    E fill, double val) const;

behaves the same as the first, except that it produces a floating-point output field from the value of val. fac.decimal_point() determines the sequence that separates the integer digits from the fraction digits. The equivalent print conversion specifier is determined as follows:

If x.flags() & ios_base::fixed is nonzero, or if x.precision() is greater than zero, a precision with the value x.precision() is prepended to the conversion specification. Any padding behaves the same as for an integer output field. The padding character is fill. Finally:

The fourth virtual protected member function:

virtual iter_type do_put(iter_type next, ios_base& x,
    E fill, long double val) const;

behaves the same as the third, except that the qualifier l in the conversion specification is replaced with L.

The fifth virtual protected member function:

virtual iter_type do_put(iter_type next, ios_base& x,
    E fill, const void *val) const;

behaves the same as the first, except that the conversion specification is p, plus any qualifier needed to specify padding.

The sixth virtual protected member function:

virtual iter_type do_put(iter_type next, ios_base& x,
    E fill, bool val) const;

behaves the same as the first, except that it generates a Boolean output field from val.

A Boolean output field takes one of two forms. If x.flags() & ios_base::boolalpha is false, the generated sequence is either 0 (for false) or 1 (for true). Otherwise, the generated sequence is either fac.falsename() (for false), or fac.truename() (for true).