1 <sect2 id=
"const_multi_array_ref">
2 <title><literal>const_multi_array_ref
</literal></title>
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
14 <title>Model Of.
</title>
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>.
22 Detailed descriptions are provided here only for operations that are
23 not described in the
<literal>multi_array
</literal> reference.
28 <title>Synopsis
</title>
34 template
<typename ValueType,
36 typename TPtr = const T*
>
37 class const_multi_array_ref {
40 typedef ValueType element;
41 typedef *unspecified* value_type;
42 typedef *unspecified* reference;
43 typedef *unspecified* const_reference;
44 typedef *unspecified* difference_type;
45 typedef *unspecified* iterator;
46 typedef *unspecified* const_iterator;
47 typedef *unspecified* reverse_iterator;
48 typedef *unspecified* const_reverse_iterator;
49 typedef multi_array_types::size_type size_type;
50 typedef multi_array_types::index index;
51 typedef multi_array_types::index_gen index_gen;
52 typedef multi_array_types::index_range index_range;
53 typedef multi_array_types::extent_gen extent_gen;
54 typedef multi_array_types::extent_range extent_range;
55 typedef *unspecified* storage_order_type;
58 template
<std::size_t Dims
> struct subarray;
59 template
<std::size_t Dims
> struct const_subarray;
60 template
<std::size_t Dims
> struct array_view;
61 template
<std::size_t Dims
> struct const_array_view;
66 template
<typename ExtentList
>
67 explicit const_multi_array_ref(TPtr data, const ExtentList& sizes,
68 const storage_order_type& store = c_storage_order());
69 explicit const_multi_array_ref(TPtr data, const extents_tuple& ranges,
70 const storage_order_type& store = c_storage_order());
71 const_multi_array_ref(const const_multi_array_ref& x);
72 ~const_multi_array_ref();
77 const_iterator begin() const;
78 const_iterator end() const;
79 const_reverse_iterator rbegin() const;
80 const_reverse_iterator rend() const;
83 size_type size() const;
84 size_type num_elements() const;
85 size_type num_dimensions() const;
88 template
<typename IndexList
>
89 const element& operator()(const IndexList& indices) const;
90 const_reference operator[](index i) const;
91 const_array_view
<Dims>::type operator[](const indices_tuple& r) const;
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;
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);
110 template
<typename SizeList
>
111 void reshape(const SizeList& sizes)
112 template
<typename BaseList
> void reindex(const BaseList& values);
113 void reindex(index value);
120 <title>Constructors
</title>
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>
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
139 <formalpara><title><literal>ExtentList
</literal> Requirements
</title>
141 <literal>ExtentList
</literal> must model
<ulink url=
"../../utility/Collection.html">Collection
</ulink>.
145 <formalpara><title>Preconditions
</title>
146 <para><literal>sizes.size() == NumDims;
</literal></para>
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>
159 <formalpara><title>Effects
</title>
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
175 <term><programlisting>
176 <![CDATA[const_multi_array_ref(const const_multi_array_ref& x);]]
>
177 </programlisting></term>
180 <title>Effects
</title>
181 <para>This constructs a shallow copy of
<literal>x
</literal>.