<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2983: money_put::do_put underspecified</title>
<meta property="og:title" content="Issue 2983: money_put::do_put underspecified">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2983.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
<h3 id="2983"><a href="lwg-active.html#2983">2983</a>. <code>money_put::do_put</code> underspecified</h3>
<p><b>Section:</b> 28.3.4.7.3.3 <a href="https://wg21.link/locale.money.put.virtuals">[locale.money.put.virtuals]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Jonathan Wakely <b>Opened:</b> 2017-06-21 <b>Last modified:</b> 2017-06-27</p>
<p><b>Priority: </b>3
</p>
<p><b>View all other</b> <a href="lwg-index.html#locale.money.put.virtuals">issues</a> in [locale.money.put.virtuals].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
Whether you get "<code>.99</code>" or "<code>0.99</code>" for the following depends on the implementation:
</p>
<blockquote><pre>
std::cout.imbue(std::locale("en_US"));
std::cout &lt;&lt; std::put_money(99.L);
</pre></blockquote>
<p>
I don't see any justification in [locale.money.put.virtuals] for the leading <code>0</code>, although that seems more useful.
<p/>
If we want the leading zero, we should say so.
</p>

<p><i>[2017-06-27, Jonathan comments and provides wording]</i></p>

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


<p id="res-2983"><b>Proposed resolution:</b></p>
<p>
This wording is relative to <a href="https://wg21.link/n4659">N4659</a>.
</p>

<ol>
<li><p>Edit 28.3.4.7.3.3 <a href="https://wg21.link/locale.money.put.virtuals">[locale.money.put.virtuals]</a> as indicated:</p>

<blockquote>
<pre>
iter_type do_put(iter_type s, bool intl, ios_base&amp; str,
                 char_type fill, long double units) const;
iter_type do_put(iter_type s, bool intl, ios_base&amp; str,
                 char_type fill, const string_type&amp; digits) const;
</pre>
<blockquote>
<p>
[&hellip;]
<p/>
-2- <i>Remarks:</i> The currency symbol is generated if and only if <code>(str.flags() &amp; str.showbase)</code> is nonzero.
<ins>If the format specifies a decimal point, at least one digit character appears before it.</ins>
If the number of characters generated for the specified format is less than the value returned by
<code>str.width()</code> on entry to the function, then copies of <code>fill</code> are inserted as necessary to pad to the 
specified width. For the value <code>af</code> equal to <code>(str.flags() &amp; str.adjustfield)</code>, if 
<code>(af == str.internal)</code> is <code>true</code>, the fill characters are placed where <code>none</code> or <code>space</code> 
appears in the formatting pattern; otherwise if <code>(af == str.left)</code> is <code>true</code>, they are placed after the 
other characters; otherwise, they are placed before the other characters.
</p>
</blockquote>
</blockquote>
</li>
</ol>




</body>
</html>
