cpp/locale/num put/put

@1@ Public member function, calls the protected virtual member function of the most derived class.

@2@ Writes characters to the output sequence which represent the value of, formatted as requested by the formatting flags  and the std and std facets of the locale imbued in the stream. This function is called by all formatted output stream operators, such as.

Conversion occurs in four stages:

Stage 1: conversion specifier selection

 * I/O format flags are obtained, as if by


 * If the type of is :
 * If, then converts to type  and performs integer output.
 * If, obtains if  or  if , and outputs each successive character  of that string to  with . No further processing is done in this case, the function returns.
 * If the type of is an integer type, the first applicable choice of the following is selected:
 * If, will use conversion specifier
 * If, will use conversion specifier
 * If, will use conversion specifier
 * If the type of is signed, will use conversion specifier
 * If the type of is unsigned, will use conversion specifier
 * For integer types, length modifier is added to the conversion specification if necessary: for  and.
 * If the type of is a floating-point type, the first applicable choice of the following is selected:
 * If, will use conversion specifier
 * If, will use conversion specifier
 * If, will use conversion specifier


 * If, will use conversion specifier
 * Otherwise, will use conversion specifier
 * Also:
 * If the type of is, the length modifier  is added to the conversion specifier.
 * If the type of is a floating-point type, the precision modifier is added and set to . Otherwise, no precision is specified.


 * For both integer and floating-point types, if is set, the modifier  is prepended
 * For integer types, if is set, the modifier  is prepended.
 * For floating-point types, if is set, the modifier  is prepended.
 * If the type of is, will use conversion specifier
 * A narrow character string is created as if by a call to in the "C" locale, where  is the chosen conversion specifier.

Stage 2: locale-specific conversion

 * Every character obtained in Stage 1, other than the decimal point, is converted to  by calling.
 * For arithmetic types, the thousands separator character, obtained from, is inserted into the sequence according to the grouping rules provided by
 * Decimal point characters are replaced by

Stage 3: padding
In any case, is called to cancel the effects of std.
 * The adjustment flag is obtained as if by and examined to identify padding location, as follows:
 * If, will pad after
 * If, will pad before
 * If and a sign character occurs in the representation, will pad after the sign
 * If and Stage 1 representation began with 0x or 0X, will pad after the x or X
 * Otherwise, will pad before
 * If is non-zero (e.g. std was just used) and the number of 's after Stage 2 is less than, then copies of the  character are inserted at the position indicated by padding to bring the length of the sequence to.

Stage 4: output
Every successive character from the sequence of 's from Stage 3 is output as if by.