Title
money_put::do_put underspecified
Status
new
Section
[locale.money.put.virtuals]
Submitter
Jonathan Wakely

Created on 2017-06-21.00:00:00 last changed 83 months ago

Messages

Date: 2017-06-27.18:12:29

Proposed resolution:

This wording is relative to N4659.

  1. Edit [locale.money.put.virtuals] as indicated:

    iter_type do_put(iter_type s, bool intl, ios_base& str,
                     char_type fill, long double units) const;
    iter_type do_put(iter_type s, bool intl, ios_base& str,
                     char_type fill, const string_type& digits) const;
    

    […]

    -2- Remarks: The currency symbol is generated if and only if (str.flags() & str.showbase) is nonzero. If the format specifies a decimal point, at least one digit character appears before it. If the number of characters generated for the specified format is less than the value returned by str.width() on entry to the function, then copies of fill are inserted as necessary to pad to the specified width. For the value af equal to (str.flags() & str.adjustfield), if (af == str.internal) is true, the fill characters are placed where none or space appears in the formatting pattern; otherwise if (af == str.left) is true, they are placed after the other characters; otherwise, they are placed before the other characters.

Date: 2017-06-15.00:00:00

[ 2017-06-27, Jonathan comments and provides wording ]

I suggest that we require a leading zero. The wording below is similar to how C specifies the %f format specifier for fprintf.

Date: 2017-06-21.00:00:00

Whether you get ".99" or "0.99" for the following depends on the implementation:

std::cout.imbue(std::locale("en_US"));
std::cout << std::put_money(99.L);

I don't see any justification in [locale.money.put.virtuals] for the leading 0, although that seems more useful.

If we want the leading zero, we should say so.

History
Date User Action Args
2017-06-27 18:12:29adminsetmessages: + msg9295
2017-06-27 18:12:29adminsetmessages: + msg9294
2017-06-21 00:00:00admincreate