<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xml:lang="en">
<head><meta http-equiv="Content-type" content="application/xhtml+xml;charset=utf-8" /><title>Propose to adopt make_array into the IS</title></head>
<body><!-- maruku -o make_array_IS.html make_array_IS.md --><style type='text/css'>
pre { margin: 0; }
pre code { display: block; margin-left: 2em; }
div { display: block; margin-left: 2em; }
ins { text-decoration: none; font-weight: bold; background-color: #A0FFA0 }
del { text-decoration: line-through; background-color: #FFA0A0 }
</style><table><tbody>
<tr><th>Doc. no.:</th>	<td>P0325R1</td></tr>
<tr><th>Date:</th>	<td>2016-06-29</td></tr>
<tr><th>Audience:</th>	<td>Library Working Group</td></tr>
<tr><th>Reply-to:</th>	<td>Zhihao Yuan &lt;zy at miator dot net&gt;</td></tr>
</tbody></table>
<h1 id="propose_to_adopt_make_array_into_the_is">Propose to adopt make_array into the IS</h1>

<h2 id="proposal">Proposal</h2>

<p>This paper proposes to adopt the “Array creation functions”<code>[1]</code> in Library Fundamentals v2 into the C++ working paper, for the following reasons:</p>

<ol>
<li>
<p>These facilities are useful, and have been replicated/reinvented in many places/codebases, also been an LWG issue since 2008<code>[2]</code>, while the design adopted in TSv2 is of the least controversial among those.</p>
</li>

<li>
<p>The functionality is stable since the initial <code>make_array</code> paper<code>[3]</code>.</p>
</li>
</ol>

<h2 id="wording">Wording</h2>

<p>The wording is relative to N4594.</p>

<p>Copy the section 9.2.2 [container.array.creation]<code>[1]</code> from Library Fundamentals v2 to the IS working paper, as a new section 23.3.7.9 [array.creation] between [array.zero] and [array.tuple], and adjust 23.3.2 [array.syn] accordingly (see the adopted paper<code>[4]</code> for reference).</p>

<p>Amend the examples in 23.3.7.9 with the following:</p>

<blockquote>
<p><em>[Example:</em></p>
</blockquote>

<pre><code>    int i = 1; int&amp; ri = i;
    auto a1 = make_array(i, ri);         // a1 is of type array&lt;int, 2&gt;
    auto a2 = make_array(i, ri, 42L);    // a2 is of type array&lt;long, 3&gt;
    auto a3 = make_array&lt;long&gt;(i, ri);   // a3 is of type array&lt;long, 2&gt;
    auto a4 = make_array&lt;long&gt;();        // a4 is of type array&lt;long, 0&gt;
    auto a5 = make_array();              // ill-formed</code></pre>
<div><ins><tt style='white-space: pre'>   auto a6 = make_array&lt;double&gt;(1, 2);  // ill-formed: might narrow</tt></ins></div>
<blockquote>
<p><em>–end example]</em></p>
</blockquote>

<h2 id="references">References</h2>

<p><code>[1]</code> Array creation functions. N4564 <em>Programming Languages – C++ Extensions for Library Fundamentals, Version 2</em>. <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4564.pdf#page=104&zoom=auto,0,590">http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4564.pdf#page=104&zoom=auto,0,590</a></p>

<p><code>[2]</code> LWG 851 <em>simplified array construction</em>. <a href="http://cplusplus.github.io/LWG/lwg-active.html#851">http://cplusplus.github.io/LWG/lwg-active.html#851</a></p>

<p><code>[3]</code> N3824 <em>make_array</em>. <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3824.htm">http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3824.htm</a></p>

<p><code>[4]</code> N4391 <em>make_array, revision 4</em>. <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4391.html">http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2015/n4391.html</a></p>
</body></html>
