[locale.nm.put] (original) (raw)

28.3.4.3.3.1 General [locale.nm.put.general]

namespace std { template<class charT, class OutputIterator = ostreambuf_iterator<charT>> class num_put : public locale::facet { public: using char_type = charT;using iter_type = OutputIterator;explicit num_put(size_t refs = 0); iter_type put(iter_type s, ios_base& f, char_type fill, bool v) const; iter_type put(iter_type s, ios_base& f, char_type fill, long v) const; iter_type put(iter_type s, ios_base& f, char_type fill, long long v) const; iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long v) const; iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long long v) const; iter_type put(iter_type s, ios_base& f, char_type fill, double v) const; iter_type put(iter_type s, ios_base& f, char_type fill, long double v) const; iter_type put(iter_type s, ios_base& f, char_type fill, const void* v) const;static locale::id id;protected: ~num_put();virtual iter_type do_put(iter_type, ios_base&, char_type fill, bool v) const;virtual iter_type do_put(iter_type, ios_base&, char_type fill, long v) const;virtual iter_type do_put(iter_type, ios_base&, char_type fill, long long v) const;virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long) const;virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long long) const;virtual iter_type do_put(iter_type, ios_base&, char_type fill, double v) const;virtual iter_type do_put(iter_type, ios_base&, char_type fill, long double v) const;virtual iter_type do_put(iter_type, ios_base&, char_type fill, const void* v) const;};}

The facetnum_putis used to format numeric values to a character sequence such as an ostream.

28.3.4.3.3.2 Members [facet.num.put.members]

iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const; iter_type put(iter_type out, ios_base& str, char_type fill, long val) const; iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const; iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long val) const; iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const; iter_type put(iter_type out, ios_base& str, char_type fill, double val) const; iter_type put(iter_type out, ios_base& str, char_type fill, long double val) const; iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;

Returns: do_put(out, str, fill, val).

28.3.4.3.3.3 Virtual functions [facet.num.put.virtuals]

iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const; iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const; iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const; iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const; iter_type do_put(iter_type out, ios_base& str, char_type fill, double val) const; iter_type do_put(iter_type out, ios_base& str, char_type fill, long double val) const; iter_type do_put(iter_type out, ios_base& str, char_type fill, const void* val) const;

Effects: Writes characters to the sequence out, formatting val as desired.

In the following description, loc names a local variable initialized aslocale loc = str.getloc();

The details of this operation occur in several stages:

Detailed descriptions of each stage follow.

iter_type do_put(iter_type out, ios_base& str, char_type fill, bool val) const;

Returns: If (str.flags() & ios_base​::​boolalpha) == 0returns do_put(out, str, fill,
(int)val), otherwise obtains a string s as if bystring_type s = val ? use_facet<numpunct<charT>>(loc).truename() : use_facet<numpunct<charT>>(loc).falsename();and then inserts each character c of s into outvia *out++ = cand returns out.