Brian Silverman | 6137817 | 2018-08-04 23:37:59 -0700 | [diff] [blame^] | 1 | <sect2 id="const_multi_array_ref"> |
| 2 | <title><literal>const_multi_array_ref</literal></title> |
| 3 | |
| 4 | <para> |
| 5 | <literal>const_multi_array_ref</literal> is a multi-dimensional container |
| 6 | adaptor. It provides the MultiArray interface over any contiguous |
| 7 | block of elements. <literal>const_multi_array_ref</literal> exports the |
| 8 | same interface as <literal>multi_array</literal>, with the exception |
| 9 | of the constructors. |
| 10 | </para> |
| 11 | |
| 12 | |
| 13 | <formalpara> |
| 14 | <title>Model Of.</title> |
| 15 | <para> |
| 16 | <literal>const_multi_array_ref</literal> models |
| 17 | <link linkend="MultiArray">MultiArray</link>, |
| 18 | <ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>. |
| 19 | and depending on the element type, it may also model |
| 20 | <ulink url="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</ulink> and <ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink>. |
| 21 | |
| 22 | Detailed descriptions are provided here only for operations that are |
| 23 | not described in the <literal>multi_array</literal> reference. |
| 24 | </para> |
| 25 | </formalpara> |
| 26 | |
| 27 | <formalpara> |
| 28 | <title>Synopsis</title> |
| 29 | |
| 30 | <programlisting> |
| 31 | < const; |
| 91 | const_array_view<Dims>::type operator[](const indices_tuple& r) const; |
| 92 | |
| 93 | // queries |
| 94 | const element* data() const; |
| 95 | const element* origin() const; |
| 96 | const size_type* shape() const; |
| 97 | const index* strides() const; |
| 98 | const index* index_bases() const; |
| 99 | const storage_order_type& storage_order() const; |
| 100 | |
| 101 | // comparators |
| 102 | bool operator==(const const_multi_array_ref& rhs); |
| 103 | bool operator!=(const const_multi_array_ref& rhs); |
| 104 | bool operator<(const const_multi_array_ref& rhs); |
| 105 | bool operator>(const const_multi_array_ref& rhs); |
| 106 | bool operator>=(const const_multi_array_ref& rhs); |
| 107 | bool operator<=(const const_multi_array_ref& rhs); |
| 108 | |
| 109 | // modifiers: |
| 110 | template <typename SizeList> |
| 111 | void reshape(const SizeList& sizes) |
| 112 | template <typename BaseList> void reindex(const BaseList& values); |
| 113 | void reindex(index value); |
| 114 | }; |
| 115 | ]]> |
| 116 | </programlisting> |
| 117 | </formalpara> |
| 118 | |
| 119 | <formalpara> |
| 120 | <title>Constructors</title> |
| 121 | |
| 122 | <variablelist> |
| 123 | <varlistentry> |
| 124 | <term><programlisting>template <typename ExtentList> |
| 125 | explicit const_multi_array_ref(TPtr data, |
| 126 | const ExtentList& sizes, |
| 127 | const storage_order& store = c_storage_order()); |
| 128 | </programlisting></term> |
| 129 | <listitem> |
| 130 | |
| 131 | <para> |
| 132 | This constructs a <literal>const_multi_array_ref</literal> using the specified |
| 133 | parameters. <literal>sizes</literal> specifies the shape of the |
| 134 | constructed <literal>const_multi_array_ref</literal>. <literal>store</literal> |
| 135 | specifies the storage order or layout in memory of the array |
| 136 | dimensions. |
| 137 | </para> |
| 138 | |
| 139 | <formalpara><title><literal>ExtentList</literal> Requirements</title> |
| 140 | <para> |
| 141 | <literal>ExtentList</literal> must model <ulink url="../../utility/Collection.html">Collection</ulink>. |
| 142 | </para> |
| 143 | </formalpara> |
| 144 | |
| 145 | <formalpara><title>Preconditions</title> |
| 146 | <para><literal>sizes.size() == NumDims;</literal></para> |
| 147 | </formalpara> |
| 148 | |
| 149 | </listitem> |
| 150 | </varlistentry> |
| 151 | |
| 152 | <varlistentry> |
| 153 | <term> |
| 154 | <programlisting><![CDATA[explicit const_multi_array_ref(TPtr data, |
| 155 | extent_gen::gen_type<NumDims>::type ranges, |
| 156 | const storage_order& store = c_storage_order());]]> |
| 157 | </programlisting></term> |
| 158 | <listitem> |
| 159 | <formalpara><title>Effects</title> |
| 160 | <para> |
| 161 | This constructs a <literal>const_multi_array_ref</literal> using the specified |
| 162 | parameters. <literal>ranges</literal> specifies the shape and |
| 163 | index bases of the constructed const_multi_array_ref. It is the result of |
| 164 | <literal>NumDims</literal> chained calls to |
| 165 | <literal>extent_gen::operator[]</literal>. <literal>store</literal> |
| 166 | specifies the storage order or layout in memory of the array |
| 167 | dimensions. |
| 168 | </para> |
| 169 | </formalpara> |
| 170 | </listitem> |
| 171 | </varlistentry> |
| 172 | |
| 173 | |
| 174 | <varlistentry> |
| 175 | <term><programlisting> |
| 176 | <![CDATA[const_multi_array_ref(const const_multi_array_ref& x);]]> |
| 177 | </programlisting></term> |
| 178 | <listitem> |
| 179 | <formalpara> |
| 180 | <title>Effects</title> |
| 181 | <para>This constructs a shallow copy of <literal>x</literal>. |
| 182 | </para></formalpara> |
| 183 | </listitem> |
| 184 | </varlistentry> |
| 185 | |
| 186 | </variablelist> |
| 187 | |
| 188 | </formalpara> |
| 189 | |
| 190 | </sect2> |