﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

<style type="text/css">

body { color: #000000; background-color: #FFFFFF; }
del { text-decoration: line-through; color: #8B0040; }
ins { text-decoration: underline; color: #005100; }

p.example { margin-left: 2em; }
pre.example { margin-left: 2em; }
div.example { margin-left: 2em; }

code.extract { background-color: #F5F6A2; }
pre.extract { margin-left: 2em; background-color: #F5F6A2;
  border: 1px solid #E1E28E; }

p.function { }
.attribute { margin-left: 2em; }
.attribute dt { float: left; font-style: italic;
  padding-right: 1ex; }
.attribute dd { margin-left: 0em; }

blockquote.std { color: #000000; background-color: #F1F1F1;
  border: 1px solid #D1D1D1;
  padding-left: 0.5em; padding-right: 0.5em; }
blockquote.stddel { text-decoration: line-through;
  color: #000000; background-color: #FFEBFF;
  border: 1px solid #ECD7EC;
  padding-left: 0.5em; padding-right: 0.5em; ; }

blockquote.stdins { /*text-decoration: underline;*/
  color: #000000; background-color: #C8FFC8;
  border: 1px solid #B3EBB3; padding: 0.5em; }

table { border: 1px solid black; border-spacing: 0px;
  margin-left: auto; margin-right: auto; }
th { text-align: left; vertical-align: top;
  padding-left: 0.8em; border: none; }
td { text-align: left; vertical-align: top;
  padding-left: 0.8em; border: none; }

</style>

<title>Multidimensional bounds, index and array_view, revision 2</title>

</head>

<body>
<h1>Multidimensional bounds, index and array_view, revision 2</h1>

<p>
ISO/IEC JTC1 SC22 WG21 N3976 - 2014-05-21
</p>

<p>
Reply-to:<br>
Łukasz Mendakiewicz &lt;lukaszme@microsoft.com&gt;<br>
Herb Sutter &lt;hsutter@microsoft.com&gt;
</p>


<h2><a name="Foreword">Overview</a></h2>

<p>
The feedback we have received during the Issaquah meeting was
to prepare the wording for the proposal as-is. Consequently,
only the wording (with minor improvements) is provided in this version. Interested
readers should find the rationale, background information
and design discussion in the previous revision of the proposal, viz.
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3851.pdf">
N3851</a>.
</p>


<h2><a name="Wording">Wording changes</a></h2>

<p>
The proposed wording changes are relative to
the contents of <a href="http://www.open-std.org/jtc1/sc22/wg21/prot/14882fdis/n3936.pdf">N3936</a>.
</p>


<h3><a name="headers">17.6.1.2 Headers [headers]</a></h3>

<p>
Edit within paragraph 2 as follows.
</p>

<blockquote class="std">
<p>
The C++ standard library provides <del>53</del><ins>55</ins> <em>C++ library headers</em>, as shown in Table 14.
</p>
</blockquote>

<p>
Add the following items to table 14.
</p>

<blockquote class="std">
<p>
<ins><code>&lt;array_view&gt;</code></ins><br>
<ins><code>&lt;coordinate&gt;</code></ins>
</p>
</blockquote>


<h3><a name="utilities">Chapter 20 General utilities library [utilities]</a></h3>

<p>
Add a row to table 44 as follows.
</p>

<blockquote class="std">
<table>
<caption>Table 44: General utilities library summary</caption>
<tbody>
<tr><th>Subclause</th><th>Header(s)</th></tr>
<tr><td valign=top>20.2 Utility components</td>
<td><code>&lt;utility&gt;</code></td></tr>
<tr><td valign=top>20.3 Pairs</td>
<td><code>&lt;utility&gt;</code></td></tr>
<tr><td valign=top>20.4 Tuples</td>
<td><code>&lt;tuple&gt;</code></td></tr>
<tr><td valign=top>20.5 Compile-time integer sequences</td>
<td><code>&lt;utility&gt;</code></td></tr>
<tr><td valign=top><ins>20.6 Multidimensional coordinates</ins></td>
<td><ins><code>&lt;coordinate&gt;</code></ins></td></tr>
<tr><td valign=top>20.<del>6</del><ins>7</ins> Fixed-size sequences of bits</td>
<td><code>&lt;bitset&gt;<br>
&lt;memory&gt;</code></td></tr>
<tr><td valign=top>20.<del>7</del><ins>8</ins> Memory</td>
<td><code>&lt;cstdlib&gt;<br>
&lt;cstring&gt;</code></td></tr>
<tr><td valign=top>20.<del>8</del><ins>9</ins> Smart pointers</td>
<td><code>&lt;memory&gt;</code></td></tr>
<tr><td valign=top>20.<del>9</del><ins>10</ins> Function objects</td>
<td><code>&lt;functional&gt;</code></td></tr>
<tr><td valign=top>20.<del>10</del><ins>11</ins> Type traits</td>
<td><code>&lt;type_traits&gt;</code></td></tr>
<tr><td valign=top>20.<del>11</del><ins>12</ins> Compile-time rational arithmetic</td>
<td><code>&lt;ratio&gt;</code></td></tr>
<tr><td valign=top>20.<del>12</del><ins>13</ins> Time utilities</td>
<td><code>&lt;chrono&gt;<br>
&lt;ctime&gt;</code></td></tr>
<tr><td valign=top>20.<del>13</del><ins>14</ins> Scoped allocators</td>
<td><code>&lt;scoped_allocator&gt;</code></td></tr>
<tr><td valign=top>20.<del>14</del><ins>15</ins> Type indexes</td>
<td><code>&lt;typeindex&gt;</code></td></tr>
</tbody>
</table>
</blockquote>


<h3><a name="coord">20.6 Multidimensional coordinates [coord]</a></h3>

<p>
Add a new section after the <code>intseq</code> section.
</p>


<h3><a name="coord.general">20.6.1 In general [coord.general]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">
<p>
This subclause describes the multidimensional coordinates library. It provides a class template <code>index</code> which represents a mathematical vector in an N-dimensional discrete space, a class template <code>bounds</code> which represents axis-aligned rectangular bounds in such a space, and a class template <code>bounds_iterator</code> which allows iteration over such a space.
</p>
<p>
Throughout this subclause, if a function template is called with a template argument type <code>ArithmeticType</code> such that <code>is_arithmetic&lt;ArithmeticType&gt;::value</code> is <code>false</code>, then the function shall not participate in overload resolution.
</p>
</blockquote>

<p>
Add a new synopsis:
</p>

<blockquote class="stdins">
<p>
<b>Header <code>&lt;coordinate&gt;</code> synopsis</b>
</p>

<pre><code>
#include &lt;initializer_list&gt;

namespace std {
  // [coord.index], class template index
  template &lt;int Rank&gt; class index;

  // [coord.index.arith], index arithmetic
  template &lt;class ArithmeticType, int Rank&gt;
    constexpr index&lt;Rank&gt; operator*(ArithmeticType <var>v</var>, const index&lt;Rank&gt;& <var>rhs</var>);

  // [coord.bounds], class template bounds
  template &lt;int Rank&gt; class bounds;

  // [coord.bounds.arith], bounds arithmetic
  template &lt;int Rank&gt;
    constexpr bounds&lt;Rank&gt; operator+(const index&lt;Rank&gt;& <var>lhs</var>, const bounds&lt;Rank&gt;& <var>rhs</var>);
  template &lt;class ArithmeticType, int Rank&gt;
    constexpr bounds&lt;Rank&gt; operator*(ArithmeticType <var>v</var>, const bounds&lt;Rank&gt;& <var>rhs</var>);

  // [coord.bounds.iterator], class template bounds_iterator
  template &lt;int Rank&gt; class bounds_iterator;

  template &lt;int Rank&gt;
    bounds_iterator&lt;Rank&gt; operator+(typename bounds_iterator&lt;Rank&gt;::difference_type <var>n</var>,
                                    const bounds_iterator&lt;Rank&gt;& <var>rhs</var>);
}
</code></pre>
</blockquote>


<h3><a name="coord.index">20.6.2 Class template <code>index</code> [coord.index]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">
<pre><code>
namespace std {
  template &lt;int Rank&gt;
  class index {
  public:
    // constants and types
    static constexpr int rank = Rank;
    using reference           = ptrdiff_t&;
    using const_reference     = const ptrdiff_t&;
    using size_type           = size_t;
    using value_type          = ptrdiff_t;

    // [coord.index.cnstr], index construction
    constexpr index() noexcept;
    constexpr index(value_type <var>v</var>) noexcept;
    constexpr index(initializer_list&lt;value_type&gt; <var>il</var>) noexcept;

    // [coord.index.eq], index equality
    constexpr bool operator==(const index& <var>rhs</var>) const noexcept;
    constexpr bool operator!=(const index& <var>rhs</var>) const noexcept;

    // [coord.index.cmpt], index component access
    constexpr reference       operator[](size_type <var>n</var>);
    constexpr const_reference operator[](size_type <var>n</var>) const;

    // [coord.index.arith], index arithmetic
    constexpr index  operator+(const index& <var>rhs</var>) const;
    constexpr index  operator-(const index& <var>rhs</var>) const;
    constexpr index& operator+=(const index& <var>rhs</var>);
    constexpr index& operator-=(const index& <var>rhs</var>);

    constexpr index& operator++();
    constexpr index  operator++(int);
    constexpr index& operator--();
    constexpr index  operator--(int);

    constexpr index  operator+() const noexcept;
    constexpr index  operator-() const;

    template &lt;class ArithmeticType&gt; constexpr index  operator*(ArithmeticType <var>v</var>) const;
    template &lt;class ArithmeticType&gt; constexpr index  operator/(ArithmeticType <var>v</var>) const;
    template &lt;class ArithmeticType&gt; constexpr index& operator*=(ArithmeticType <var>v</var>);
    template &lt;class ArithmeticType&gt; constexpr index& operator/=(ArithmeticType <var>v</var>);
  };
}
</code></pre>
</blockquote>


<h3><a name="coord.index.require">20.6.2.1 General requirements [coord.index.require]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
If <code>Rank</code> is less than 1 the program is ill-formed.
</p>

</blockquote>


<h3><a name="coord.index.cnstr">20.6.2.2 Construction [coord.index.cnstr]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr index() noexcept;</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
Zero-initializes each component.
</p>
</blockquote>

<p>
<code>constexpr index(value_type <var>v</var>) noexcept;</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
Initializes the 0<sup>th</sup> component of <code>*this</code> with <code><var>v</var></code>.
</p>
<p>
<i>Remarks:</i>
This function shall not participate in overload resolution unless <code>Rank</code> is 1.
</p>
</blockquote>

<p>
<code>constexpr index(initializer_list&lt;value_type&gt; <var>il</var>) noexcept;</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
For all <var>i</var> in the range <code>[0, Rank)</code>, initializes the <var>i<sup>th</sup></var> component of <code>*this</code> with <code>*(<var>il</var>.begin()[<var>i</var>])</code>.
</p>
<p>
<i>Remarks:</i>
This function shall not participate in overload resolution unless <code><var>il</var>.size()</code> is <code>Rank</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.index.eq">20.6.2.3 Equality [coord.index.eq]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr bool operator==(const index& <var>rhs</var>) const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>true</code> if <code>(*this)[<var>i</var>] == <var>rhs</var>[<var>i</var>]</code> for all <code><var>i</var></code> in the range <code>[0, Rank)</code>, otherwise <code>false</code>.
</p>
</blockquote>

<p>
<code>constexpr bool operator!=(const index& <var>rhs</var>) const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>!(*this == <var>rhs</var>)</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.index.cmpt">20.6.2.4 Component access [coord.index.cmpt]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr reference operator[](size_type <var>n</var>);</code><br>
<code>constexpr const_reference operator[](size_type <var>n</var>) const;</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code><var>n</var> < Rank</code>.
</p>
<p>
<i>Returns:</i>
A reference to the <code><var>n</var></code>th component of <code>*this</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.index.arith">20.6.2.5 Arithmetic [coord.index.arith]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr index operator+(const index& <var>rhs</var>) const;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>index&lt;Rank&gt;{*this} += <var>rhs</var></code>.
</p>
</blockquote>

<p>
<code>constexpr index operator-(const index& <var>rhs</var>) const;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>index&lt;Rank&gt;{*this} += -<var>rhs</var></code>.
</p>
</blockquote>

<p>
<code>constexpr index& operator+=(const index& <var>rhs</var>);</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
For all <var>i</var> in the range <code>[0, Rank)</code>, adds the <var>i<sup>th</sup></var> component of <code><var>rhs</var></code> to the <var>i<sup>th</sup></var> component of <code>*this</code> and stores the sum in the <var>i<sup>th</sup></var> component of <code>*this</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<code>constexpr index& operator-=(const index& <var>rhs</var>);</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>*this += -rhs</code>.
</p>
</blockquote>

<p>
<code>constexpr index& operator++();</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code>Rank == 1</code>.
</p>
<p>
<i>Effects:</i>
<code>++(*this)[0]</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<code>constexpr index operator++(int);</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code>Rank == 1</code>.
</p>
<p>
<i>Returns:</i>
<code>index&lt;Rank&gt;{(*this)[0]++}</code>.
</p>
</blockquote>

<p>
<code>constexpr index& operator--();</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code>Rank == 1</code>.
</p>
<p>
<i>Effects:</i>
<code>--(*this)[0]</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<code>constexpr index operator--(int);</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code>Rank == 1</code>.
</p>
<p>
<i>Returns:</i>
<code>index&lt;Rank&gt;{(*this)[0]--}</code>.
</p>
</blockquote>

<p>
<code>constexpr index operator+() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<code>constexpr index operator-() const;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
A copy of <code>*this</code> with each component negated.
</p>
</blockquote>

<p>
<code>template &lt;class ArithmeticType&gt; constexpr index operator*(ArithmeticType <var>v</var>) const;
</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>index&lt;Rank&gt;{*this} *= <var>v</var></code>.
</p>
</blockquote>

<p>
<code>template &lt;class ArithmeticType&gt; constexpr index operator/(ArithmeticType <var>v</var>) const;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>index&lt;Rank&gt;{*this} /= <var>v</var></code>.
</p>
</blockquote>

<p>
<code>template &lt;class ArithmeticType&gt; constexpr index& operator*=(ArithmeticType <var>v</var>);</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
For all <var>i</var> in the range <code>[0, Rank)</code>, multiplies the <var>i<sup>th</sup></var> component of <code>*this</code> by <code><var>v</var></code> and stores the product in the <var>i<sup>th</sup></var> component of <code>*this</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<code>template &lt;class ArithmeticType&gt; constexpr index& operator/=(ArithmeticType <var>v</var>);</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
For all <var>i</var> in the range <code>[0, Rank)</code>, divides the <var>i<sup>th</sup></var> component of <code>*this</code> by <code><var>v</var></code> and stores the quotient in the <var>i<sup>th</sup></var> component of <code>*this</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<pre><code>template &lt;class ArithmeticType, int Rank&gt;
  constexpr index&lt;Rank&gt; operator*(ArithmeticType <var>v</var>, const index&lt;Rank&gt;& <var>rhs</var>);</code></pre>

<blockquote>
<p>
<i>Returns:</i>
<code>index&lt;Rank&gt;{<var>rhs</var>} *= <var>v</var></code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.bounds">20.6.3 Class template <code>bounds</code> [coord.bounds]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">
<pre><code>
namespace std {
  template &lt;int Rank&gt;
  class bounds {
  public:
    // constants and types
    static constexpr int rank = Rank;
    using reference           = ptrdiff_t&;
    using const_reference     = const ptrdiff_t&;
    using size_type           = size_t;
    using value_type          = ptrdiff_t;

    // [coord.bounds.cnstr], bounds construction
    constexpr bounds() noexcept;
    constexpr bounds(value_type <var>v</var>);
    constexpr bounds(initializer_list&lt;value_type&gt; <var>il</var>);

    // [coord.bounds.eq], bounds equality
    constexpr bool operator==(const bounds& <var>rhs</var>) const noexcept;
    constexpr bool operator!=(const bounds& <var>rhs</var>) const noexcept;

    // [coord.bounds.obs], bounds observers
    constexpr size_type size() const noexcept;
    constexpr bool      contains(const index&lt;Rank&gt;& <var>idx</var>) const noexcept;

    // [coord.bounds.iter], bounds iterators
    bounds_iterator&lt;Rank&gt; begin() const noexcept;
    bounds_iterator&lt;Rank&gt; end() const noexcept;

    // [coord.bounds.cmpt], bounds component access
    constexpr reference       operator[](size_type <var>n</var>);
    constexpr const_reference operator[](size_type <var>n</var>) const;

    // [coord.bounds.arith], bounds arithmetic
    constexpr bounds  operator+(const index&lt;Rank&gt;& <var>rhs</var>) const;
    constexpr bounds  operator-(const index&lt;Rank&gt;& <var>rhs</var>) const;
    constexpr bounds& operator+=(const index&lt;Rank&gt;& <var>rhs</var>);
    constexpr bounds& operator-=(const index&lt;Rank&gt;& <var>rhs</var>);

    template &lt;class ArithmeticType&gt; constexpr bounds  operator*(ArithmeticType <var>v</var>) const;
    template &lt;class ArithmeticType&gt; constexpr bounds  operator/(ArithmeticType <var>v</var>) const;
    template &lt;class ArithmeticType&gt; constexpr bounds& operator*=(ArithmeticType <var>v</var>);
    template &lt;class ArithmeticType&gt; constexpr bounds& operator/=(ArithmeticType <var>v</var>);
  };
}
</code></pre>
</blockquote>


<h3><a name="coord.bounds.require">20.6.3.1 General requirements [coord.bounds.require]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
If <code>Rank</code> is less than 1 the program is ill-formed.
</p>

<p>
Every mutating operation on an object <code><var>b</var></code> of type <code>bounds</code> shall leave the object in a state that satisfies the following constraints:
<ol>
<li><code><var>b</var>[<var>i</var>] &gt;= 0</code> for all <code><var>i</var></code> in the range <code>[0, Rank)</code>.</li>
<li>The product of <code><var>b</var>[<var>i</var>]</code> for all <code><var>i</var></code> in the range <code>[0, Rank)</code> is less than or equal to <code>numeric_limits&lt;ptrdiff_t&gt;::max()</code>.</li>
</ol>
<p>
Otherwise, the behavior is undefined.
</p>

</blockquote>


<h3><a name="coord.bounds.cnstr">20.6.3.2 Construction [coord.bounds.cnstr]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr bounds() noexcept;</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
Zero-initializes each component.
</p>
</blockquote>

<p>
<code>constexpr bounds(value_type <var>v</var>);</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
Initializes the 0<sup>th</sup> component of <code>*this</code> with <code><var>v</var></code>.
</p>
<p>
<i>Remarks:</i>
This function shall not participate in overload resolution unless <code>Rank</code> is 1.
</p>
</blockquote>

<p>
<code>constexpr bounds(initializer_list&lt;value_type&gt; <var>il</var>);</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
For all <var>i</var> in the range <code>[0, Rank)</code>, initializes the <var>i<sup>th</sup></var> component of <code>*this</code> with <code>*(<var>il</var>.begin() + <var>i</var>)</code>.
</p>
<p>
<i>Remarks:</i>
This function shall not participate in overload resolution unless <code><var>il</var>.size()</code> is <code>Rank</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.bounds.eq">20.6.3.3 Equality [coord.bounds.eq]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr bool operator==(const bounds& <var>rhs</var>) const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>true</code> if <code>(*this)[<var>i</var>] == <var>rhs</var>[<var>i</var>]</code> for all <code><var>i</var></code> in the range <code>[0, Rank)</code>, otherwise <code>false</code>.
</p>
</blockquote>

<p>
<code>constexpr bool operator!=(const bounds& <var>rhs</var>) const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>!(*this == <var>rhs</var>)</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.bounds.obs">20.6.3.4 Observers [coord.bounds.obs]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr size_type size() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
The product of all components of <code>*this</code>.
</p>
</blockquote>

<p>
<code>constexpr bool contains(const index&lt;Rank&gt;& <var>idx</var>) const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>true</code> if <code>0 <= <var>idx</var>[<var>i</var>]</code> and <code><var>idx</var>[<var>i</var>] &lt; (*this)[<var>i</var>]</code> for all <code><var>i</var></code> in the range <code>[0, Rank)</code>, otherwise <code>false</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.bounds.iter">20.6.3.5 Iterators [coord.bounds.iter]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>bounds_iterator&lt;Rank&gt; begin() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
A <code>bounds_iterator</code> referring to the initial element of the space defined by <code>*this</code>.
</p>
</blockquote>

<p>
<code>bounds_iterator&lt;Rank&gt; end() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
A <code>bounds_iterator</code> which is the past-the-end iterator for the space defined by <code>*this</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.bounds.cmpt">20.6.3.6 Component access [coord.bounds.cmpt]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr reference operator[](size_type <var>n</var>);</code><br>
<code>constexpr const_reference operator[](size_type <var>n</var>) const;</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code><var>n</var> < Rank</code>.
</p>
<p>
<i>Returns:</i>
A reference to the <code><var>n</var></code>th component of <code>*this</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.bounds.arith">20.6.3.7 Arithmetic [coord.bounds.arith]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr bounds operator+(const index&lt;Rank&gt;& <var>rhs</var>) const;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>bounds&lt;Rank&gt;{*this} += <var>rhs</var></code>.
</p>
</blockquote>

<p>
<code>constexpr bounds operator-(const index&lt;Rank&gt;& <var>rhs</var>) const;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>bounds&lt;Rank&gt;{*this} += -<var>rhs</var></code>.
</p>
</blockquote>

<p>
<code>constexpr bounds& operator+=(const index&lt;Rank&gt;& <var>rhs</var>);</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
For all <var>i</var> in the range <code>[0, Rank)</code>, adds the <var>i<sup>th</sup></var> component of <code><var>rhs</var></code> to the <var>i<sup>th</sup></var> component of <code>*this</code> and stores the sum in the <var>i<sup>th</sup></var> component of <code>*this</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<code>constexpr bounds& operator-=(const index&lt;Rank&gt;& <var>rhs</var>);</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>*this += -rhs</code>.
</p>
</blockquote>

<p>
<code>template &lt;class ArithmeticType&gt; constexpr bounds operator*(ArithmeticType <var>v</var>) const;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>bounds&lt;Rank&gt;{*this} *= <var>v</var></code>.
</p>
</blockquote>

<p>
<code>template &lt;class ArithmeticType&gt; constexpr bounds operator/(ArithmeticType <var>v</var>) const;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>bounds&lt;Rank&gt;{*this} /= <var>v</var></code>.
</p>
</blockquote>

<p>
<code>template &lt;class ArithmeticType&gt; constexpr bounds& operator*=(ArithmeticType <var>v</var>);</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
For all <var>i</var> in the range <code>[0, Rank)</code>, multiplies the <var>i<sup>th</sup></var> component of <code>*this</code> by <code><var>v</var></code> and stores the product in the <var>i<sup>th</sup></var> component of <code>*this</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<code>template &lt;class ArithmeticType&gt; constexpr bounds& operator/=(ArithmeticType <var>v</var>);</code>
</p>

<blockquote>
<p>
<i>Effects:</i>
For all <var>i</var> in the range <code>[0, Rank)</code>, divides the <var>i<sup>th</sup></var> component of <code>*this</code> by <code><var>v</var></code> and stores the quotient in the <var>i<sup>th</sup></var> component of <code>*this</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<pre><code>template &lt;int Rank&gt;
  constexpr bounds&lt;Rank&gt; operator+(const index&lt;Rank&gt;& <var>lhs</var>, const bounds&lt;Rank&gt;& <var>rhs</var>);</code></pre>

<blockquote>
<p>
<i>Returns:</i>
<code>bounds&lt;Rank&gt;{<var>rhs</var>} += <var>lhs</var></code>.
</p>
</blockquote>

<p>
<pre><code>template &lt;class ArithmeticType, int Rank&gt;
  constexpr bounds&lt;Rank&gt; operator*(ArithmeticType <var>v</var>, const bounds&lt;Rank&gt;& <var>rhs</var>);</code></pre>

<blockquote>
<p>
<i>Returns:</i>
<code>bounds&lt;Rank&gt;{<var>rhs</var>} *= <var>v</var></code>.
</p>
</blockquote>

</blockquote>


<h3><a name="coord.bounds.iterator">20.6.4 Class template <code>bounds_iterator</code> [coord.bounds.iterator]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">
<pre><code>
namespace std {
  template &lt;int Rank&gt;
  class bounds_iterator
  {
  public:
    using iterator_category = random_access_iterator_tag;
    using value_type        = index&lt;Rank&gt;;
    using difference_type   = ptrdiff_t;
    using pointer           = <em>unspecified</em>;   // See [coord.bounds.iterator.require]
    using reference         = const index&lt;Rank&gt;;

    bool operator==(const bounds_iterator& <var>rhs</var>) const;
    bool operator!=(const bounds_iterator& <var>rhs</var>) const;
    bool operator&lt;(const bounds_iterator& <var>rhs</var>) const;
    bool operator<=(const bounds_iterator& <var>rhs</var>) const;
    bool operator>(const bounds_iterator& <var>rhs</var>) const;
    bool operator>=(const bounds_iterator& <var>rhs</var>) const;

    bounds_iterator& operator++();
    bounds_iterator  operator++(int);
    bounds_iterator& operator--();
    bounds_iterator  operator--(int);

    bounds_iterator  operator+(difference_type <var>n</var>) const;
    bounds_iterator& operator+=(difference_type <var>n</var>);
    bounds_iterator  operator-(difference_type <var>n</var>) const;
    bounds_iterator& operator-=(difference_type <var>n</var>);

    difference_type  operator-(const bounds_iterator& <var>rhs</var>) const;
    
    reference operator*() const;
    pointer   operator->() const;
    reference operator[](difference_type <var>n</var>) const;

  private:
    bounds&lt;Rank&gt; bnd_;  // exposition only
    index&lt;Rank&gt;  idx_;  // exposition only
  };
}
</code></pre>
</blockquote>


<h3><a name="coord.bounds.iterator.require">20.6.4.1 General requirements [coord.bounds.iterator.require]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
If <code>Rank</code> is less than 1 the program is ill-formed.
</p>

<p>
<code>pointer</code> shall be an unspecified type such that for a <code>bounds_iterator <var>it</var></code> the expression <code><var>it</var>->E</code> is equivalent to <code>(*<var>it</var>).E</code> and that for an object <code><var>p</var></code> of type <code>pointer</code> the expression <code><var>p</var>->E</code> yields the same result irrespective of whether the state of the <code>bounds_iterator</code> object has changed or its lifetime has ended.
</p>

</blockquote>


<h3><a name="coord.bounds.iterator.func">20.6.4.2 Functions [coord.bounds.iterator.func]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">
<p>
Unless otherwise specified below, the member functions of <code>bounds_iterator</code> adhere to the operational semantics in Tables 107, 109, 110, and 111.
</p>

<p>
<code>bool operator==(const bounds_iterator& <var>rhs</var>) const;</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code>*this</code> and <code><var>rhs</var></code> are iterators over the same <code>bounds</code> object.
</p>
<p>
<i>Returns:</i>
<code>idx_ == <var>rhs</var>.idx_</code>.
</p>
</blockquote>

<p>
<code>bounds_iterator& operator++();</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code>*this</code> is not the past-the-end iterator.
</p>
<p>
<i>Effects:</i>
Equivalent to:
<blockquote><pre><code>
for(auto i = Rank - 1; i >= 0; --i)
{
  if(++idx_[i] &lt; bnd_[i])
    return;
  idx_[i] = 0;
}
idx_ = <em>implementation-defined past-the-end value</em>;
</code></pre></blockquote>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
<p>
<i>[Note:</i>
The effective iteration order is congruent with iterating over a multidimensional array starting with the least significant dimension.
&mdash;<i>end note</i>]
</p>
</blockquote>

<p>
<code>bounds_iterator& operator--();</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
There exists a <code>bounds_iterator&lt;Rank&gt; <var>it</var></code> such that <code>*this == ++<var>it</var></code>.
</p>
<p>
<i>Effects:</i>
<code>*this = <var>it</var></code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
</blockquote>

<p>
<code>reference operator*() const;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>idx_</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="containers">Chapter 23 Containers library [containers]</a></h3>

<p>
Edit within paragraph 2 as follows.
</p>

<blockquote class="std">
<p>
The following subclauses describe container requirements,<del> and</del> components for sequence containers and associative containers,<ins> and generalized views,</ins> as summarized in Table 95.
</p>
</blockquote>

<p>
Add a row to table 95 as follows.
</p>

<blockquote class="std">
<table>
<caption>Table 95: Containers library summary</caption>
<tbody>
<tr><th>Subclause</th><th>Header(s)</th></tr>
<tr><td valign=top>23.2 Requirements</td>
<td></td></tr>
<tr><td valign=top>23.3 Sequence containers</td>
<td><code>&lt;array&gt;<br>
&lt;deque&gt;<br>
&lt;forward_list&gt;<br>
&lt;list&gt;<br>
&lt;vector&gt;</code></td></tr>
<tr><td valign=top>23.4 Associative containers</td>
<td><code>&lt;map&gt;<br>
&lt;set&gt;</code></td></tr>
<tr><td valign=top>23.5 Unordered associative containers</td>
<td><code>&lt;unordered_map&gt;<br>
&lt;unordered_set&gt;</code></td></tr>
<tr><td valign=top>23.6 Container adaptors</td>
<td><code>&lt;queue&gt;<br>
&lt;stack&gt;</code></td></tr>
<tr><td valign=top><ins>23.7 Generalized views</ins></td>
<td><ins><code>&lt;array_view&gt;</code></ins></td></tr>
</tbody>
</table>
</blockquote>


<h3><a name="generalized.views">23.7 Generalized views [generalized.views]</a></h3>

<p>
Add a new section after the <code>container.adaptors</code> section.
</p>


<h3><a name="generalized.views.general">23.7.1 In general [generalized.views.general]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">
<p>
The header <code>&lt;array_view&gt;</code> defines the <em>generalized views</em> <code>array_view</code> and <code>strided_array_view</code>.
</p>
<p>
An <code>array_view</code> is a potentially multidimensional view on a sequence of objects of a uniform type contiguous in the least significant dimension and uniformly strided in other dimensions.
</p>
<p>
A <code>strided_array_view</code> is a potentially multidimensional view on a sequence of objects of a uniform type uniformly strided in all dimensions.
</p>
</blockquote>

<p>
Add a new synopsis:
</p>

<blockquote class="stdins">
<p>
<b>Header <code>&lt;array_view&gt;</code> synopsis</b>
</p>

<pre><code>
namespace std {
  // [arrayview], class template array_view
  template &lt;class T, int Rank&gt; class array_view;

  // [stridedarrayview], class template strided_array_view
  template &lt;class T, int Rank&gt; class strided_array_view;
}
</code></pre>
</blockquote>


<h3><a name="generalized.views.require">23.7.2 Generalized view types requirements [generalized.views.require]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">
<p>
<code>T</code> shall be an object type. <i>[Note:</i> The type can be cv-qualified, resulting in semantics similar to the semantics of a pointer to cv-qualified type. &mdash;<i>end note</i>]
</p>
<p>
If <code>Rank</code> is less than 1 the program is ill-formed.
</p>
<p>
Any operation that invalidates a pointer in the range on which a view was created invalidates pointers and references returned from the view's functions.
</p>
<p>
Define <code>VIEW_ACCESS(data, idx, stride, rank)</code> as <code>*(data + <var>offset</var>)</code> where [<i>Editorial note:</i> The following expression should be formatted as LaTeX code &mdash;<i>end note</i>] <code>offset = \sum_{i=0}^{rank - 1} idx_i \times stride_i</code>, <var>idx<sub>i</sub></var> = <code><var>idx</var>[</code><var>i</var><code>]</code>, and <var>stride<sub>i</sub></var> = <code>stride[</code><var>i</var><code>]</code>.
</p>
</blockquote>


<h3><a name="arrayview">23.7.3 Class template <code>array_view</code> [arrayview]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">
<pre><code>
namespace std {
  template &lt;class T, int Rank = 1&gt;
  class array_view {
  public:
    // constants and types
    static constexpr int rank = Rank;
    using index_type          = index&lt;Rank&gt;;
    using bounds_type         = bounds&lt;Rank&gt;;
    using size_type           = size_t;
    using value_type          = T;
    using pointer             = T*;
    using reference           = T&;

    // [arrayview.cons], array_view constructors, copy, and assignment
    constexpr array_view() noexcept;

    template &lt;class Viewable&gt;
      constexpr explicit array_view(Viewable&& <var>vw</var>);
    template &lt;class ArrayType&gt;
      constexpr explicit array_view(ArrayType& <var>arr</var>) noexcept;

    template &lt;class U&gt;
      constexpr array_view(const array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;

    template &lt;class Viewable&gt;
      constexpr array_view(bounds_type <var>bounds</var>, Viewable&& <var>vw</var>);
    constexpr array_view(bounds_type <var>bounds</var>, pointer <var>ptr</var>) noexcept;

    template &lt;class U&gt;
      constexpr array_view& operator=(const array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;

    // [arrayview.obs], array_view observers
    constexpr bounds_type bounds() const noexcept;
    constexpr size_type   size() const noexcept;
    constexpr index_type  stride() const noexcept;
    constexpr pointer     data() const noexcept;

    // [arrayview.elem], array_view element access
    constexpr reference operator[](const index_type& <var>idx</var>) const;

    // [arrayview.subview], array_view slicing and sectioning
    constexpr array_view&lt;T, Rank - 1&gt;
      operator[](ptrdiff_t <var>slice</var>) const;      // only if Rank > 1
    constexpr strided_array_view&lt;T, Rank&gt;
      section(const index_type& <var>origin</var>, const bounds_type& <var>section_bnd</var>) const;
    constexpr strided_array_view&lt;T, Rank&gt;
      section(const index_type& <var>origin</var>) const;
  };
}
</code></pre>
</blockquote>


<h3><a name="arrayview.cons">23.7.3.1 <code>array_view</code> constructors, copy, and assignment [arrayview.cons]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
For the purpose of this subclause, <em><code>Viewable</code> on <code>U</code></em> is a type satisfying the requirements set out in Table 104. In these definitions, let <code>v</code> denote an expression of <code>Viewable</code> on <code>U</code> type.
</p>

<table>
<caption>Table 104: <code>Viewable</code> on <code>U</code> requirements</caption>
<tbody>
<tr><th>Expression</th><th>Return type</th><th>Operational semantics</th></tr>
<tr><td><code>v.size()</code></td>
<td>Convertible to <code>ptrdiff_t</code></td>
<td></td></tr>
<tr><td><code>v.data()</code></td>
<td>Convertible to <code>U*</code></td>
<td><code>static_cast&lt;U*&gt;(v.data())</code> points to a contiguous sequence of at least <code>v.size()</code> objects of (possibly cv-qualified) type <code>remove_cv_t&lt;U&gt;</code>.</td></tr>
</tbody>
</table>

<p>
<code>constexpr array_view() noexcept;</code>
</p>

<blockquote>
<p>
<i>Postconditions:</i>
<code>bounds().size() == 0</code> and <code>data() == nullptr</code>.
</p>
</blockquote>

<p>
<pre><code>template &lt;class Viewable&gt;
  constexpr explicit array_view(Viewable&& <var>vw</var>);</code></pre>

<blockquote>
<p>
<i>Requires:</i>
<code><var>vw</var></code> shall satisfy the requirements of <code>Viewable</code> on <code>T</code>.
</p>
<p>
<i>Postconditions:</i>
<code>bounds().size() == <var>vw</var>.size()</code> and <code>data() == <var>vw</var>.data()</code>.
</p>
<p>
<i>Remarks:</i>
This constructor shall not participate in overload resolution unless <code>Rank</code> is 1 and <code>Viewable</code> satisfies the syntactic requirements set in Table 104 for <code>Viewable</code> on <code>T</code>.
</p>
</blockquote>

<p>
<pre><code>template &lt;class ArrayType&gt;
  constexpr explicit array_view(ArrayType& <var>arr</var>) noexcept;</code></pre>

<blockquote>
<p>
<i>Postconditions:</i>
<code>bounds()[<var>i</var>] == extent&lt;ArrayType, <var>i</var>&gt;::value</code> for all <code><var>i</var></code> in the range <code>[0, Rank)</code>, and <code>data()</code> is equal to the address of the initial element in <code><var>arr</var></code>.
</p>
<p>
<i>Remarks:</i>
This constructor shall not participate in overload resolution unless <code>is_convertible&lt;add_pointer_t&lt;remove_all_extents_t&lt;ArrayType&gt;&gt;, pointer&gt;::value</code> is <code>true</code> and <code>Rank&lt;ArrayType&gt;::value == Rank</code>.
</p>
<p>
<i>[Example:</i>
<pre><code>
char a[3][1][4] {{{'H', 'i'}}};
auto av = array_view&lt;char, 3&gt;{a};
// the following assertions hold:
assert((av.bounds() == bounds<3>{3, 1, 4}));
assert((av[{0, 0, 0}] == 'H'));
</code></pre>
<p>
&mdash;<i>end example</i>]
</p>
</blockquote>

<p>
<pre><code>template &lt;class U&gt;
  constexpr array_view(const array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;</code></pre>

<blockquote>
<p>
<i>Postconditions:</i>
<code>bounds() == <var>rhs</var>.bounds()</code> and <code>data() == <var>rhs</var>.data()</code>.
</p>
<p>
<i>Remarks:</i>
This constructor shall not participate in overload resolution unless <code>is_convertible&lt;add_pointer_t&lt;U&gt;, pointer&gt;::value</code> is <code>true</code>.
</p>
</blockquote>

<p>
<pre><code>template &lt;class Viewable&gt;
  constexpr array_view(bounds_type <var>bounds</var>, Viewable&& <var>vw</var>);</code></pre>

<blockquote>
<p>
<i>Requires:</i>
<code><var>bounds</var>.size() <= <var>vw</var>.size()</code>.
</p>
<p>
<i>Postconditions:</i>
<code>bounds() == <var>bounds</var></code> and <code>data() == <var>vw</var>.data()</code>.
</p>
<p>
<i>Remarks:</i>
This constructor shall not participate in overload resolution unless <code>Viewable</code> satisfies the syntactic requirements set in Table 104 for <code>Viewable</code> on <code>T</code>.
</p>
<p>
<i>[Note:</i>
This constructor may be used to create an <code>array_view</code> with a different rank and/or bounds than the original <code>array_view</code>, i.e. reshape the view.
&mdash;<i>end note</i>]
</p>
</blockquote>

<p>
<pre><code>constexpr array_view(bounds_type <var>bounds</var>, pointer <var>ptr</var>) noexcept;</code></pre>

<blockquote>
<p>
<i>Requires:</i>
The expression <code><var>ptr</var>[<var>bounds</var>.size() - 1]</code> shall be well formed and shall have well defined behavior.
</p>
<p>
<i>Postconditions:</i>
<code>bounds() == <var>bounds</var></code> and <code>data() == <var>ptr</var></code>.
</p>
</blockquote>

<p>
<pre><code>template &lt;class U&gt;
  constexpr array_view& operator=(const array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;</code></pre>

<blockquote>
<p>
<i>Postconditions:</i>
<code>bounds() == <var>rhs</var>.bounds</code> and <code>data() == <var>rhs</var>.data()</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
<p>
<i>Remarks:</i>
This constructor shall not participate in overload resolution unless <code>is_convertible&lt;add_pointer_t&lt;U&gt;, pointer&gt;::value</code> is <code>true</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="arrayview.obs">23.7.3.2 <code>array_view</code> observers [arrayview.obs]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr bounds_type bounds() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
The bounds of the view.
</p>
</blockquote>

<p>
<code>constexpr size_type size() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>bounds().size()</code>.
</p>
</blockquote>

<p>
<code>constexpr index_type stride() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
An <code>index_type</code> such that:
<ul>
<li><code>stride()[<var>i</var>] == 1</code>, where <code><var>i</var> == Rank - 1</code>.</li>
<li><code>stride()[<var>i</var>] == stride()[<var>i</var> + 1] * bounds()[<var>i</var> + 1]</code>, where <code>0 &lt;= <var>i</var></code> and <code><var>i</var> &lt; Rank - 1</code>.</li>
</ul>
</blockquote>

<p>
<code>constexpr pointer data() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
A pointer to the contiguous sequence on which the view was created.
</p>
</blockquote>

</blockquote>


<h3><a name="arrayview.elem">23.7.3.3 <code>array_view</code> element access [arrayview.elem]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr reference operator[](const index_type& <var>idx</var>) const;</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code>bounds().contains(<var>idx</var>) == true</code>.
</p>
<p>
<i>Returns:</i>
<code>VIEW_ACCESS(data(), <var>idx</var>, stride(), Rank)</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="arrayview.subview">23.7.3.4 <code>array_view</code> slicing and sectioning [arrayview.subview]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<pre><code>constexpr array_view&lt;T, Rank - 1&gt;
  operator[](ptrdiff_t <var>slice</var>) const;</code></pre>

<blockquote>
<p>
<i>Requires:</i>
<code><var>slice</var> &lt; bounds()[0]</code>.
</p>
<p>
<i>Returns:</i>
A view such that the initial element is <code>(*this)[{<var>slice</var>, 0, 0, …, 0}]</code>, and the bounds are <code>{<var>bounds<sub>1</sub></var>, <var>bounds<sub>2</sub></var>, …, <var>bounds<sub>Rank - 1</sub></var>}</code>, where <code><var>bounds<sub>i</sub></var> = bounds()[<var>i</var>]</code>.
</p>
<p>
<i>Remarks:</i>
This function shall not participate in overload resolution unless <code>Rank &gt; 1</code>.
</p>
</blockquote>

<p>
<pre><code>constexpr strided_array_view&lt;T, Rank&gt;
  section(const index_type& <var>origin</var>, const bounds_type& <var>section_bnd</var>) const;</code></pre>

<blockquote>
<p>
<i>Requires:</i>
<code>bounds().contains(<var>origin</var> + <var>idx</var>) == true</code> for any <code>index&lt;Rank&gt; <var>idx</var></code> such that <code><var>section_bnd</var>.contains(<var>idx</var>) == true</code>.
</p>
<p>
<i>Returns:</i>
A strided view such that the initial element is <code>(*this)[<var>origin</var>]</code>, the stride is <code>stride()</code>, and the bounds are <code><var>section_bnd</var></code>.
</p>
</blockquote>

<p>
<pre><code>constexpr strided_array_view&lt;T, Rank&gt;
  section(const index_type& <var>origin</var>) const;</code></pre>

<blockquote>
<p>
<i>Requires:</i>
<code>bounds().contains(<var>origin</var> + <var>idx</var>) == true</code> for any <code>index&lt;Rank&gt; <var>idx</var></code> such that <code>(bounds() - <var>origin</var>).contains(<var>idx</var>) == true</code>.
</p>
<p>
<i>Returns:</i>
A strided view such that the initial element is <code>(*this)[<var>origin</var>]</code>, the stride is <code>stride()</code>, and the bounds are <code>(bounds() - <var>origin</var>)</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="stridedarrayview">23.7.4 Class template <code>strided_array_view</code> [stridedarrayview]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">
<pre><code>
namespace std {
  template &lt;class T, int Rank = 1&gt;
  class strided_array_view {
  public:
    // constants and types
    static constexpr int rank = Rank;
    using index_type          = index&lt;Rank&gt;;
    using bounds_type         = bounds&lt;Rank&gt;;
    using size_type           = size_t;
    using value_type          = T;
    using pointer             = T*;
    using reference           = T&;

    // [stridedarrayview.cons], strided_array_view constructors, copy, and assignment
    constexpr strided_array_view() noexcept;

    template &lt;class U&gt;
      constexpr strided_array_view(const array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;
    template &lt;class U&gt;
      constexpr strided_array_view(const strided_array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;

    constexpr strided_array_view(bounds_type <var>bounds</var>, index_type <var>stride</var>, pointer <var>ptr</var>);

    template &lt;class U&gt;
      constexpr strided_array_view& operator=(const strided_array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;

    // [stridedarrayview.obs], strided_array_view observers
    constexpr bounds_type bounds() const noexcept;
    constexpr size_type   size() const noexcept;
    constexpr index_type  stride() const noexcept;

    // [stridedarrayview.elem], strided_array_view element access
    constexpr reference operator[](const index_type& <var>idx</var>) const;

    // [stridedarrayview.subview], strided_array_view slicing and sectioning
    constexpr strided_array_view&lt;T, Rank - 1&gt;
      operator[](ptrdiff_t <var>slice</var>) const;      // only if Rank > 1
    constexpr strided_array_view&lt;T, Rank&gt;
      section(const index_type& <var>origin</var>, const bounds_type& <var>section_bnd</var>) const;
    constexpr strided_array_view&lt;T, Rank&gt;
      section(const index_type& <var>origin</var>) const;

  private:
    pointer data_;  // exposition only
  };
}
</code></pre>
</blockquote>


<h3><a name="stridedarrayview.cons">23.7.4.1 <code>strided_array_view</code> constructors, copy, and assignment [stridedarrayview.cons]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr strided_array_view() noexcept;</code>
</p>

<blockquote>
<p>
<i>Postconditions:</i>
<code>bounds().size() == 0</code>, <code>stride() == index_type{}</code>, and <code>data_ == nullptr</code>.
</p>
</blockquote>

<p>
<pre><code>template &lt;class U&gt;
  constexpr strided_array_view(const array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;
template &lt;class U&gt;
  constexpr strided_array_view(const strided_array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;</code></pre>

<blockquote>
<p>
<i>Postconditions:</i>
<code>bounds() == <var>rhs</var>.bounds()</code>, <code>stride() == <var>rhs</var>.stride()</code>, and correspondingly: <code>data_ == <var>rhs</var>.data()</code>, <code>data_ == <var>rhs</var>.data_</code>.
</p>
<p>
<i>Remarks:</i>
This constructor shall not participate in overload resolution unless <code>is_convertible&lt;add_pointer_t&lt;U&gt;, pointer&gt;::value</code> is <code>true</code>.
</p>
</blockquote>

<p>
<pre><code>constexpr strided_array_view(bounds_type <var>bounds</var>, index_type <var>stride</var>, pointer <var>ptr</var>);</code></pre>

<blockquote>
<p>
<i>Requires:</i>
For any <code>index&lt;Rank&gt; <var>idx</var></code> such that <code><var>bounds</var>.contains(<var>idx</var>)</code>:
<ul>
<li>The expression <code><var>idx</var>[<var>i</var>] * <var>stride</var>[<var>i</var>]</code> shall be well formed and shall have well defined behavior [<i>Note:</i> It follows that the result does not overflow type <code>ptrdiff_t</code>. &mdash;<i>end note</i>] for all <var>i</var> in the range <code>[0, Rank)</code>.</li>
<li>The expression <code>VIEW_ACCESS(<var>ptr</var>, <var>idx</var>, <var>stride</var>, Rank)</code> shall be well formed and shall have well defined behavior.</li>
</ul>
<p>
<i>Postconditions:</i>
<code>bounds() == <var>bounds</var></code>, <code>stride() == <var>stride</var></code>, and <code>data_ == <var>ptr</var></code>.
</p>
</blockquote>

<p>
<pre><code>template &lt;class U&gt;
  constexpr strided_array_view& operator=(const strided_array_view&lt;U, Rank&gt;& <var>rhs</var>) noexcept;</code></pre>

<blockquote>
<p>
<i>Postconditions:</i>
<code>bounds() == <var>rhs</var>.bounds()</code>, <code>stride() == <var>rhs</var>.stride()</code>, and <code>data_ == <var>rhs</var>.data_</code>.
</p>
<p>
<i>Returns:</i>
<code>*this</code>.
</p>
<p>
<i>Remarks:</i>
This constructor shall not participate in overload resolution unless <code>is_convertible&lt;add_pointer_t&lt;U&gt;, pointer&gt;::value</code> is <code>true</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="stridedarrayview.obs">23.7.4.2 <code>strided_array_view</code> observers [stridedarrayview.obs]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr bounds_type bounds() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
The bounds of the view.
</p>
</blockquote>

<p>
<code>constexpr size_type size() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
<code>bounds().size()</code>.
</p>
</blockquote>

<p>
<code>constexpr index_type stride() const noexcept;</code>
</p>

<blockquote>
<p>
<i>Returns:</i>
The stride of the view.
</p>
</blockquote>

</blockquote>


<h3><a name="stridedarrayview.elem">23.7.4.3 <code>strided_array_view</code> element access [stridedarrayview.elem]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<code>constexpr reference operator[](const index_type& <var>idx</var>) const;</code>
</p>

<blockquote>
<p>
<i>Requires:</i>
<code>bounds().contains(<var>idx</var>) == true</code>.
</p>
<p>
<i>Returns:</i>
<code>VIEW_ACCESS(data_, <var>idx</var>, stride(), Rank)</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="stridedarrayview.subview">23.7.4.4 <code>strided_array_view</code> slicing and sectioning [stridedarrayview.subview]</a></h3>

<p>
Add a new section:
</p>

<blockquote class="stdins">

<p>
<pre><code>constexpr strided_array_view&lt;T, Rank - 1&gt;
  operator[](ptrdiff_t <var>slice</var>) const;</code></pre>

<blockquote>
<p>
<i>Requires:</i>
<code><var>slice</var> &lt; bounds()[0]</code>.
</p>
<p>
<i>Returns:</i>
A strided view such that the initial element is <code>(*this)[{<var>slice</var>, 0, 0, …, 0}]</code>, the bounds are <code>{<var>bounds<sub>1</sub></var>, <var>bounds<sub>2</sub></var>, …, <var>bounds<sub>Rank - 1</sub></var>}</code>, and the stride is <code>{<var>stride<sub>1</sub></var>, <var>stride<sub>2</sub></var>, …, <var>stride<sub>Rank - 1</sub></var>}</code> ; where <code><var>bounds<sub>i</sub></var> = bounds()[<var>i</var>]</code>, and <code><var>stride<sub>i</sub></var> = stride()[<var>i</var>]</code>.
</p>
<p>
<i>Remarks:</i>
This function shall not participate in overload resolution unless <code>Rank &gt; 1</code>.
</p>
</blockquote>

<p>
<pre><code>constexpr strided_array_view&lt;T, Rank&gt;
  section(const index_type& <var>origin</var>, const bounds_type& <var>section_bnd</var>) const;</code></pre>

<blockquote>
<p>
<i>Requires:</i>
<code>bounds().contains(<var>origin</var> + <var>idx</var>) == true</code> for any <code>index&lt;Rank&gt; <var>idx</var></code> such that <code><var>section_bnd</var>.contains(<var>idx</var>) == true</code>.
</p>
<p>
<i>Returns:</i>
A strided view such that the initial element is <code>(*this)[<var>origin</var>]</code>, the stride is <code>stride()</code>, and the bounds are <code><var>section_bnd</var></code>.
</p>
</blockquote>

<p>
<pre><code>constexpr strided_array_view&lt;T, Rank&gt;
  section(const index_type& <var>origin</var>) const;</code></pre>

<blockquote>
<p>
<i>Requires:</i>
<code>bounds().contains(<var>origin</var> + <var>idx</var>) == true</code> for any <code>index&lt;Rank&gt; <var>idx</var></code> such that <code>(bounds() - <var>origin</var>).contains(<var>idx</var>) == true</code>.
</p>
<p>
<i>Returns:</i>
A strided view such that the initial element is <code>(*this)[<var>origin</var>]</code>, the stride is <code>stride()</code>, and the bounds are <code>(bounds() - <var>origin</var>)</code>.
</p>
</blockquote>

</blockquote>


<h3><a name="iterator.range">24.7 range access [iterator.range]</a></h3>

<p>
Edit within paragraph 1 as follows.
</p>

<blockquote class="std">
<p>
In addition to being available via inclusion of the <code>&lt;iterator&gt;</code> header, the function templates in 24.7 are
available when any of the following headers are included: <code>&lt;array&gt;</code>,<ins> <code>&lt;coordinate&gt;</code>,</ins> <code>&lt;deque&gt;</code>, <code>&lt;forward_list&gt;</code>, <code>&lt;list&gt;</code>, <code>&lt;map&gt;</code>, <code>&lt;regex&gt;</code>, <code>&lt;set&gt;</code>, <code>&lt;string&gt;</code>, <code>&lt;unordered_map&gt;</code>, <code>&lt;unordered_set&gt;</code>, and <code>&lt;vector&gt;</code>.
</p>
</blockquote>


</body>
</html>
