<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2648: [filesys.ts] [PDTS] path::template&lt;class charT&gt;string() conversion rules</title>
<meta property="og:title" content="Issue 2648: [filesys.ts] [PDTS] path::template&lt;class charT&gt;string() conversion rules">
<meta property="og:description" content="C++ library issue. Status: TS">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2648.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#TS">TS</a> status.</em></p>
<h3 id="2648"><a href="lwg-defects.html#2648">2648</a>. [filesys.ts] [PDTS] <code>path::template&lt;class charT&gt;string()</code> conversion rules</h3>
<p><b>Section:</b> 8.4.6 [filesys.ts::path.native.obs] <b>Status:</b> <a href="lwg-active.html#TS">TS</a>
 <b>Submitter:</b> P.J. Plauger <b>Opened:</b> 2014-01-30 <b>Last modified:</b> 2017-07-30</p>
<p><b>Priority: </b>Not Prioritized
</p>
<p><b>View all issues with</b> <a href="lwg-status.html#TS">TS</a> status.</p>
<p><b>Discussion:</b></p>
<p><b>Addresses: filesys.ts</b></p>
<p>
<code>path::template&lt;class charT&gt;string()</code> should promise to convert by the same
rules as <code>u16string</code> for <code>string&lt;char16_t&gt;</code>, etc. and one-for-one otherwise.
<p/>
What if <code>charT</code> is <code>signed char</code> (or even <code>float</code>)? I don't see where that choice
is disallowed, so we should either disallow it or make it be something that is quasi-sensible. 
</p>

<p><i>[2014-02-08 Daniel comments]</i></p>

<p>
There are two relevant places in the wording that seem to clarify what is required here:
</p>
<ol>
<li><p>
Most importantly, 5 [fs.req] says:
</p>
<blockquote><p>
Throughout this Technical Specification, <code>char</code>, <code>wchar_t</code>, <code>char16_t</code>, and <code>char32_t</code> 
are collectively called <em>encoded character types</em>.
<p/>
Template parameters named <code>charT</code> shall be one of the encoded character types.
<p/>
[&hellip;]
[<i>Note</i>: Use of an encoded character type implies an associated encoding. Since <code>signed char</code> and <code>unsigned char</code> 
have no implied encoding, they are not included as permitted types. &mdash; <i>end note</i>]
</p></blockquote>
</li>

<li><p>
For both the mentioned <code>string</code> function template and the specific non-template functions (such as <code>u16string()</code>)
the same <code>Remarks</code> element exists, that refers to character conversion:
</p>
<blockquote><p>
Conversion, if any, is performed as specified by 8.2 [path.cvt].
</p></blockquote>
</li>
</ol>

<p>
The first quote excludes arbitrary types such as <code>signed char</code> or <code>float</code> as feasible template arguments. 
The second quote makes clear that both the function template and the non-template functions do normatively refer to the same 
wording in 8.2 [path.cvt].
<p/>
Based on this interpretation of the issue discussion I recommend resolving it as NAD.
<p/>
In addition to that recommendation I recommend to rename the current usage of the symbol <code>charT</code> in this technical
specification, because 5 [fs.req] assigns a very special meaning to the constraints on <code>charT</code> types that does not
exist to this extend in the rest of the standard library. A similar approach is used in Clause 22, where a special symbol <code>C</code>
is used for constrained character types (C++11 &sect;22.3.1.1.1 [locale.category]):
</p>
<blockquote><p>
A template formal parameter with name <code>C</code> represents the set of types containing <code>char</code>, <code>wchar_t</code>, 
and any other implementation-defined character types that satisfy the requirements for a character on which any of the 
<code>iostream</code> components can be instantiated.
</p></blockquote>

<p><i>[2014-02-28 Beman provides proposed resolution wording]</i></p>

  <p><i>[18 Jun 2014 Beman changes proposed name from C to EcharT in response to tentative
  vote concern that C was insuficiently informative as a name.]</i></p>




<p id="res-2648"><b>Proposed resolution:</b></p>
<p><i>In the entire Working Paper, except in the synopsis for path inserter and extractor and 8.6.1 path inserter and extractor [path.io],
    change each instance of "<code>charT</code>" to "<code>EcharT</code>".</i></p>
<p><i>For example, in 5 [fs.req]:</i></p>
<blockquote>Template parameters named <del><code>charT</code></del> <ins><code>EcharT</code></ins> shall be one of the 
encoded character types.</blockquote>





</body>
</html>
