<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2691: money_base::space and do_put: U+0020 versus fill</title>
<meta property="og:title" content="Issue 2691: money_base::space and do_put: U+0020 versus fill">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2691.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="2691"><a href="lwg-active.html#2691">2691</a>. <code>money_base::space</code> and <code>do_put</code>: U+0020 versus <code>fill</code></h3>
<p><b>Section:</b> 28.3.4.7.4 <a href="https://wg21.link/locale.moneypunct">[locale.moneypunct]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Hubert Tong <b>Opened:</b> 2016-04-12 <b>Last modified:</b> 2016-05-22</p>
<p><b>Priority: </b>3
</p>
<p><b>View all other</b> <a href="lwg-index.html#locale.moneypunct">issues</a> in [locale.moneypunct].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The description of <code>money_base::space</code> is that "at least one space is required at that position." 
(N4582 subclause 22.4.6.3 [locale.moneypunct] paragraph 2)
<p/>
When formatting for output (28.3.4.7.3.3 <a href="https://wg21.link/locale.money.put.virtuals">[locale.money.put.virtuals]</a>), it is not clear that
</p>
<ol style="list-style-type:lower-alpha">
<li><p>
"the number of characters generated for the specified format" (excluding fill padding) includes exactly 
one character for <code>money_base::space</code> (if present), and
</p></li>
<li><p>
all characters corresponding to <code>money_base::space</code> (excluding fill padding) are copies of <code>fill</code>.
</p></li>
</ol>
<p>
In particular, there is implementation divergence over point (b) as to whether U+0020 or <code>fill</code> should be used.
Further, should a character other than <code>fill</code> be used, it is unclear when "the fill characters are 
placed where <code>none</code> or <code>space</code> appears in the formatting pattern", whether the fill characters are placed 
at the beginning or the end of the "space field".
<p/>
I believe that a strict interpretation of the current wording supports U+0020; however, <code>fill</code> is more likely 
to be the pragmatic choice.
</p>


<p id="res-2691"><b>Proposed resolution:</b></p>
<p>
This wording is relative to N4582.
</p>
<ol>
<li><p>Change 28.3.4.7.4 <a href="https://wg21.link/locale.moneypunct">[locale.moneypunct]</a> paragraph 2 as indicated:</p>

<blockquote>
<p>
-2- Where <code>none</code> or <code>space</code> appears, white space is permitted in the format, except where <code>none</code> 
appears at the end, in which case no white space is permitted. <ins>For input, the value <code>space</code> indicates that 
at least one space is required at that position. For output, the value <code>space</code> indicates one instance of the 
fill character (28.3.4.7.3.3 <a href="https://wg21.link/locale.money.put.virtuals">[locale.money.put.virtuals]</a>).</ins><del>The value <code>space</code> indicates that at least one 
space is required at that position</del>. Where <code>symbol</code> appears, the sequence of characters returned by 
<code>curr_symbol()</code> is permitted, and can be required. Where <code>sign</code> appears, the first (if any) of the 
sequence of characters returned by <code>positive_sign()</code> or <code>negative_sign()</code> (respectively as the monetary 
value is non-negative or negative) is required. Any remaining characters of the sign sequence are required after all 
other format components. Where <code>value</code> appears, the absolute numeric monetary value is required.
</p>
</blockquote>
</li>
</ol>





</body>
</html>
