Compare commits

..

16 Commits

Author SHA1 Message Date
Andrey Semashev
a31951fd81 Merge pull request #40 from ivanpanch/patch-1
Fix documentation mistakes
2026-02-06 13:48:58 +03:00
Andrey Semashev
88a22c7e11 Merge pull request #37 from Lastique/feature/add_enable_if_convertible_include
Add missing includes, qualify iterators namespace
2026-02-06 13:45:46 +03:00
Marshall Clow
15e5bd8665 Merge pull request #41 from GreenGary/develop
Fix #39 Replace deprecated boost::array::assign with boost::array::fill
2026-02-05 17:38:16 -08:00
Marshall Clow
2c89ceff08 Merge pull request #42 from Lastique/feature/remove_static_assert
Remove dependencies on Boost.StaticAssert
2026-02-05 17:37:33 -08:00
Andrey Semashev
e703d395d3 Remove dependencies on Boost.StaticAssert.
Boost.StaticAssert has been merged into Boost.Config, so remove
the dependency.
2026-01-22 20:30:02 +03:00
RKR6
03710c74c7 Fix #39 Replace deprecated boost::array::assign with boost::array::fill to avoid warnings in MSVC 2025-10-29 16:51:16 +01:00
ivanpanch
34c8a706f4 Update bbref.xml 2025-09-10 09:07:00 +02:00
ivanpanch
99aa01c55f Update const_multi_array_ref.xml 2025-09-10 09:04:04 +02:00
ivanpanch
6471d119d7 Update multi_array_ref.xml 2025-09-10 09:02:53 +02:00
ivanpanch
3abaddaada Update multi_array.xml 2025-09-10 09:01:59 +02:00
ivanpanch
8b1e05a1d0 Update bbref.xml 2025-09-10 09:00:50 +02:00
ivanpanch
00a17f84da Update MultiArray.xml 2025-09-10 09:00:06 +02:00
ivanpanch
a9f14e79f9 Update reference.html 2025-09-09 13:28:07 -07:00
ivanpanch
9e2150f864 Update user.html 2025-09-09 12:19:41 -07:00
René Ferdinand Rivera Morell
333c304d84 Add support for modular build structure. (#36)
* Make the library modular usable.

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Add requires-b2 check to top-level build file.

* Bump B2 require to 5.2

* Change all <source> references to <library>.

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Switch to /boost/test//included target for header only mode of Boost.Test.

* Update build deps.

* Add GHA CI with simpler working one based on alandefreitas/cpp-actions utilities.

* Move project global include to target local include.

* Only msvc gets minor version tests.

* Remove GHA CI to undo move to cpp-actions.
2025-06-26 02:51:42 +03:00
Andrey Semashev
d699673b1f Add missing includes, qualify iterators namespace.
Add missing includes, in particular for Boost.Iterator components.
Specifically, enable_if_convertible is now defined in a separate header.

Also qualify iterators namespace for Boost.Iterator components.
2025-02-08 18:41:52 +03:00
14 changed files with 93 additions and 60 deletions

View File

@@ -22,7 +22,6 @@ target_link_libraries(boost_multi_array
Boost::functional Boost::functional
Boost::iterator Boost::iterator
Boost::mpl Boost::mpl
Boost::static_assert
Boost::type_traits Boost::type_traits
) )

29
build.jam Normal file
View File

@@ -0,0 +1,29 @@
# Copyright René Ferdinand Rivera Morell 2023-2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
constant boost_dependencies :
/boost/array//boost_array
/boost/assert//boost_assert
/boost/concept_check//boost_concept_check
/boost/config//boost_config
/boost/core//boost_core
/boost/functional//boost_functional
/boost/iterator//boost_iterator
/boost/mpl//boost_mpl
/boost/type_traits//boost_type_traits ;
project /boost/multi_array
;
explicit
[ alias boost_multi_array : : :
: <include>include <library>$(boost_dependencies) ]
[ alias all : boost_multi_array test ]
;
call-if : boost-library multi_array
;

View File

@@ -58,7 +58,7 @@ containers. It specifies operations for accessing elements,
traversing containers, and creating views traversing containers, and creating views
of array data. of array data.
MultiArray defines MultiArray defines
a flexible memory model that accomodates a flexible memory model that accommodates
a variety of data layouts. a variety of data layouts.
</p><p> </p><p>
At each level (or dimension) of a MultiArray's At each level (or dimension) of a MultiArray's
@@ -145,7 +145,7 @@ base. Note that since positive index bases are
possible, the origin need not exist in order to determine the location possible, the origin need not exist in order to determine the location
in memory of the MultiArray's elements. in memory of the MultiArray's elements.
The strides determine how index values are mapped to memory offsets. The strides determine how index values are mapped to memory offsets.
They accomodate a They accommodate a
number of possible element layouts. For example, the elements of a 2 number of possible element layouts. For example, the elements of a 2
dimensional array can be stored by row (i.e., the elements of each row dimensional array can be stored by row (i.e., the elements of each row
are stored contiguously) or by column (i.e., the elements of each are stored contiguously) or by column (i.e., the elements of each
@@ -303,7 +303,7 @@ This returns the number of values contained in
<code class="literal">const element&amp;</code> otherwise. <code class="literal">const element&amp;</code> otherwise.
</td><td> </td><td>
This expression accesses a specific element of This expression accesses a specific element of
<code class="literal">a</code>.<code class="literal">index_list</code> is the unique set <code class="literal">a</code>. <code class="literal">index_list</code> is the unique set
of indices that address the element returned. It is of indices that address the element returned. It is
equivalent to the following code (disregarding intermediate temporaries): equivalent to the following code (disregarding intermediate temporaries):
<pre class="programlisting"> <pre class="programlisting">
@@ -427,16 +427,16 @@ with unspecified start and finish values.</td></tr><tr><td><code class="literal"
value, this is equivalent to <code class="literal">i.start()</code>. Otherwise it value, this is equivalent to <code class="literal">i.start()</code>. Otherwise it
returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i.get_finish(idx)</code></td><td><code class="literal">index</code></td><td>If <code class="literal">i</code> specifies a finish returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i.get_finish(idx)</code></td><td><code class="literal">index</code></td><td>If <code class="literal">i</code> specifies a finish
value, this is equivalent to <code class="literal">i.finish()</code>. Otherwise it value, this is equivalent to <code class="literal">i.finish()</code>. Otherwise it
returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i.size(idx)</code></td><td><code class="literal">size_type</code></td><td>If <code class="literal">i</code> specifies a both finish and returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i.size(idx)</code></td><td><code class="literal">size_type</code></td><td>If <code class="literal">i</code> specifies both a finish and a
start values, this is equivalent to start value, this is equivalent to
<code class="literal">(i.finish()-i.start())/i.stride()</code>. Otherwise it <code class="literal">(i.finish()-i.start())/i.stride()</code>. Otherwise it
returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i &lt; idx</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the finish returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i &lt; idx</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the finish
value. This notation does not include value. This notation does not include
<code class="literal">idx</code> in the range of valid indices. It is equivalent to <code class="literal">idx</code> in the range of valid indices. It is equivalent to
<code class="literal">index_range(r.start(), idx, r.stride())</code></td></tr><tr><td><code class="literal">i &lt;= idx</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the finish <code class="literal">index_range(r.start(), idx, r.stride())</code>.</td></tr><tr><td><code class="literal">i &lt;= idx</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the finish
value. This notation includes value. This notation includes
<code class="literal">idx</code> in the range of valid indices. It is equivalent to <code class="literal">idx</code> in the range of valid indices. It is equivalent to
<code class="literal">index_range(r.start(), idx + 1, r.stride())</code></td></tr><tr><td><code class="literal">idx &lt; i</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the start <code class="literal">index_range(r.start(), idx + 1, r.stride())</code>.</td></tr><tr><td><code class="literal">idx &lt; i</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the start
value. This notation does not include value. This notation does not include
<code class="literal">idx</code> in the range of valid indices. It is equivalent to <code class="literal">idx</code> in the range of valid indices. It is equivalent to
<code class="literal">index_range(idx + 1, i.finish(), i.stride())</code>.</td></tr><tr><td><code class="literal">idx &lt;= i</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the start <code class="literal">index_range(idx + 1, i.finish(), i.stride())</code>.</td></tr><tr><td><code class="literal">idx &lt;= i</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the start
@@ -444,9 +444,9 @@ value. This notation includes
<code class="literal">idx1</code> in the range of valid indices. It is equivalent to <code class="literal">idx1</code> in the range of valid indices. It is equivalent to
<code class="literal">index_range(idx, i.finish(), i.stride())</code>.</td></tr><tr><td><code class="literal">i + idx</code></td><td><code class="literal">index</code></td><td>This expression shifts the start and finish values <code class="literal">index_range(idx, i.finish(), i.stride())</code>.</td></tr><tr><td><code class="literal">i + idx</code></td><td><code class="literal">index</code></td><td>This expression shifts the start and finish values
of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to
<code class="literal">index_range(r.start()+idx1, r.finish()+idx, r.stride())</code></td></tr><tr><td><code class="literal">i - idx</code></td><td><code class="literal">index</code></td><td>This expression shifts the start and finish values <code class="literal">index_range(r.start()+idx1, r.finish()+idx, r.stride())</code>.</td></tr><tr><td><code class="literal">i - idx</code></td><td><code class="literal">index</code></td><td>This expression shifts the start and finish values
of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to
<code class="literal">index_range(r.start()-idx1, r.finish()-idx, r.stride())</code></td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect3" title="index_gen"><div class="titlepage"><div><div><h4 class="title"><a name="index_gen"></a><code class="literal">index_gen</code></h4></div></div></div><p> <code class="literal">index_gen</code> aggregates <code class="literal">index_range(r.start()-idx1, r.finish()-idx, r.stride())</code>.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect3" title="index_gen"><div class="titlepage"><div><div><h4 class="title"><a name="index_gen"></a><code class="literal">index_gen</code></h4></div></div></div><p> <code class="literal">index_gen</code> aggregates
<code class="literal">index_range</code> objects in order to specify view <code class="literal">index_range</code> objects in order to specify view
parameters. Chained calls to <code class="literal">operator[]</code> store parameters. Chained calls to <code class="literal">operator[]</code> store
range and dimension information used to range and dimension information used to
@@ -560,7 +560,7 @@ void reindex(const BaseList&amp; values);
</pre> </pre>
</span></dt><dd><p>This changes the index bases of the <code class="literal">multi_array</code> to </span></dt><dd><p>This changes the index bases of the <code class="literal">multi_array</code> to
correspond to the the values in <code class="literal">values</code>.</p><p title="BaseList Requirements"><b><code class="literal">BaseList</code> Requirements. </b><code class="literal">BaseList</code> must model correspond to the values in <code class="literal">values</code>.</p><p title="BaseList Requirements"><b><code class="literal">BaseList</code> Requirements. </b><code class="literal">BaseList</code> must model
<a class="ulink" href="../../utility/Collection.html" target="_top">Collection</a>.</p><p title="Preconditions"><b>Preconditions. </b><code class="literal">values.size() == NumDims;</code></p><p title="Postconditions"><b>Postconditions. </b><code class="literal">std::equal(values.begin(),values.end(),this-&gt;index_bases()); <a class="ulink" href="../../utility/Collection.html" target="_top">Collection</a>.</p><p title="Preconditions"><b>Preconditions. </b><code class="literal">values.size() == NumDims;</code></p><p title="Postconditions"><b>Postconditions. </b><code class="literal">std::equal(values.begin(),values.end(),this-&gt;index_bases());
</code></p></dd><dt><span class="term"> </code></p></dd><dt><span class="term">
<pre class="programlisting"> <pre class="programlisting">
@@ -745,7 +745,7 @@ multi_array(const const_array_view&lt;NumDims&gt;::type&amp; x);
multi_array(const multi_array_ref&lt;ValueType,NumDims&gt;&amp; x); multi_array(const multi_array_ref&lt;ValueType,NumDims&gt;&amp; x);
multi_array(const subarray&lt;NumDims&gt;::type&amp; x); multi_array(const subarray&lt;NumDims&gt;::type&amp; x);
multi_array(const array_view&lt;NumDims&gt;::type&amp; x); multi_array(const array_view&lt;NumDims&gt;::type&amp; x);
</pre></span></dt><dd><p>These constructors all constructs a <code class="literal">multi_array</code> and </pre></span></dt><dd><p>These constructors all construct a <code class="literal">multi_array</code> and
perform a deep copy of <code class="literal">x</code>. perform a deep copy of <code class="literal">x</code>.
</p><p title="Complexity"><b>Complexity. </b> This performs O(<code class="literal">x.num_elements()</code>) calls to </p><p title="Complexity"><b>Complexity. </b> This performs O(<code class="literal">x.num_elements()</code>) calls to
<code class="literal">element</code>'s copy <code class="literal">element</code>'s copy
@@ -816,7 +816,7 @@ of the constructors.
</p><p title="Model Of."><b>Model Of. </b> </p><p title="Model Of."><b>Model Of. </b>
<code class="literal">multi_array_ref</code> models <code class="literal">multi_array_ref</code> models
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>, <a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>. <a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>
and depending on the element type, it may also model and depending on the element type, it may also model
<a class="ulink" href="https://www.boost.org/sgi/stl/EqualityComparable.html" target="_top">EqualityComparable</a> and <a class="ulink" href="https://www.boost.org/sgi/stl/LessThanComparable.html" target="_top">LessThanComparable</a>. <a class="ulink" href="https://www.boost.org/sgi/stl/EqualityComparable.html" target="_top">EqualityComparable</a> and <a class="ulink" href="https://www.boost.org/sgi/stl/LessThanComparable.html" target="_top">LessThanComparable</a>.
Detailed descriptions are provided here only for operations that are Detailed descriptions are provided here only for operations that are
@@ -954,7 +954,7 @@ dimensions.
multi_array_ref(const multi_array_ref&amp; x); multi_array_ref(const multi_array_ref&amp; x);
</pre></span></dt><dd><p>This constructs a shallow copy of <code class="literal">x</code>. </pre></span></dt><dd><p>This constructs a shallow copy of <code class="literal">x</code>.
</p><p title="Complexity"><b>Complexity. </b> Constant time (for contrast, compare this to </p><p title="Complexity"><b>Complexity. </b> Constant time (for contrast, compare this to
the <code class="literal">multi_array</code> class copy constructor. the <code class="literal">multi_array</code> class copy constructor).
</p></dd></dl></div><p title="Modifiers"><b>Modifiers. </b></p><div class="variablelist"><dl><dt><span class="term"><pre class="programlisting"> </p></dd></dl></div><p title="Modifiers"><b>Modifiers. </b></p><div class="variablelist"><dl><dt><span class="term"><pre class="programlisting">
multi_array_ref&amp; operator=(const multi_array_ref&amp; x); multi_array_ref&amp; operator=(const multi_array_ref&amp; x);
template &lt;class Array&gt; multi_array_ref&amp; operator=(const Array&amp; x); template &lt;class Array&gt; multi_array_ref&amp; operator=(const Array&amp; x);
@@ -976,7 +976,7 @@ of the constructors.
</p><p title="Model Of."><b>Model Of. </b> </p><p title="Model Of."><b>Model Of. </b>
<code class="literal">const_multi_array_ref</code> models <code class="literal">const_multi_array_ref</code> models
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>, <a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>. <a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>
and depending on the element type, it may also model and depending on the element type, it may also model
<a class="ulink" href="https://www.boost.org/sgi/stl/EqualityComparable.html" target="_top">EqualityComparable</a> and <a class="ulink" href="https://www.boost.org/sgi/stl/LessThanComparable.html" target="_top">LessThanComparable</a>. <a class="ulink" href="https://www.boost.org/sgi/stl/EqualityComparable.html" target="_top">EqualityComparable</a> and <a class="ulink" href="https://www.boost.org/sgi/stl/LessThanComparable.html" target="_top">LessThanComparable</a>.
@@ -1110,7 +1110,7 @@ associated with <code class="literal">multi_array</code>,
<code class="literal">multi_array_ref</code>, and <code class="literal">multi_array_ref</code>, and
<code class="literal">const_multi_array_ref</code> that are not <code class="literal">const_multi_array_ref</code> that are not
dependent upon template parameters. These types find common use with dependent upon template parameters. These types find common use with
all Boost.Multiarray components. They are defined all Boost.MultiArray components. They are defined
in a namespace from which they can be accessed conveniently. in a namespace from which they can be accessed conveniently.
With the exception of <code class="literal">extent_gen</code> and With the exception of <code class="literal">extent_gen</code> and
<code class="literal">extent_range</code>, these types fulfill the roles of the <code class="literal">extent_range</code>, these types fulfill the roles of the
@@ -1144,7 +1144,7 @@ public:
<code class="literal">finish</code> must be greater than <code class="literal">start</code>. <code class="literal">finish</code> must be greater than <code class="literal">start</code>.
</p></dd><dt><span class="term"><code class="function">extent_range(index finish)</code></span></dt><dd><p>This constructor defines the half open interval </p></dd><dt><span class="term"><code class="function">extent_range(index finish)</code></span></dt><dd><p>This constructor defines the half open interval
<code class="literal">[0,finish)</code>. The value of <code class="literal">finish</code> <code class="literal">[0,finish)</code>. The value of <code class="literal">finish</code>
must be positive.</p></dd><dt><span class="term"><code class="function">index start()</code></span></dt><dd><p>This function returns the first index represented by the range</p></dd><dt><span class="term"><code class="function">index finish()</code></span></dt><dd><p>This function returns the upper boundary value of the half-open must be positive.</p></dd><dt><span class="term"><code class="function">index start()</code></span></dt><dd><p>This function returns the first index represented by the range.</p></dd><dt><span class="term"><code class="function">index finish()</code></span></dt><dd><p>This function returns the upper boundary value of the half-open
interval. Note that the range does not include this value.</p></dd><dt><span class="term"><code class="function">size_type size()</code></span></dt><dd><p>This function returns the size of the specified range. It is interval. Note that the range does not include this value.</p></dd><dt><span class="term"><code class="function">size_type size()</code></span></dt><dd><p>This function returns the size of the specified range. It is
equivalent to <code class="literal">finish()-start()</code>.</p></dd></dl></div></div><div class="sect2" title="extent_gen"><div class="titlepage"><div><div><h3 class="title"><a name="extent_gen"></a><code class="classname">extent_gen</code></h3></div></div></div><p>The <code class="classname">extent_gen</code> class defines an equivalent to <code class="literal">finish()-start()</code>.</p></dd></dl></div></div><div class="sect2" title="extent_gen"><div class="titlepage"><div><div><h3 class="title"><a name="extent_gen"></a><code class="classname">extent_gen</code></h3></div></div></div><p>The <code class="classname">extent_gen</code> class defines an
interface for aggregating array shape and indexing information to be interface for aggregating array shape and indexing information to be
@@ -1205,7 +1205,7 @@ For example,
a 3 by 3 by 3 <code class="classname">multi_array</code> is constructed as follows: a 3 by 3 by 3 <code class="classname">multi_array</code> is constructed as follows:
</p><pre class="programlisting">multi_array&lt;int,3&gt; A(extents[3][3][3]);</pre><p> </p><pre class="programlisting">multi_array&lt;int,3&gt; A(extents[3][3][3]);</pre><p>
The same array could also be created by explicitly declaring an <code class="literal">extent_gen</code> The same array could also be created by explicitly declaring an <code class="literal">extent_gen</code>
object locally,, but the global object makes this declaration unnecessary. object locally, but the global object makes this declaration unnecessary.
</p></div><div class="sect3" title="indices"><div class="titlepage"><div><div><h4 class="title"><a name="indices"></a><code class="literal">indices</code></h4></div></div></div><pre class="programlisting"> </p></div><div class="sect3" title="indices"><div class="titlepage"><div><div><h4 class="title"><a name="indices"></a><code class="literal">indices</code></h4></div></div></div><pre class="programlisting">
namespace boost { namespace boost {
multi_array_base::index_gen indices; multi_array_base::index_gen indices;
@@ -1284,7 +1284,7 @@ int a[] = { 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11 };
int s[] = { 3, 1 }; int s[] = { 3, 1 };
</pre><p> </pre><p>
Notice that the strides here are different. As a result, Notice that the strides here are different. As a result,
The expression given above to access values will work with this pair the expression given above to access values will work with this pair
of data and strides as well. of data and strides as well.
</p><p>In addition to dimension order, it is also possible to </p><p>In addition to dimension order, it is also possible to
store any dimension in descending order. For example, returning to the store any dimension in descending order. For example, returning to the

View File

@@ -198,7 +198,7 @@ provides a specialized set of constructors. For further information,
consult their reference pages. consult their reference pages.
<p>All of the non-const array types in this library provide assignment <p>All of the non-const array types in this library provide assignment
operators<tt>operator=()</tt>. Each of the array types <tt>multi_array</tt>, operators <tt>operator=()</tt>. Each of the array types <tt>multi_array</tt>,
<tt>multi_array_ref</tt>, <tt>subarray</tt>, and <tt>multi_array_ref</tt>, <tt>subarray</tt>, and
<tt>array_view</tt> can be assigned from any <tt>array_view</tt> can be assigned from any
of the others, so long as their shapes match. The of the others, so long as their shapes match. The
@@ -476,7 +476,7 @@ stored in ascending or descending order.
// Store last dimension, then first, then middle // Store last dimension, then first, then middle
array_type::size_type ordering[] = {2,0,1}; array_type::size_type ordering[] = {2,0,1};
// Store the first dimension(dimension 0) in descending order // Store the first dimension (dimension 0) in descending order
bool ascending[] = {false,true,true}; bool ascending[] = {false,true,true};
array_type A(extents[3][4][2],storage(ordering,ascending)); array_type A(extents[3][4][2],storage(ordering,ascending));
@@ -488,7 +488,7 @@ stored in ascending or descending order.
<h2>Setting The Array Base</h2> <h2>Setting The Array Base</h2>
In some situations, it may be inconvenient or awkward to use an In some situations, it may be inconvenient or awkward to use an
array that is zero-based. array that is zero-based.
the Boost.MultiArray components provide two facilities for changing the The Boost.MultiArray components provide two facilities for changing the
bases of an array. One may specify a pair of range values, with bases of an array. One may specify a pair of range values, with
the <tt>extent_range</tt> type, to the <tt>extent_range</tt> type, to
the <tt>extent_gen</tt> constructor in order to set the base value. the <tt>extent_gen</tt> constructor in order to set the base value.

View File

@@ -7,7 +7,7 @@ containers. It specifies operations for accessing elements,
traversing containers, and creating views traversing containers, and creating views
of array data. of array data.
MultiArray defines MultiArray defines
a flexible memory model that accomodates a flexible memory model that accommodates
a variety of data layouts. a variety of data layouts.
</para> </para>
@@ -103,7 +103,7 @@ base. Note that since positive index bases are
possible, the origin need not exist in order to determine the location possible, the origin need not exist in order to determine the location
in memory of the MultiArray's elements. in memory of the MultiArray's elements.
The strides determine how index values are mapped to memory offsets. The strides determine how index values are mapped to memory offsets.
They accomodate a They accommodate a
number of possible element layouts. For example, the elements of a 2 number of possible element layouts. For example, the elements of a 2
dimensional array can be stored by row (i.e., the elements of each row dimensional array can be stored by row (i.e., the elements of each row
are stored contiguously) or by column (i.e., the elements of each are stored contiguously) or by column (i.e., the elements of each
@@ -477,7 +477,7 @@ This returns the number of values contained in
</entry> </entry>
<entry> <entry>
This expression accesses a specific element of This expression accesses a specific element of
<literal>a</literal>.<literal>index_list</literal> is the unique set <literal>a</literal>. <literal>index_list</literal> is the unique set
of indices that address the element returned. It is of indices that address the element returned. It is
equivalent to the following code (disregarding intermediate temporaries): equivalent to the following code (disregarding intermediate temporaries):
<programlisting> <programlisting>
@@ -818,8 +818,8 @@ returns <literal>idx</literal>.</entry>
<row> <row>
<entry><literal>i.size(idx)</literal></entry> <entry><literal>i.size(idx)</literal></entry>
<entry><literal>size_type</literal></entry> <entry><literal>size_type</literal></entry>
<entry>If <literal>i</literal> specifies a both finish and <entry>If <literal>i</literal> specifies both a finish and a
start values, this is equivalent to start value, this is equivalent to
<literal>(i.finish()-i.start())/i.stride()</literal>. Otherwise it <literal>(i.finish()-i.start())/i.stride()</literal>. Otherwise it
returns <literal>idx</literal>.</entry> returns <literal>idx</literal>.</entry>
</row> </row>
@@ -829,7 +829,7 @@ returns <literal>idx</literal>.</entry>
<entry>This is another syntax for specifying the finish <entry>This is another syntax for specifying the finish
value. This notation does not include value. This notation does not include
<literal>idx</literal> in the range of valid indices. It is equivalent to <literal>idx</literal> in the range of valid indices. It is equivalent to
<literal>index_range(r.start(), idx, r.stride())</literal></entry> <literal>index_range(r.start(), idx, r.stride())</literal>.</entry>
</row> </row>
<row> <row>
<entry><literal>i &lt;= idx</literal></entry> <entry><literal>i &lt;= idx</literal></entry>
@@ -837,7 +837,7 @@ value. This notation does not include
<entry>This is another syntax for specifying the finish <entry>This is another syntax for specifying the finish
value. This notation includes value. This notation includes
<literal>idx</literal> in the range of valid indices. It is equivalent to <literal>idx</literal> in the range of valid indices. It is equivalent to
<literal>index_range(r.start(), idx + 1, r.stride())</literal></entry> <literal>index_range(r.start(), idx + 1, r.stride())</literal>.</entry>
</row> </row>
<row> <row>
<entry><literal>idx &lt; i</literal></entry> <entry><literal>idx &lt; i</literal></entry>
@@ -860,14 +860,14 @@ value. This notation includes
<entry><literal>index</literal></entry> <entry><literal>index</literal></entry>
<entry>This expression shifts the start and finish values <entry>This expression shifts the start and finish values
of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to
<literal>index_range(r.start()+idx1, r.finish()+idx, r.stride())</literal></entry> <literal>index_range(r.start()+idx1, r.finish()+idx, r.stride())</literal>.</entry>
</row> </row>
<row> <row>
<entry><literal>i - idx</literal></entry> <entry><literal>i - idx</literal></entry>
<entry><literal>index</literal></entry> <entry><literal>index</literal></entry>
<entry>This expression shifts the start and finish values <entry>This expression shifts the start and finish values
of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to
<literal>index_range(r.start()-idx1, r.finish()-idx, r.stride())</literal></entry> <literal>index_range(r.start()-idx1, r.finish()-idx, r.stride())</literal>.</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>

View File

@@ -282,7 +282,7 @@ void reindex(const BaseList& values);
</term> </term>
<listitem> <listitem>
<para>This changes the index bases of the <literal>multi_array</literal> to <para>This changes the index bases of the <literal>multi_array</literal> to
correspond to the the values in <literal>values</literal>.</para> correspond to the values in <literal>values</literal>.</para>
<formalpara> <formalpara>
<title><literal>BaseList</literal> Requirements</title> <title><literal>BaseList</literal> Requirements</title>
@@ -364,7 +364,7 @@ associated with <literal>multi_array</literal>,
<literal>multi_array_ref</literal>, and <literal>multi_array_ref</literal>, and
<literal>const_multi_array_ref</literal> that are not <literal>const_multi_array_ref</literal> that are not
dependent upon template parameters. These types find common use with dependent upon template parameters. These types find common use with
all Boost.Multiarray components. They are defined all Boost.MultiArray components. They are defined
in a namespace from which they can be accessed conveniently. in a namespace from which they can be accessed conveniently.
With the exception of <literal>extent_gen</literal> and With the exception of <literal>extent_gen</literal> and
<literal>extent_range</literal>, these types fulfill the roles of the <literal>extent_range</literal>, these types fulfill the roles of the
@@ -434,7 +434,7 @@ must be positive.</para>
<varlistentry><term><function>index start()</function></term> <varlistentry><term><function>index start()</function></term>
<listitem> <listitem>
<para>This function returns the first index represented by the range</para> <para>This function returns the first index represented by the range.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -562,7 +562,7 @@ For example,
a 3 by 3 by 3 <classname>multi_array</classname> is constructed as follows: a 3 by 3 by 3 <classname>multi_array</classname> is constructed as follows:
<programlisting>multi_array&lt;int,3&gt; A(extents[3][3][3]);</programlisting> <programlisting>multi_array&lt;int,3&gt; A(extents[3][3][3]);</programlisting>
The same array could also be created by explicitly declaring an <literal>extent_gen</literal> The same array could also be created by explicitly declaring an <literal>extent_gen</literal>
object locally,, but the global object makes this declaration unnecessary. object locally, but the global object makes this declaration unnecessary.
</para> </para>
</sect3> </sect3>
@@ -666,7 +666,7 @@ int a[] = { 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11 };
int s[] = { 3, 1 }; int s[] = { 3, 1 };
</programlisting> </programlisting>
Notice that the strides here are different. As a result, Notice that the strides here are different. As a result,
The expression given above to access values will work with this pair the expression given above to access values will work with this pair
of data and strides as well. of data and strides as well.
</para> </para>

View File

@@ -15,7 +15,7 @@ of the constructors.
<para> <para>
<literal>const_multi_array_ref</literal> models <literal>const_multi_array_ref</literal> models
<link linkend="MultiArray">MultiArray</link>, <link linkend="MultiArray">MultiArray</link>,
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>. <ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>
and depending on the element type, it may also model and depending on the element type, it may also model
<ulink url="https://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable</ulink> and <ulink url="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable</ulink>. <ulink url="https://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable</ulink> and <ulink url="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable</ulink>.

View File

@@ -227,7 +227,7 @@ multi_array(const array_view<NumDims>::type& x,
const Allocator& alloc = Allocator());]]> const Allocator& alloc = Allocator());]]>
</programlisting></term> </programlisting></term>
<listitem> <listitem>
<para>These constructors all constructs a <literal>multi_array</literal> and <para>These constructors all construct a <literal>multi_array</literal> and
perform a deep copy of <literal>x</literal>. perform a deep copy of <literal>x</literal>.
</para> </para>

View File

@@ -15,7 +15,7 @@ of the constructors.
<para> <para>
<literal>multi_array_ref</literal> models <literal>multi_array_ref</literal> models
<link linkend="MultiArray">MultiArray</link>, <link linkend="MultiArray">MultiArray</link>,
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>. <ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>
and depending on the element type, it may also model and depending on the element type, it may also model
<ulink url="https://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable</ulink> and <ulink url="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable</ulink>. <ulink url="https://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable</ulink> and <ulink url="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable</ulink>.
Detailed descriptions are provided here only for operations that are Detailed descriptions are provided here only for operations that are
@@ -198,7 +198,7 @@ dimensions.
<formalpara> <formalpara>
<title>Complexity</title> <title>Complexity</title>
<para> Constant time (for contrast, compare this to <para> Constant time (for contrast, compare this to
the <literal>multi_array</literal> class copy constructor. the <literal>multi_array</literal> class copy constructor).
</para></formalpara> </para></formalpara>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@@ -1,6 +1,6 @@
// Copyright 2002 The Trustees of Indiana University. // Copyright 2002 The Trustees of Indiana University.
// Use, modification and distribution is subject to the Boost Software // Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
@@ -18,8 +18,11 @@
// multi-dimensional array class // multi-dimensional array class
// //
#include "boost/multi_array/base.hpp" #include <boost/multi_array/base.hpp>
#include "boost/iterator/iterator_facade.hpp" #include <boost/type.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/enable_if_convertible.hpp>
#include <algorithm> #include <algorithm>
#include <cstddef> #include <cstddef>
#include <iterator> #include <iterator>
@@ -51,7 +54,7 @@ template <typename T, typename TPtr, typename NumDims, typename Reference,
typename IteratorCategory> typename IteratorCategory>
class array_iterator class array_iterator
: public : public
iterator_facade< iterators::iterator_facade<
array_iterator<T,TPtr,NumDims,Reference,IteratorCategory> array_iterator<T,TPtr,NumDims,Reference,IteratorCategory>
, typename associated_types<T,NumDims>::value_type , typename associated_types<T,NumDims>::value_type
, IteratorCategory , IteratorCategory
@@ -60,13 +63,13 @@ class array_iterator
, private , private
value_accessor_generator<T,NumDims>::type value_accessor_generator<T,NumDims>::type
{ {
friend class ::boost::iterator_core_access; friend class ::boost::iterators::iterator_core_access;
typedef detail::multi_array::associated_types<T,NumDims> access_t; typedef detail::multi_array::associated_types<T,NumDims> access_t;
typedef iterator_facade< typedef iterators::iterator_facade<
array_iterator<T,TPtr,NumDims,Reference,IteratorCategory> array_iterator<T,TPtr,NumDims,Reference,IteratorCategory>
, typename detail::multi_array::associated_types<T,NumDims>::value_type , typename detail::multi_array::associated_types<T,NumDims>::value_type
, boost::random_access_traversal_tag , boost::iterators::random_access_traversal_tag
, Reference , Reference
> facade_type; > facade_type;
@@ -78,14 +81,14 @@ class array_iterator
friend class array_iterator; friend class array_iterator;
#else #else
public: public:
#endif #endif
index idx_; index idx_;
TPtr base_; TPtr base_;
const size_type* extents_; const size_type* extents_;
const index* strides_; const index* strides_;
const index* index_base_; const index* index_base_;
public: public:
// Typedefs to circumvent ambiguities between parent classes // Typedefs to circumvent ambiguities between parent classes
typedef typename facade_type::reference reference; typedef typename facade_type::reference reference;
@@ -103,7 +106,7 @@ public:
template <typename OPtr, typename ORef, typename Cat> template <typename OPtr, typename ORef, typename Cat>
array_iterator( array_iterator(
const array_iterator<T,OPtr,NumDims,ORef,Cat>& rhs const array_iterator<T,OPtr,NumDims,ORef,Cat>& rhs
, typename boost::enable_if_convertible<OPtr,TPtr>::type* = 0 , typename boost::iterators::enable_if_convertible<OPtr,TPtr>::type* = 0
) )
: idx_(rhs.idx_), base_(rhs.base_), extents_(rhs.extents_), : idx_(rhs.idx_), base_(rhs.base_), extents_(rhs.extents_),
strides_(rhs.strides_), index_base_(rhs.index_base_) { } strides_(rhs.strides_), index_base_(rhs.index_base_) { }
@@ -115,7 +118,7 @@ public:
{ {
return operator_arrow_proxy<reference>(this->dereference()); return operator_arrow_proxy<reference>(this->dereference());
} }
reference dereference() const reference dereference() const
{ {
@@ -127,7 +130,7 @@ public:
strides_, strides_,
index_base_); index_base_);
} }
void increment() { ++idx_; } void increment() { ++idx_; }
void decrement() { --idx_; } void decrement() { --idx_; }

View File

@@ -103,7 +103,7 @@ public:
boost::function_requires< boost::function_requires<
CollectionConcept<ExtentList> >(); CollectionConcept<ExtentList> >();
index_base_list_.assign(0); index_base_list_.fill(0);
init_multi_array_ref(extents.begin()); init_multi_array_ref(extents.begin());
} }
@@ -340,7 +340,7 @@ public:
init_multi_array_ref(extents); init_multi_array_ref(extents);
} else { } else {
boost::array<index,NumDims> extent_list; boost::array<index,NumDims> extent_list;
extent_list.assign(0); extent_list.fill(0);
init_multi_array_ref(extent_list.begin()); init_multi_array_ref(extent_list.begin());
} }
} }

View File

@@ -48,14 +48,14 @@ namespace boost {
for (size_type i=0; i != NumDims; ++i) { for (size_type i=0; i != NumDims; ++i) {
ordering_[i] = NumDims - 1 - i; ordering_[i] = NumDims - 1 - i;
} }
ascending_.assign(true); ascending_.fill(true);
} }
general_storage_order(const fortran_storage_order&) { general_storage_order(const fortran_storage_order&) {
for (size_type i=0; i != NumDims; ++i) { for (size_type i=0; i != NumDims; ++i) {
ordering_[i] = i; ordering_[i] = i;
} }
ascending_.assign(true); ascending_.fill(true);
} }
size_type ordering(size_type dim) const { return ordering_[dim]; } size_type ordering(size_type dim) const { return ordering_[dim]; }

View File

@@ -90,7 +90,7 @@ public:
} }
void reindex(index value) { void reindex(index value) {
index_base_list_.assign(value); index_base_list_.fill(value);
origin_offset_ = origin_offset_ =
this->calculate_indexing_offset(stride_list_,index_base_list_); this->calculate_indexing_offset(stride_list_,index_base_list_);
} }
@@ -231,7 +231,7 @@ public: // should be protected
const boost::array<Index,NumDims>& strides): const boost::array<Index,NumDims>& strides):
base_(base), origin_offset_(0) { base_(base), origin_offset_(0) {
index_base_list_.assign(0); index_base_list_.fill(0);
// Get the extents and strides // Get the extents and strides
boost::detail::multi_array:: boost::detail::multi_array::

View File

@@ -6,6 +6,8 @@
import testing ; import testing ;
project : requirements <library>/boost/multi_array//boost_multi_array ;
compile-fail fail_cbracket.cpp ; compile-fail fail_cbracket.cpp ;
compile-fail fail_cdata.cpp ; compile-fail fail_cdata.cpp ;
compile-fail fail_citerator.cpp ; compile-fail fail_citerator.cpp ;
@@ -15,7 +17,7 @@ compile-fail fail_csubarray.cpp ;
compile-fail fail_csubarray2.cpp ; compile-fail fail_csubarray2.cpp ;
compile-fail fail_csubarray3.cpp ; compile-fail fail_csubarray3.cpp ;
compile-fail fail_cview.cpp ; compile-fail fail_cview.cpp ;
compile-fail fail_cview2.cpp ; compile-fail fail_cview2.cpp : <library>/boost/test//included ;
compile-fail fail_cview3.cpp ; compile-fail fail_cview3.cpp ;
compile-fail fail_ref_cbracket.cpp ; compile-fail fail_ref_cbracket.cpp ;
compile-fail fail_ref_cdata.cpp ; compile-fail fail_ref_cdata.cpp ;
@@ -28,7 +30,7 @@ compile-fail fail_ref_csubarray3.cpp ;
compile-fail fail_ref_cview.cpp ; compile-fail fail_ref_cview.cpp ;
compile-fail fail_ref_cview2.cpp ; compile-fail fail_ref_cview2.cpp ;
compile-fail fail_ref_cview3.cpp ; compile-fail fail_ref_cview3.cpp ;
run constructors.cpp ; run constructors.cpp ;
run access.cpp ; run access.cpp ;
run compare.cpp ; run compare.cpp ;