std::num_put man page

std::num_put< _CharT, _OutIter > — Primary class template num_put.

This facet encapsulates the code to convert a number to a string. It is used by the ostream numeric insertion operators.

Synopsis

Inherits std::locale::facet.

Public Types

typedef _CharT char_type
Public typedefs.
typedef _OutIter iter_type
Public typedefs.

Public Member Functions

num_put (size_t __refs=0)
Constructor performs initialization.
template<typename _ValueT > _OutIter _M_insert_float (_OutIter __s, ios_base &__io, _CharT __fill, char __mod, _ValueT __v) const

template<typename _ValueT > _OutIter _M_insert_int (_OutIter __s, ios_base &__io, _CharT __fill, _ValueT __v) const

iter_type put (iter_type __s, ios_base &__io, char_type __fill, bool __v) const
Numeric formatting.
iter_type put (iter_type __s, ios_base &__io, char_type __fill, const void *__v) const
Numeric formatting.
iter_type put (iter_type __s, ios_base &__io, char_type __fill, long __v) const
Numeric formatting.
iter_type put (iter_type __s, ios_base &__io, char_type __fill, unsigned long __v) const
Numeric formatting.
iter_type put (iter_type __s, ios_base &__io, char_type __fill, long long __v) const
Numeric formatting.
iter_type put (iter_type __s, ios_base &__io, char_type __fill, unsigned long long __v) const
Numeric formatting.
iter_type put (iter_type __s, ios_base &__io, char_type __fill, double __v) const
Numeric formatting.
iter_type put (iter_type __s, ios_base &__io, char_type __fill, long double __v) const
Numeric formatting.

Static Public Attributes

static locale::id id
Numpunct facet id.

Protected Member Functions

virtual ~num_put ()
Destructor.
void _M_group_float (const char *__grouping, size_t __grouping_size, char_type __sep, const char_type *__p, char_type *__new, char_type *__cs, int &__len) const

void _M_group_int (const char *__grouping, size_t __grouping_size, char_type __sep, ios_base &__io, char_type *__new, char_type *__cs, int &__len) const

template<typename _ValueT > iter_type _M_insert_float (iter_type, ios_base &__io, char_type __fill, char __mod, _ValueT __v) const

template<typename _ValueT > iter_type _M_insert_int (iter_type, ios_base &__io, char_type __fill, _ValueT __v) const

void _M_pad (char_type __fill, streamsize __w, ios_base &__io, char_type *__new, const char_type *__cs, int &__len) const
virtual iter_type do_put (iter_type __s, ios_base &__io, char_type __fill, bool __v) const
Numeric formatting.
virtual iter_type do_put (iter_type __s, ios_base &__io, char_type __fill, long __v) const
Numeric formatting.
virtual iter_type do_put (iter_type __s, ios_base &__io, char_type __fill, unsigned long __v) const
Numeric formatting.
virtual iter_type do_put (iter_type __s, ios_base &__io, char_type __fill, long long __v) const
Numeric formatting.
virtual iter_type do_put (iter_type __s, ios_base &__io, char_type __fill, unsigned long long __v) const
Numeric formatting.
virtual iter_type do_put (iter_type, ios_base &, char_type, double) const
Numeric formatting.
virtual iter_type do_put (iter_type, ios_base &, char_type, long double) const
Numeric formatting.
virtual iter_type do_put (iter_type, ios_base &, char_type, const void *) const
Numeric formatting.

Static Protected Member Functions

static __c_locale _S_clone_c_locale (__c_locale &__cloc) throw ()

static void _S_create_c_locale (__c_locale &__cloc, const char *__s, __c_locale __old=0)

static void _S_destroy_c_locale (__c_locale &__cloc)

static __c_locale _S_get_c_locale ()

static const char * _S_get_c_name () throw ()

static __c_locale _S_lc_ctype_c_locale (__c_locale __cloc, const char *__s)

Detailed Description

template<typename _CharT, typename _OutIter>

class std::num_put< _CharT, _OutIter >" Primary class template num_put.

This facet encapsulates the code to convert a number to a string. It is used by the ostream numeric insertion operators.

The num_put template uses protected virtual functions to provide the actual results. The public accessors forward the call to the virtual functions. These virtual functions are hooks for developers to implement the behavior they require from the num_put facet.

Definition at line 2289 of file locale_facets.h.

Member Typedef Documentation

template<typename _CharT , typename _OutIter > typedef _CharT std::num_put< _CharT, _OutIter >::char_type

Public typedefs.

Definition at line 2295 of file locale_facets.h.

template<typename _CharT , typename _OutIter > typedef _OutIter std::num_put< _CharT, _OutIter >::iter_type

Public typedefs.

Definition at line 2296 of file locale_facets.h.

Constructor & Destructor Documentation

template<typename _CharT , typename _OutIter > std::num_put< _CharT, _OutIter >::num_put (size_t __refs = 0) [inline], [explicit]

Constructor performs initialization. This is the constructor provided by the standard.

Parameters:

__refs Passed to the base facet class.

Definition at line 2310 of file locale_facets.h.

template<typename _CharT , typename _OutIter > virtual std::num_put< _CharT, _OutIter >::~num_put () [inline], [protected], [virtual]

Destructor.

Definition at line 2489 of file locale_facets.h.

Member Function Documentation

template<typename _CharT , typename _OutIter > _OutIter std::num_put< _CharT, _OutIter >::do_put (iter_type __s, ios_base & __io, char_type __fill, bool __v) const [protected], [virtual]

Numeric formatting. These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 1106 of file locale_facets.tcc.

References std::ios_base::_M_getloc(), std::ios_base::adjustfield, std::ios_base::boolalpha, std::ios_base::flags(), std::ios_base::left, and std::ios_base::width().

Referenced by std::num_put< _CharT, _OutIter >::do_put().

template<typename _CharT , typename _OutIter > virtual iter_type std::num_put< _CharT, _OutIter >::do_put (iter_type __s, ios_base & __io, char_type __fill, long __v) const [inline], [protected], [virtual]

Numeric formatting. These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2509 of file locale_facets.h.

template<typename _CharT , typename _OutIter > virtual iter_type std::num_put< _CharT, _OutIter >::do_put (iter_type __s, ios_base & __io, char_type __fill, unsigned long __v) const [inline], [protected], [virtual]

Numeric formatting. These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2513 of file locale_facets.h.

template<typename _CharT , typename _OutIter > virtual iter_type std::num_put< _CharT, _OutIter >::do_put (iter_type __s, ios_base & __io, char_type __fill, long long __v) const [inline], [protected], [virtual]

Numeric formatting. These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2519 of file locale_facets.h.

template<typename _CharT , typename _OutIter > virtual iter_type std::num_put< _CharT, _OutIter >::do_put (iter_type __s, ios_base & __io, char_type __fill, unsigned long long __v) const [inline], [protected], [virtual]

Numeric formatting. These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2524 of file locale_facets.h.

template<typename _CharT , typename _OutIter > _OutIter std::num_put< _CharT, _OutIter >::do_put (iter_type __s, ios_base & __io, char_type __fill, double __v) const [protected], [virtual]

Numeric formatting. These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 1158 of file locale_facets.tcc.

References std::num_put< _CharT, _OutIter >::do_put().

template<typename _CharT , typename _OutIter > _OutIter std::num_put< _CharT, _OutIter >::do_put (iter_type __s, ios_base & __io, char_type __fill, long double __v) const [protected], [virtual]

Numeric formatting. These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 1172 of file locale_facets.tcc.

References std::num_put< _CharT, _OutIter >::do_put().

template<typename _CharT , typename _OutIter > _OutIter std::num_put< _CharT, _OutIter >::do_put (iter_type __s, ios_base & __io, char_type __fill, const void * __v) const [protected], [virtual]

Numeric formatting. These functions do the work of formatting numeric values and inserting them into a stream. This function is a hook for derived classes to change the value returned.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 1179 of file locale_facets.tcc.

References std::ios_base::basefield, std::ios_base::flags(), std::ios_base::hex, std::ios_base::showbase, and std::ios_base::uppercase.

template<typename _CharT , typename _OutIter > iter_type std::num_put< _CharT, _OutIter >::put (iter_type __s, ios_base & __io, char_type __fill, bool __v) const [inline]

Numeric formatting. Formats the boolean v and inserts it into a stream. It does so by calling num_put::do_put().

If ios_base::boolalpha is set, writes ctype<CharT>::truename() or ctype<CharT>::falsename(). Otherwise formats v as an int.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2328 of file locale_facets.h.

template<typename _CharT , typename _OutIter > iter_type std::num_put< _CharT, _OutIter >::put (iter_type __s, ios_base & __io, char_type __fill, long __v) const [inline]

Numeric formatting. Formats the integral value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::basefield. If equal to ios_base::oct, formats like the printf o specifier. Else if equal to ios_base::hex, formats like x or X with ios_base::uppercase unset or set respectively. Otherwise, formats like d, ld, lld for signed and u, lu, llu for unsigned values. Note that if both oct and hex are set, neither will take effect.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showbase is set, '0' precedes octal values (except 0) and '0[xX]' precedes hex values.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2370 of file locale_facets.h.

template<typename _CharT , typename _OutIter > iter_type std::num_put< _CharT, _OutIter >::put (iter_type __s, ios_base & __io, char_type __fill, unsigned long __v) const [inline]

Numeric formatting. Formats the integral value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::basefield. If equal to ios_base::oct, formats like the printf o specifier. Else if equal to ios_base::hex, formats like x or X with ios_base::uppercase unset or set respectively. Otherwise, formats like d, ld, lld for signed and u, lu, llu for unsigned values. Note that if both oct and hex are set, neither will take effect.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showbase is set, '0' precedes octal values (except 0) and '0[xX]' precedes hex values.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2374 of file locale_facets.h.

template<typename _CharT , typename _OutIter > iter_type std::num_put< _CharT, _OutIter >::put (iter_type __s, ios_base & __io, char_type __fill, long long __v) const [inline]

Numeric formatting. Formats the integral value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::basefield. If equal to ios_base::oct, formats like the printf o specifier. Else if equal to ios_base::hex, formats like x or X with ios_base::uppercase unset or set respectively. Otherwise, formats like d, ld, lld for signed and u, lu, llu for unsigned values. Note that if both oct and hex are set, neither will take effect.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showbase is set, '0' precedes octal values (except 0) and '0[xX]' precedes hex values.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2380 of file locale_facets.h.

template<typename _CharT , typename _OutIter > iter_type std::num_put< _CharT, _OutIter >::put (iter_type __s, ios_base & __io, char_type __fill, unsigned long long __v) const [inline]

Numeric formatting. Formats the integral value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::basefield. If equal to ios_base::oct, formats like the printf o specifier. Else if equal to ios_base::hex, formats like x or X with ios_base::uppercase unset or set respectively. Otherwise, formats like d, ld, lld for signed and u, lu, llu for unsigned values. Note that if both oct and hex are set, neither will take effect.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showbase is set, '0' precedes octal values (except 0) and '0[xX]' precedes hex values.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2384 of file locale_facets.h.

template<typename _CharT , typename _OutIter > iter_type std::num_put< _CharT, _OutIter >::put (iter_type __s, ios_base & __io, char_type __fill, double __v) const [inline]

Numeric formatting. Formats the floating point value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::floatfield. If equal to ios_base::fixed, formats like the printf f specifier. Else if equal to ios_base::scientific, formats like e or E with ios_base::uppercase unset or set respectively. Otherwise, formats like g or G depending on uppercase. Note that if both fixed and scientific are set, the effect will also be like g or G.

The output precision is given by io.precision(). This precision is capped at numeric_limits::digits10 + 2 (different for double and long double). The default precision is 6.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showpoint is set, a decimal point will always be output.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2433 of file locale_facets.h.

template<typename _CharT , typename _OutIter > iter_type std::num_put< _CharT, _OutIter >::put (iter_type __s, ios_base & __io, char_type __fill, long double __v) const [inline]

Numeric formatting. Formats the floating point value v and inserts it into a stream. It does so by calling num_put::do_put().

Formatting is affected by the flag settings in io.

The basic format is affected by the value of io.flags() & ios_base::floatfield. If equal to ios_base::fixed, formats like the printf f specifier. Else if equal to ios_base::scientific, formats like e or E with ios_base::uppercase unset or set respectively. Otherwise, formats like g or G depending on uppercase. Note that if both fixed and scientific are set, the effect will also be like g or G.

The output precision is given by io.precision(). This precision is capped at numeric_limits::digits10 + 2 (different for double and long double). The default precision is 6.

If ios_base::showpos is set, '+' is output before positive values. If ios_base::showpoint is set, a decimal point will always be output.

The decimal point character used is numpunct::decimal_point(). Thousands separators are inserted according to numpunct::grouping() and numpunct::thousands_sep().

If io.width() is non-zero, enough fill characters are inserted to make the result at least that wide. If (io.flags() & ios_base::adjustfield) == ios_base::left, result is padded at the end. If ios_base::internal, then padding occurs immediately after either a '+' or '-' or after '0x' or '0X'. Otherwise, padding occurs at the beginning.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2437 of file locale_facets.h.

template<typename _CharT , typename _OutIter > iter_type std::num_put< _CharT, _OutIter >::put (iter_type __s, ios_base & __io, char_type __fill, const void * __v) const [inline]

Numeric formatting. Formats the pointer value v and inserts it into a stream. It does so by calling num_put::do_put().

This function formats v as an unsigned long with ios_base::hex and ios_base::showbase set.

Parameters:

__s Stream to write to.
__io Source of locale and flags.
__fill Char_type to use for filling.
__v Value to format and insert.

Returns:

Iterator after writing.

Definition at line 2458 of file locale_facets.h.

Member Data Documentation

template<typename _CharT , typename _OutIter > locale::id std::num_put< _CharT, _OutIter >::id [static]

Numpunct facet id.

Definition at line 2300 of file locale_facets.h.

Author

Generated automatically by Doxygen for libstdc++ from the source code.

Info

Fri Sep 16 2016 libstdc++