Compare commits

..

110 Commits

Author SHA1 Message Date
Glen Fernandes
3ab14966b5 Merge branch 'develop' 2019-02-25 07:59:05 -05:00
Glen Fernandes
72763d70be Fix contribution from CromwellEnage to actually compile 2019-02-24 23:09:05 -05:00
Glen Fernandes
f59629cebb Merge pull request #17 from CromwellEnage/index_range_size
index_range.size() was missing
2019-02-24 20:49:58 -05:00
Glen Fernandes
55bba0ed5b Merge branch 'develop' into index_range_size 2019-02-24 20:48:00 -05:00
Glen Fernandes
9642ba7103 Add test cases for allocators 2019-02-19 00:57:25 -05:00
Glen Fernandes
453d38b269 Update sgi.com/tech URLs in docs to boost.org/sgi 2019-02-18 22:32:30 -05:00
Glen Fernandes
56b9b62ce4 Merge pull request #22 from boostorg/lightweight_test
Switch to Boost.Lightweight_Test for faster test build and run times
2019-02-18 22:30:34 -05:00
Glen Fernandes
11d00187fa Switch to Boost.Lightweight_Test for faster test build and run times 2019-02-18 15:59:40 -05:00
rxg
25b8a5479f Merge pull request #10 from DanielaE/feature/retire-header-iterator
Get rid of iterator.hpp
2018-10-13 17:43:38 -07:00
Ronald Garcia
804dff44de Merge branch 'develop' 2018-10-03 20:38:17 -07:00
CromwellEnage
17f9326ecc index_range.size() was missing
Added missing size() member function to index_range in accordance with reference documentation.
2018-09-19 12:06:36 -04:00
Glen Fernandes
f126e8d7be Merge pull request #13 from glenfe/develop
Add Travis and Appveyor configurations
2018-09-18 22:36:05 -04:00
Glen Fernandes
f589527689 Add Travis and Appveyor configurations 2018-09-08 20:36:05 -04:00
rxg
dedb1eaade Merge pull request #12 from glenfe/develop
Improve C++11 allocator support
2018-09-05 20:42:38 -07:00
Glen Fernandes
e9229c8bf4 Improve C++11 allocator support
* Use the empty base optimization for storing the allocator
* Support C++11 minimal allocators
* Support C++11 stateful allocators
* Support C++11 allocator construct and destroy
2018-09-05 18:31:26 -04:00
Daniela Engert
c30eee78db Get rid of iterator.hpp
It does nothing more than pulling std::iterator into namespace boost and including headers. This library only takes advantage of the included headers. OTOH, pulling std::iterator into boost generates deprecation warnings in MSVC 14.1 when compiling in C++17 mode. Even more, Boost's iterator.hpp is deprecated, too.

Signed-off-by: Daniela Engert <dani@ngrt.de>
2017-12-27 15:59:42 +01:00
rxg
abcb2839d5 Merge pull request #8 from boostorg/develop
Please merge to master
2017-09-19 06:42:01 -07:00
Rene Rivera
d259f853b5 Add, and update, documentation build targets. 2016-10-10 11:39:51 -05:00
Rene Rivera
83c3738519 Add, and update, documentation build targets. 2016-10-07 23:07:35 -05:00
Ronald Garcia
fcfb551a1c Merge branch 'develop' of https://github.com/boostorg/multi_array into develop 2015-11-01 01:01:38 -08:00
Ronald Garcia
fcf70a4560 committing https://github.com/boostorg/multi_array/pull/6 to master. 2015-11-01 01:01:18 -08:00
rxg
5578fc341e Merge pull request #6 from MarcelRaad/patch-1
Fix clang warning
2014-10-05 09:10:35 -07:00
Marcel Raad
973ef10b02 Fix clang warning
clang complains about the friend declaration with a warning:

warning : unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier [-Wmicrosoft]
    friend class iterator_core_access;
                       ^
                       ::boost::

Explicitly qualifying the class name with its namespace fixes the warning.
2014-09-26 10:54:24 +02:00
rxg
43ef0fec88 Merge pull request #5 from danieljames/metadata
Create metadata file.
2014-08-24 23:54:48 -04:00
Daniel James
9ac138b91a Add metadata file. 2014-08-18 15:07:45 +01:00
Ronald Garcia
bf7d4881c0 Merge branch 'develop' of https://github.com/boostorg/multi_array into develop 2014-08-15 10:00:17 -07:00
Ronald Garcia
83493ba231 Modified fix for sergiud, for warning-less compilation on MSVC12.0 at level 4
in release mode.
Fixes #2
2014-08-15 09:54:17 -07:00
rxg
8b22b92d88 Merge pull request #4 from jzmaddock/patch-2
Update Jamfile.v2
2014-08-14 17:08:45 -07:00
jzmaddock
484645ee98 Update Jamfile.v2
Fix image location for PDF doc build.
2014-08-14 17:57:55 +01:00
Ronald Garcia
013ed850c5 Fixes #9886. Suppress -Wshadow-warnings warnings inside multi_array implementation. 2014-05-01 11:47:26 -07:00
Ronald Garcia
8da3864210 GCC 4.8 -Wunused-local-typedefs complains about an unused local typedef.
fixes #9888.
2014-04-23 10:14:08 -07:00
Ronald Garcia
f61cd7a7f7 Merge branch 'develop' 2014-04-23 08:36:51 -07:00
Ronald Garcia
acf2eb96be small edit, stolen from boost.xml.
[SVN r69845]
2014-04-22 19:11:55 -07:00
Ronald Garcia
adfc62347a re-added the title.
[SVN r69848]
2014-04-22 19:11:19 -07:00
Ronald Garcia
b4a42e42fe Produced a boostbook version of the reference documentation.
[SVN r69844]
2014-04-22 19:10:37 -07:00
Ronald Garcia
b9ba4320e4 fixes #8368
Changed a macro to use ifndef rather than if to avoid warnings.

[SVN r83761]
2014-04-22 18:59:56 -07:00
Stephen Kelly
9eb51cbe82 MultiArray: Remove obsolete MSVC version checks.
[SVN r85939]
2014-04-22 18:54:33 -07:00
Ronald Garcia
b0e181f0a0 added dimensionality constant to multi_array and multi_array_ref synopses.
[SVN r76452]
2014-04-22 18:32:37 -07:00
Ronald Garcia
12d5e39adc added dimensionality constant to multi_array and multi_array_ref synopses.
[SVN r76451]
2014-04-22 18:31:32 -07:00
Ronald Garcia
ae54068327 addressed an identifier clash.
[SVN r69965]
2014-04-22 18:26:22 -07:00
Daniel James
dc6b16e9c8 Merge branch 'merge-base' 2014-04-06 14:16:36 +01:00
Daniel James
b3757d35c9 Create merge base for git. 2014-04-06 14:16:21 +01:00
Michel Morin
9389db9340 Merge r86524 (Correct broken links to C++ standard papers); fixes #9212
[SVN r86673]
2013-11-13 03:22:55 +00:00
Michel Morin
0cb44bf7dc Correct broken links to C++ standard papers. Refs #9212.
[SVN r86524]
2013-10-30 12:51:24 +00:00
Stephen Kelly
59f108a7d1 MultiArray: Remove obsolete MSVC version checks.
[SVN r85939]
2013-09-26 09:43:12 +00:00
Ronald Garcia
795fda0d0f fixes #8368
Changed a macro to use ifndef rather than if to avoid warnings.


[SVN r83761]
2013-04-03 23:21:29 +00:00
Ronald Garcia
6e19d4b886 Somehow multi_array was picking up enable_if/disable_if from the ether, but
the ether is now gone.  Explicitly including the needed headers now.


[SVN r78531]
2012-05-21 19:48:06 +00:00
Ronald Garcia
0c123c47d4 Only include output_iterator_tag for Visual Studio 2010 and forward.
This is needed for its debug mode to compile due to some troublesome
Standard text.


[SVN r78495]
2012-05-17 13:53:04 +00:00
Ronald Garcia
2bccb07ac8 Updated the ASSERT hooks with an implementation for assertion_failed_msg.
[SVN r78494]
2012-05-17 13:48:51 +00:00
Ronald Garcia
bc5df6a074 operator() requires Collection concept, calls access_element, which
should in turn require it too, but was using RandomCollection Concept.
Fixes ticket #5664.


[SVN r76571]
2012-01-18 02:27:54 +00:00
Ronald Garcia
723c1a0a93 Fixed a bug in the reference docs.
[SVN r76453]
2012-01-13 15:47:24 +00:00
Ronald Garcia
797313144a added dimensionality constant to multi_array and multi_array_ref synopses.
[SVN r76452]
2012-01-13 15:45:05 +00:00
Ronald Garcia
efc4219993 added dimensionality constant to multi_array and multi_array_ref synopses.
[SVN r76451]
2012-01-13 15:44:48 +00:00
Ronald Garcia
daaa3f21f7 MultiArray mutable iterators must model OutputIterator.
[SVN r76396]
2012-01-10 03:23:16 +00:00
Ronald Garcia
7bdcfb017c addressed an identifier clash.
[SVN r69965]
2011-03-13 23:10:30 +00:00
Ronald Garcia
167aa52874 re-added the title.
[SVN r69848]
2011-03-11 15:18:22 +00:00
Ronald Garcia
13e6c5ad62 small edit, stolen from boost.xml.
[SVN r69845]
2011-03-11 14:00:36 +00:00
Ronald Garcia
a8810c7840 Produced a boostbook version of the reference documentation.
[SVN r69844]
2011-03-11 13:48:52 +00:00
Ronald Garcia
6b6d2320ea Copied Jeremiah's fix (using Boost.Iterator's arrow proxy) back to the trunk.
[SVN r62969]
2010-06-15 12:04:50 +00:00
Ronald Garcia
029dde4039 Fixed an assertion error...resize needs to account for starting with
an empty array when considering legal ranges.
Some small housecleaning (renaming variables, moving asserts).


[SVN r62963]
2010-06-15 01:40:31 +00:00
Jeremiah Willcock
f38af67708 Moved Collection concept into Boost.ConceptCheck; moved other MultiArray concepts into boost::multi_array_concepts and documented them in reference.xml (do not know how to rebuild HTML from that); fixes #4032
[SVN r62611]
2010-06-08 23:28:23 +00:00
Jeremiah Willcock
18d1dedd90 Fixed missing header
[SVN r62609]
2010-06-08 23:19:27 +00:00
Jeremiah Willcock
0d3253b5a0 Added missing typename; fixes #3989
[SVN r62607]
2010-06-08 22:56:21 +00:00
Jeremiah Willcock
e5e2fc0316 Changed "times" to "multiplies" as per #3820; fixes #3820
[SVN r62606]
2010-06-08 22:54:24 +00:00
Jeremiah Willcock
4ac1f69510 Fixed typo in doc example; fixes #3581
[SVN r62605]
2010-06-08 22:53:33 +00:00
Jeremiah Willcock
038f5e7b58 Changed to Boost.Iterator operator_arrow_proxy
[SVN r62604]
2010-06-08 22:46:36 +00:00
Neil Groves
c187bf683e Boost.MultiArray disambiguated calls to equal functions in the unit tests. These became ambiguous due to changes in Boost.Range.
[SVN r61441]
2010-04-20 21:56:33 +00:00
Jeremiah Willcock
7f1fa6b6c8 Fixed various issues in docs (mostly duplicate bookmarks and broken links) found by inspect tool
[SVN r61437]
2010-04-20 18:49:18 +00:00
Troy D. Straszheim
961f6ed6c9 rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back
[SVN r56942]
2009-10-17 02:07:38 +00:00
Troy D. Straszheim
addce9cece Copyrights on CMakeLists.txt to keep them from clogging up the inspect
reports.  This is essentially the same commit as r55095 on the release
branch.



[SVN r55159]
2009-07-26 00:49:56 +00:00
Ronald Garcia
b4d64892c3 Added a test-case to check a reversing view of a 1D array.
[SVN r53790]
2009-06-10 21:51:06 +00:00
Ronald Garcia
ca3c1e6e17 Fixed asserts in generate_array_view to properly handle negative strides.
[SVN r53789]
2009-06-10 20:27:13 +00:00
Daniel James
3b43f7af14 Use local copies of the boost logo.
[SVN r52666]
2009-04-29 21:19:12 +00:00
Michael A. Jackson
7f0608bee9 Updating dependency information for modularized libraries.
[SVN r49628]
2008-11-07 17:05:27 +00:00
Michael A. Jackson
475516baca Updating CMake files to latest trunk. Added dependency information for regression tests and a few new macros for internal use.
[SVN r49627]
2008-11-07 17:02:56 +00:00
Michael A. Jackson
32bc9b2c3f Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor
[SVN r49510]
2008-11-01 13:15:41 +00:00
Ronald Garcia
0e8d2e3189 Initial Revision.
[SVN r47768]
2008-07-24 19:10:40 +00:00
Ronald Garcia
40b0db7ad6 fixed bugs.
[SVN r46508]
2008-06-19 14:17:47 +00:00
Daniel James
1f0df94e27 Quote href values - our tools don't support unquoted values.
[SVN r45283]
2008-05-11 13:49:20 +00:00
Daniel James
527585aef9 Point links to the pages that used to be in 'more' to the site.
[SVN r43210]
2008-02-10 15:02:17 +00:00
Daniel James
0471415bbb Link to people pages on the website, as they've been removed from the download.
[SVN r43209]
2008-02-10 14:56:22 +00:00
Ronald Garcia
26a3292289 Fixes #1461
[SVN r41257]
2007-11-20 15:56:51 +00:00
Ronald Garcia
498f9c2020 Added a simple test that changes index bases while resizing (thanks to
wasti.redl@gmx.net for this code, which caught a bug).


[SVN r41256]
2007-11-20 15:56:29 +00:00
Ronald Garcia
919dbeac64 was missing storage_order_convert.cpp
[SVN r38857]
2007-08-22 18:31:43 +00:00
Ronald Garcia
3125c0efb8 Added mention of assert.cpp.
[SVN r38856]
2007-08-22 18:19:43 +00:00
Ronald Garcia
0046660984 Added a new test case for replacing asserts with exceptions.
[SVN r38854]
2007-08-22 15:30:47 +00:00
Ronald Garcia
ba7d018545 Initial Revision.
[SVN r38853]
2007-08-22 15:29:48 +00:00
Ronald Garcia
19dba59f02 Changed all uses of assert to BOOST_ASSERT.
[SVN r38821]
2007-08-21 13:54:58 +00:00
Ronald Garcia
f68a2203b3 Added "dimensionality" compile-time constant to the MultiArray concept.
[SVN r38820]
2007-08-21 13:54:25 +00:00
Ronald Garcia
415c75e9c5 Added "dimensionality" compile-time constant to the MultiArray concept.
[SVN r38804]
2007-08-20 19:16:39 +00:00
Vladimir Prus
ad81fd84ed Remove V1 Jamfiles
[SVN r38516]
2007-08-08 19:02:26 +00:00
Ronald Garcia
98e0c8de12 Further fix to the reference docs, wrong constructor signatures.
[SVN r38501]
2007-08-07 20:49:13 +00:00
Ronald Garcia
4f86676c37 Made a fix to the documentation, thanks to Neal Becker.
[SVN r38500]
2007-08-07 20:45:54 +00:00
Ronald Garcia
bcb10816f1 Fixes #1127
array views were not handling negative strides properly.  Thanks to Phil Richards for pointing that out.


[SVN r38482]
2007-08-06 19:40:43 +00:00
Ronald Garcia
13259f4def Added storage_order_convert.cpp to the test list.
[SVN r37284]
2007-03-25 18:51:22 +00:00
Ronald Garcia
73317141cf Updated for most recent boost test framework.
[SVN r37283]
2007-03-25 18:48:50 +00:00
Dave Abrahams
55d031d947 Correct testing bugs:
either changing assert(...) or BOOST_ASSERT(...) to BOOST_TEST
    (in my code only)

    or adding "return boost::report_errors();" where it was clearly
    missing (and a pure bug, in anyone's code).


[SVN r37057]
2007-02-24 22:40:59 +00:00
Ronald Garcia
687226a3c5 Updated the docs as per Neal Becker's suggestions.
[SVN r36534]
2006-12-29 13:15:22 +00:00
Beman Dawes
50028b59c5 Add copyright, license
[SVN r35905]
2006-11-07 19:11:57 +00:00
Ronald Garcia
6d1efe04e0 workaround for CW 8.3.
[SVN r34432]
2006-06-30 15:00:30 +00:00
Ronald Garcia
39649b078e Applied patch broke MSVC 7.1 and 8.0
[SVN r34409]
2006-06-26 16:40:21 +00:00
Joaquín M. López Muñoz
d1c1e4d227 made sure templatized overload version of reindex is not unintendedly selected in SFINAE-lacking compilers due to integral conversions
[SVN r34406]
2006-06-26 06:45:14 +00:00
Joaquín M. López Muñoz
c00b913ab3 moved up some decls so that they are visible to CW 8.3 as part of another memfuns' default args
[SVN r34405]
2006-06-26 06:25:50 +00:00
Joaquín M. López Muñoz
8ce8ab8c8a fixed MSVC 6.5/7.0 choking on a constructor involving a dependent typename
[SVN r34404]
2006-06-26 06:20:30 +00:00
Ronald Garcia
eba81b3299 Changed some variable names to appease vc-6_5.
[SVN r34198]
2006-06-06 18:13:44 +00:00
Ronald Garcia
a76974ac36 bug fix for view iterators.
[SVN r34103]
2006-05-26 14:58:11 +00:00
Ronald Garcia
7f708a30ab Fixed a bug in the MultiArray concept.
[SVN r34101]
2006-05-26 14:50:23 +00:00
Ronald Garcia
e037d30b18 Fixed a bug in MultiArray concept.
[SVN r34100]
2006-05-26 14:50:04 +00:00
Ronald Garcia
fa5a5ce9a9 Dealing with an MSVC strange warning.
[SVN r33640]
2006-04-10 16:51:12 +00:00
Ronald Garcia
9ce1adb801 Updated documentation as per Robert Ramey and Dave Abrahams' comments.
[SVN r33561]
2006-04-05 19:38:33 +00:00
69 changed files with 1953 additions and 564 deletions

234
.travis.yml Normal file
View File

@@ -0,0 +1,234 @@
# Copyright 2018 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
language: cpp
sudo: false
python: "2.7"
branches:
only:
- master
- develop
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
- os: linux
compiler: g++
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
- os: linux
compiler: g++-4.4
env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
addons:
apt:
packages:
- g++-4.4
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.6
env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
addons:
apt:
packages:
- g++-4.6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.7
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.8
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.9
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.9
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-8
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
- os: linux
compiler: clang++-3.5
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.5
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++-3.6
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.6
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++-3.8
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.8
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.9
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++-4.0
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-4.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- os: linux
compiler: clang++-5.0
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-5.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
- os: linux
compiler: clang++-6.0
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17
addons:
apt:
packages:
- clang-6.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- os: linux
compiler: clang++-libc++
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
addons:
apt:
packages:
- libc++-dev
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost
- cd boost
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- mkdir -p libs/multi_array
- cp -r $TRAVIS_BUILD_DIR/* libs/multi_array
- python tools/boostdep/depinst/depinst.py multi_array
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 -j 3 libs/multi_array/test toolset=$TOOLSET cxxstd=$CXXSTD
notifications:
email:
on_success: always

48
appveyor.yml Normal file
View File

@@ -0,0 +1,48 @@
# Copyright 2018 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- master
- develop
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-9.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-10.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-11.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-12.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
CXXSTD: 14,17
install:
- set BOOST_BRANCH=develop
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
- cd ..
- git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost
- cd boost
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\multi_array\
- python tools/boostdep/depinst/depinst.py multi_array
- cmd /c bootstrap
- b2 headers
build: off
test_script:
- PATH=%ADDPATH%%PATH%
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- b2 -j 3 libs/multi_array/test toolset=%TOOLSET% %CXXSTD%

15
doc/build.jam Normal file
View File

@@ -0,0 +1,15 @@
# Copyright (c) 2016 Rene Rivera
#
# 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)
###############################################################################
alias boostdoc
: xml/bbref.xml
:
:
: ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;

View File

@@ -50,7 +50,7 @@ iterator categories.
<td><tt>*i</tt> is convertible to <tt>T</tt></td></tr>
<tr>
<td>Forward Iterator</td>
<td><tt>*i</tt> is <tt>T&amp;</tt> (or <tt>const T&amp;</tt> once <a href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#200">issue
<td><tt>*i</tt> is <tt>T&amp;</tt> (or <tt>const T&amp;</tt> once <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#200">issue
200</a> is resolved)</td></tr>
<tr>
<td>Random Access Iterator</td>
@@ -61,7 +61,7 @@ iterator categories.
<p>Because of the mixing of iterator traversal and dereference return type, many
useful iterators can not be appropriately categorized. For example,
<tt>vector&lt;bool&gt;::iterator</tt> is almost a random access iterator, but
the return type is not <tt>bool&amp;</tt> (see <a href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#96">issue
the return type is not <tt>bool&amp;</tt> (see <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#96">issue
96</a> and Herb Sutter's paper J16/99-0008 = WG21 N1185). Therefore, the
iterators only meet the requirements of input iterator and output iterator. This
is so nonintuitive that at least one implementation erroneously assigns
@@ -74,7 +74,7 @@ integers when incremented and dereferenced (see <a href="http://www.boost.org/li
There are two ways to implement this iterator, 1) make the <tt>reference</tt>
type be a true reference (a reference to an integer data member of the counting
iterator) or 2) make the <tt>reference</tt> type be the same as the
<tt>value_type</tt>. Option 1) runs into the problems discussed in <a href="http://anubis.dkuug.dk/JTC1/SC22/WG21/docs/lwg-active.html#198">Issue
<tt>value_type</tt>. Option 1) runs into the problems discussed in <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#198">Issue
198</a>, the reference will not be valid after the iterator is destroyed. Option
2) is therefore a better choice, but then we have a counting iterator that
cannot be a random access iterator.
@@ -651,8 +651,8 @@ Iterator</a>.
</h3>The Forward Iterator is an iterator that can be incremented. Also, it is
permissible to make multiple passes through the iterator's range.
<h3>Refinement of</h3><a href="http://www.boost.org/libs/utility/CopyConstructible.html">Copy
Constructible</a>, <a href="http://www.boost.org/libs/utility/Assignable.html">Assignable</a>, <a href="http://www.sgi.com/tech/stl/DefaultConstructible.html">Default
Constructible</a>, and <a href="http://www.sgi.com/tech/stl/EqualityComparable.html">Equality
Constructible</a>, <a href="http://www.boost.org/libs/utility/Assignable.html">Assignable</a>, <a href="https://www.boost.org/sgi/stl/DefaultConstructible.html">Default
Constructible</a>, and <a href="https://www.boost.org/sgi/stl/EqualityComparable.html">Equality
Comparable</a>
<h3>Associated types</h3>
<table border="1">
@@ -725,7 +725,7 @@ Traversal Iterator</a>
Iterator </h3>An iterator that provides constant-time methods for moving forward
and backward in arbitrary-sized steps.
<h3>Refinement of</h3><a href="#concept_BidirectionalTraversalIterator">Bidirectional
Traversal Iterator</a> and <a href="http://www.sgi.com/tech/stl/LessThanComparable.html">Less Than
Traversal Iterator</a> and <a href="https://www.boost.org/sgi/stl/LessThanComparable.html">Less Than
Comparable</a> where <tt>&lt;</tt> is a total ordering
<h3>Associated types</h3>
<table border="1">

View File

@@ -353,21 +353,21 @@ This expression generates a view of the array determined by the
used to construct <code class="literal">indices</code>.
</td></tr><tr><td><code class="literal">a == b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
values of <code class="literal">a</code> and <code class="literal">b</code>. The element
type must model <a class="ulink" href="http://www.sgi.com/tech/stl/EqualityComparable.html" target="_top">EqualityComparable</a> for this
type must model <a class="ulink" href="https://www.boost.org/sgi/stl/EqualityComparable.html" target="_top">EqualityComparable</a> for this
expression to be valid.</td></tr><tr><td><code class="literal">a &lt; b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
values of <code class="literal">a</code> and <code class="literal">b</code>. The element
type must model <a class="ulink" href="http://www.sgi.com/tech/stl/LessThanComparable.html" target="_top">LessThanComparable</a> for this
type must model <a class="ulink" href="https://www.boost.org/sgi/stl/LessThanComparable.html" target="_top">LessThanComparable</a> for this
expression to be valid.</td></tr><tr><td><code class="literal">a &lt;= b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
values of <code class="literal">a</code> and <code class="literal">b</code>. The element
type must model <a class="ulink" href="http://www.sgi.com/tech/stl/EqualityComparable.html" target="_top">EqualityComparable</a> and
<a class="ulink" href="http://www.sgi.com/tech/stl/LessThanComparable.html" target="_top">LessThanComparable</a> for this
type must 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> for this
expression to be valid.</td></tr><tr><td><code class="literal">a &gt; b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
values of <code class="literal">a</code> and <code class="literal">b</code>. The element
type must model <a class="ulink" href="http://www.sgi.com/tech/stl/EqualityComparable.html" target="_top">EqualityComparable</a> and
<a class="ulink" href="http://www.sgi.com/tech/stl/LessThanComparable.html" target="_top">LessThanComparable</a> for this
type must 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> for this
expression to be valid.</td></tr><tr><td><code class="literal">a &gt;= b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
values of <code class="literal">a</code> and <code class="literal">b</code>. The element
type must model <a class="ulink" href="http://www.sgi.com/tech/stl/LessThanComparable.html" target="_top">LessThanComparable</a> for this
type must model <a class="ulink" href="https://www.boost.org/sgi/stl/LessThanComparable.html" target="_top">LessThanComparable</a> for this
expression to be valid.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" title="Complexity guarantees"><div class="titlepage"><div><div><h3 class="title"><a name="idp18588736"></a>Complexity guarantees</h3></div></div></div><code class="literal">begin()</code> and <code class="literal">end()</code> execute in amortized
constant time.
<code class="literal">size()</code> executes in at most linear time in the
@@ -589,7 +589,7 @@ using a replaceable allocator.
</p><p title="Model Of."><b>Model Of. </b>
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>. Depending on the element type,
it may also model <a class="ulink" href="http://www.sgi.com/tech/stl/EqualityComparable.html" target="_top">EqualityComparable</a> and <a class="ulink" href="http://www.sgi.com/tech/stl/LessThanComparable.html" target="_top">LessThanComparable</a>.
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>.
</p><p title="Synopsis"><b>Synopsis. </b></p><pre class="programlisting">
namespace boost {
@@ -818,7 +818,7 @@ of the constructors.
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>.
and depending on the element type, it may also model
<a class="ulink" href="http://www.sgi.com/tech/stl/EqualityComparable.html" target="_top">EqualityComparable</a> and <a class="ulink" href="http://www.sgi.com/tech/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
not described in the <code class="literal">multi_array</code> reference.
</p><p title="Synopsis"><b>Synopsis. </b></p><pre class="programlisting">
@@ -978,7 +978,7 @@ of the constructors.
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>.
and depending on the element type, it may also model
<a class="ulink" href="http://www.sgi.com/tech/stl/EqualityComparable.html" target="_top">EqualityComparable</a> and <a class="ulink" href="http://www.sgi.com/tech/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
not described in the <code class="literal">multi_array</code> reference.

View File

@@ -179,6 +179,13 @@ by library users.
</td>
</tr>
<tr>
<td><a href="../test/allocators.cpp">libs/multi_array/test/allocators.cpp</a></td>
<td>
Test support for custom allocators.
</td>
</tr>
<tr>
<td><a href="../test/generative_tests.hpp">libs/multi_array/test/generative_tests.hpp</a></td>
<td>

View File

@@ -612,7 +612,7 @@ cases can be found <a href="./test_cases.html">here</a>.
<h2>Related Work</h2>
<a href="../../array/index.html">boost::array</a>
and <a href="http://www.sgi.com/tech/stl/Vector.html">std::vector</a> are
and <a href="https://www.boost.org/sgi/stl/Vector.html">std::vector</a> are
one-dimensional containers of user data. Both manage their own
memory. <tt>std::valarray</tt> is a low-level
C++ Standard Library component
@@ -661,6 +661,11 @@ arrays, as <tt>boost::array</tt> does for C one-dimensional arrays.
<li><a href="mailto:bdawes@acm.org">Beman Dawes</a>
helped immensely with porting the library to Microsoft Windows
compilers.
<li><a href="mailto:glenjofe@gmail.com">Glen Fernandes</a>
implemented support for the C++11 allocator model, including
support for stateful allocators, minimal allocators, and
optimized storage for stateless allocators.
</ul>
<hr>

19
doc/xml/Jamfile.v2 Normal file
View File

@@ -0,0 +1,19 @@
# Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
# 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)
project multi_array/doc ;
import boostbook : boostbook ;
path-constant here : . ;
boostbook multi_array-doc
:
bbref.xml
:
<xsl:param>boost.root=../../../../..
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
<format>pdf:<xsl:param>img.src.path=$(here)/../
;

View File

@@ -567,7 +567,7 @@ This expression generates a view of the array determined by the
<entry>bool</entry>
<entry>This performs a lexicographical comparison of the
values of <literal>a</literal> and <literal>b</literal>. The element
type must model <ulink url="http://www.sgi.com/tech/stl/EqualityComparable.html">EqualityComparable</ulink> for this
type must model <ulink url="https://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable</ulink> for this
expression to be valid.</entry>
</row>
<row>
@@ -575,7 +575,7 @@ expression to be valid.</entry>
<entry>bool</entry>
<entry>This performs a lexicographical comparison of the
values of <literal>a</literal> and <literal>b</literal>. The element
type must model <ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink> for this
type must model <ulink url="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable</ulink> for this
expression to be valid.</entry>
</row>
<row>
@@ -583,8 +583,8 @@ expression to be valid.</entry>
<entry>bool</entry>
<entry>This performs a lexicographical comparison of the
values of <literal>a</literal> and <literal>b</literal>. The element
type must model <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> for this
type must 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> for this
expression to be valid.</entry>
</row>
<row>
@@ -592,8 +592,8 @@ expression to be valid.</entry>
<entry>bool</entry>
<entry>This performs a lexicographical comparison of the
values of <literal>a</literal> and <literal>b</literal>. The element
type must model <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> for this
type must 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> for this
expression to be valid.</entry>
</row>
<row>
@@ -601,7 +601,7 @@ expression to be valid.</entry>
<entry>bool</entry>
<entry>This performs a lexicographical comparison of the
values of <literal>a</literal> and <literal>b</literal>. The element
type must model <ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink> for this
type must model <ulink url="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable</ulink> for this
expression to be valid.</entry>
</row>
</tbody>

806
doc/xml/bbref.xml Normal file
View File

@@ -0,0 +1,806 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd" [
<!ENTITY concepts SYSTEM "MultiArray.xml">
<!ENTITY multi_array SYSTEM "multi_array.xml">
<!ENTITY multi_array_ref SYSTEM "multi_array_ref.xml">
<!ENTITY const_multi_array_ref SYSTEM "const_multi_array_ref.xml">
]>
<library name="MultiArray" dirname="multi_array" id="multi_array"
xmlns:xi="http://www.w3.org/2001/XInclude"
last-revision="$Date$">
<libraryinfo>
<author>
<firstname>Ronald</firstname>
<surname>Garcia</surname>
<affiliation>
<orgname>Indiana University</orgname>
<orgdiv>Open Systems Lab</orgdiv>
</affiliation>
</author>
<orgname>BOOST</orgname>
<copyright>
<year>2002</year>
<holder>The Trustees of Indiana University</holder>
</copyright>
<librarypurpose>Multidimensional containers and adaptors for
arrays of contiguous data</librarypurpose>
<librarycategory name="category:math"/>
<librarycategory name="category:containers"/>
</libraryinfo>
<title>Boost.MultiArray Reference Manual</title>
<para>Boost.MultiArray is composed of several components.
The MultiArray concept defines a generic interface to multidimensional
containers.
<literal>multi_array</literal> is a general purpose container class
that models MultiArray. <literal>multi_array_ref</literal>
and <literal>const_multi_array_ref</literal> are adapter
classes. Using them,
you can manipulate any block of contiguous data as though it were a
<literal>multi_array</literal>.
<literal>const_multi_array_ref</literal> differs from
<literal>multi_array_ref</literal> in that its elements cannot
be modified through its interface. Finally, several auxiliary classes are used
to create and specialize arrays and some global objects are defined as
part of the library interface.</para>
<sect1 id="synopsis">
<title>Library Synopsis</title>
<para>To use Boost.MultiArray, you must include the header
<filename>boost/multi_array.hpp</filename> in your source. This file
brings the following declarations into scope:</para>
<programlisting>
<![CDATA[namespace boost {
namespace multi_array_types {
typedef *unspecified* index;
typedef *unspecified* size_type;
typedef *unspecified* difference_type;
typedef *unspecified* index_range;
typedef *unspecified* extent_range;
typedef *unspecified* index_gen;
typedef *unspecified* extent_gen;
}
template <typename ValueType,
std::size_t NumDims,
typename Allocator = std::allocator<ValueType> >
class multi_array;
template <typename ValueType,
std::size_t NumDims>
class multi_array_ref;
template <typename ValueType,
std::size_t NumDims>
class const_multi_array_ref;
multi_array_types::extent_gen extents;
multi_array_types::index_gen indices;
template <typename Array, int N> class subarray_gen;
template <typename Array, int N> class const_subarray_gen;
template <typename Array, int N> class array_view_gen;
template <typename Array, int N> class const_array_view_gen;
class c_storage_order;
class fortran_storage_order;
template <std::size_t NumDims> class general_storage_order;
}]]>
</programlisting>
</sect1>
&concepts;
<sect1 id="array_types">
<title>Array Components</title>
<para>
Boost.MultiArray defines an array class,
<literal>multi_array</literal>, and two adapter classes,
<literal>multi_array_ref</literal> and
<literal>const_multi_array_ref</literal>. The three classes model
MultiArray and so they share a lot of functionality.
<literal>multi_array_ref</literal> differs from
<literal>multi_array</literal> in that the
<literal>multi_array</literal> manages its own memory, while
<literal>multi_array_ref</literal> is passed a block of memory that it
expects to be externally managed.
<literal>const_multi_array_ref</literal> differs from
<literal>multi_array_ref</literal> in that the underlying elements it
adapts cannot be modified through its interface, though some array
properties, including the array shape and index bases, can be altered.
Functionality the classes have in common is described
below.
</para>
<formalpara>
<title>Note: Preconditions, Effects, and Implementation</title>
<para>
Throughout the following sections, small pieces of C++ code are
used to specify constraints such as preconditions, effects, and
postconditions. These do not necessarily describe the underlying
implementation of array components; rather, they describe the
expected input to and
behavior of the specified operations. Failure to meet
preconditions results in undefined behavior. Not all effects
(i.e. copy constructors, etc.) must be mimicked exactly. The code
snippets for effects intend to capture the essence of the described
operation.
</para>
</formalpara>
<formalpara>
<title>Queries</title>
<variablelist>
<varlistentry>
<term><programlisting>element* data();
const element* data() const;</programlisting></term>
<listitem>
<para>This returns a pointer to the beginning of the
contiguous block that contains the array's data. If all dimensions of
the array are 0-indexed and stored in ascending order, this is
equivalent to <literal>origin()</literal>. Note that
<literal>const_multi_array_ref</literal> only provides the const
version of this function.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><programlisting>element* origin();
const element* origin() const;</programlisting></term>
<listitem>
<para>This returns the origin element of the
<literal>multi_array</literal>. Note that
<literal>const_multi_array_ref</literal> only provides the const
version of this function. (Required by MultiArray)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><function>const index* index_bases();</function></term>
<listitem>
<para>This returns the index bases for the
<literal>multi_array</literal>. (Required by MultiArray)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><function>const index* strides();</function></term>
<listitem>
<para>This returns the strides for the
<literal>multi_array</literal>. (Required by MultiArray)
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><function>const size_type* shape();</function></term>
<listitem>
<para>This returns the shape of the
<literal>multi_array</literal>. (Required by MultiArray)
</para>
</listitem>
</varlistentry>
</variablelist>
</formalpara>
<formalpara>
<title>Comparators</title>
<variablelist>
<varlistentry>
<term><programlisting><![CDATA[
bool operator==(const *array-type*& rhs);
bool operator!=(const *array-type*& rhs);
bool operator<(const *array-type*& rhs);
bool operator>(const *array-type*& rhs);
bool operator>=(const *array-type*& rhs);
bool operator<=(const *array-type*& rhs);]]></programlisting></term>
<listitem>
<para>Each comparator executes a lexicographical compare over
the value types of the two arrays.
(Required by MultiArray)
</para>
<formalpara>
<title>Preconditions</title>
<para><literal>element</literal> must support the
comparator corresponding to that called on
<literal>multi_array</literal>.</para>
</formalpara>
<formalpara>
<title>Complexity</title>
<para>O(<literal>num_elements()</literal>).</para>
</formalpara>
</listitem>
</varlistentry>
</variablelist>
</formalpara>
<formalpara>
<title>Modifiers</title>
<variablelist>
<varlistentry>
<term>
<programlisting>
<![CDATA[
template <typename SizeList>
void reshape(const SizeList& sizes)
]]>
</programlisting>
</term>
<listitem>
<para>This changes the shape of the <literal>multi_array</literal>. The
number of elements and the index bases remain the same, but the number
of values at each level of the nested container hierarchy may
change.</para>
<formalpara><title><literal>SizeList</literal> Requirements</title>
<para><literal>SizeList</literal> must model
<ulink url="../../utility/Collection.html">Collection</ulink>.</para>
</formalpara>
<formalpara><title>Preconditions</title>
<para>
<programlisting>
<![CDATA[std::accumulate(sizes.begin(),sizes.end(),size_type(1),std::times<size_type>()) == this->num_elements();
sizes.size() == NumDims;]]>
</programlisting></para>
</formalpara>
<formalpara><title>Postconditions</title>
<para>
<literal>std::equal(sizes.begin(),sizes.end(),this->shape) == true;</literal>
</para>
</formalpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<programlisting>
<![CDATA[
template <typename BaseList>
void reindex(const BaseList& values);
]]>
</programlisting>
</term>
<listitem>
<para>This changes the index bases of the <literal>multi_array</literal> to
correspond to the the values in <literal>values</literal>.</para>
<formalpara>
<title><literal>BaseList</literal> Requirements</title>
<para><literal>BaseList</literal> must model
<ulink url="../../utility/Collection.html">Collection</ulink>.</para>
</formalpara>
<formalpara>
<title>Preconditions</title>
<para><literal>values.size() == NumDims;</literal></para>
</formalpara>
<formalpara>
<title>Postconditions</title>
<para><literal>std::equal(values.begin(),values.end(),this->index_bases());
</literal></para>
</formalpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<programlisting>
<![CDATA[
void reindex(index value);
]]>
</programlisting>
</term>
<listitem>
<para>This changes the index bases of all dimensions of the
<literal>multi_array</literal> to <literal>value</literal>.</para>
<formalpara>
<title>Postconditions</title>
<para>
<programlisting>
<![CDATA[
std::count_if(this->index_bases(),this->index_bases()+this->num_dimensions(),
std::bind_2nd(std::equal_to<index>(),value)) ==
this->num_dimensions();
]]>
</programlisting>
</para>
</formalpara>
</listitem>
</varlistentry>
</variablelist>
</formalpara>
&multi_array;
&multi_array_ref;
&const_multi_array_ref;
</sect1>
<sect1 id="auxiliary">
<title>Auxiliary Components</title>
<sect2 id="multi_array_types">
<title><literal>multi_array_types</literal></title>
<programlisting>
<![CDATA[namespace multi_array_types {
typedef *unspecified* index;
typedef *unspecified* size_type;
typedef *unspecified* difference_type;
typedef *unspecified* index_range;
typedef *unspecified* extent_range;
typedef *unspecified* index_gen;
typedef *unspecified* extent_gen;
}]]>
</programlisting>
<para>Namespace <literal>multi_array_types</literal> defines types
associated with <literal>multi_array</literal>,
<literal>multi_array_ref</literal>, and
<literal>const_multi_array_ref</literal> that are not
dependent upon template parameters. These types find common use with
all Boost.Multiarray components. They are defined
in a namespace from which they can be accessed conveniently.
With the exception of <literal>extent_gen</literal> and
<literal>extent_range</literal>, these types fulfill the roles of the
same name required by MultiArray and are described in its
concept definition. <literal>extent_gen</literal> and
<literal>extent_range</literal> are described below.
</para>
</sect2>
<sect2 id="extent_range">
<title><classname>extent_range</classname></title>
<para><classname>extent_range</classname> objects define half open
intervals. They provide shape and index base information to
<literal>multi_array</literal>, <literal>multi_array_ref</literal>,
and <literal>const_multi_array_ref</literal> constructors.
<classname>extent_range</classname>s are passed in
aggregate to an array constructor (see
<classname>extent_gen</classname> for more details).
</para>
<formalpara>
<title>Synopsis</title>
<programlisting><![CDATA[
class extent_range {
public:
typedef multi_array_types::index index;
typedef multi_array_types::size_type size_type;
// Structors
extent_range(index start, index finish);
extent_range(index finish);
~extent_range();
// Queries
index start();
index finish();
size_type size();
};]]></programlisting>
</formalpara>
<formalpara>
<title>Model Of</title>
<para>DefaultConstructible,CopyConstructible</para>
</formalpara>
<formalpara><title>Methods and Types</title>
<variablelist>
<varlistentry>
<term><function>extent_range(index start, index finish)</function></term>
<listitem>
<para> This constructor defines the half open interval
<literal>[start,finish)</literal>. The expression
<literal>finish</literal> must be greater than <literal>start</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry><term><function>extent_range(index finish)</function></term>
<listitem>
<para>This constructor defines the half open interval
<literal>[0,finish)</literal>. The value of <literal>finish</literal>
must be positive.</para>
</listitem>
</varlistentry>
<varlistentry><term><function>index start()</function></term>
<listitem>
<para>This function returns the first index represented by the range</para>
</listitem>
</varlistentry>
<varlistentry><term><function>index finish()</function></term>
<listitem>
<para>This function returns the upper boundary value of the half-open
interval. Note that the range does not include this value.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><function>size_type size()</function></term>
<listitem>
<para>This function returns the size of the specified range. It is
equivalent to <literal>finish()-start()</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
</formalpara>
</sect2>
<sect2 id="extent_gen">
<title><classname>extent_gen</classname></title>
<para>The <classname>extent_gen</classname> class defines an
interface for aggregating array shape and indexing information to be
passed to a <literal>multi_array</literal>,
<literal>multi_array_ref</literal>, or <literal>const_multi_array_ref</literal>
constructor. Its interface mimics
the syntax used to declare built-in array types
in C++. For example, while a 3-dimensional array of
<classname>int</classname> values in C++ would be
declared as:
<programlisting>int A[3][4][5],</programlisting>
a similar <classname>multi_array</classname> would be declared:
<programlisting>multi_array&lt;int,3&gt; A(extents[3][4][5]).</programlisting>
</para>
<formalpara><title>Synopsis</title>
<programlisting><![CDATA[
template <std::size_t NumRanges>
class *implementation_defined* {
public:
typedef multi_array_types::index index;
typedef multi_array_types::size_type size_type;
template <std::size_t NumRanges> class gen_type;
gen_type<NumRanges+1>::type operator[](const range& a_range) const;
gen_type<NumRanges+1>::type operator[](index idx) const;
};
typedef *implementation_defined*<0> extent_gen;
]]></programlisting>
</formalpara>
<formalpara><title>Methods and Types</title>
<variablelist>
<varlistentry>
<term><function>template gen_type&lt;Ranges&gt;::type</function></term>
<listitem>
<para>This type generator is used to specify the result of
<literal>Ranges</literal> chained calls to
<literal>extent_gen::operator[].</literal> The types
<classname>extent_gen</classname> and
<classname>gen_type&lt;0&gt;::type</classname> are the same.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><function>gen_type&lt;NumRanges+1&gt;::type
operator[](const extent_range&amp; a_range) const;</function></term>
<listitem>
<para>This function returns a new object containing all previous
<classname>extent_range</classname> objects in addition to
<literal>a_range.</literal> <classname>extent_range</classname>
objects are aggregated by chained calls to
<function>operator[]</function>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><function>gen_type&lt;NumRanges+1&gt;::type
operator[](index idx) const;</function></term>
<listitem>
<para>This function returns a new object containing all previous
<classname>extent_range</classname> objects in addition to
<literal>extent_range(0,idx).</literal> This function gives the array
constructors a similar syntax to traditional C multidimensional array
declaration.</para>
</listitem>
</varlistentry>
</variablelist>
</formalpara>
</sect2>
<sect2>
<title>Global Objects</title>
<para>For syntactic convenience, Boost.MultiArray defines two
global objects as part of its
interface. These objects play the role of object generators;
expressions involving them create other objects of interest.
</para>
<para> Under some circumstances, the two global objects may be
considered excessive overhead. Their construction can be prevented by
defining the preprocessor symbol
<literal>BOOST_MULTI_ARRAY_NO_GENERATORS</literal> before including
<filename>boost/multi_array.hpp.</filename></para>
<sect3 id="extents">
<title><literal>extents</literal></title>
<programlisting>
<![CDATA[namespace boost {
multi_array_base::extent_gen extents;
}]]>
</programlisting>
<para>Boost.MultiArray's array classes use the
<literal>extents</literal> global object to specify
array shape during their construction.
For example,
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>
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.
</para>
</sect3>
<sect3 id="indices">
<title><literal>indices</literal></title>
<programlisting>
<![CDATA[namespace boost {
multi_array_base::index_gen indices;
}]]>
</programlisting>
<para>The MultiArray concept specifies an
<literal>index_gen</literal> associated type that is used to
create views.
<literal>indices</literal> is a global object that serves the role of
<literal>index_gen</literal> for all array components provided by this
library and their associated subarrays and views.
</para>
<para>For example, using the <literal>indices</literal> object,
a view of an array <literal>A</literal> is constructed as follows:
<programlisting>
A[indices[index_range(0,5)][2][index_range(2,4)]];
</programlisting>
</para>
</sect3>
</sect2>
<sect2 id="generators">
<title>View and SubArray Generators</title>
<para>
Boost.MultiArray provides traits classes, <literal>subarray_gen</literal>,
<literal>const_subarray_gen</literal>,
<literal>array_view_gen</literal>,
and <literal>const_array_view_gen</literal>, for naming of
array associated types within function templates.
In general this is no more convenient to use than the nested
type generators, but the library author found that some C++ compilers do not
properly handle templates nested within function template parameter types.
These generators constitute a workaround for this deficit.
The following code snippet illustrates
the correspondence between the <literal>array_view_gen</literal>
traits class and the <literal>array_view</literal> type associated to
an array:
<programlisting>
template &lt;typename Array&gt;
void my_function() {
typedef typename Array::template array_view&lt;3&gt;::type view1_t;
typedef typename boost::array_view_gen&lt;Array,3&gt;::type view2_t;
// ...
}
</programlisting>
In the above example, <literal>view1_t</literal> and
<literal>view2_t</literal> have the same type.
</para>
</sect2>
<sect2 id="memory_layout">
<title>Memory Layout Specifiers</title>
<para>
While a multidimensional array represents a hierarchy of containers of
elements, at some point the elements must be laid out in
memory. As a result, a single multidimensional array
can be represented in memory more than one way.
</para>
<para>For example, consider the two dimensional array shown below in
matrix notation:
<graphic fileref="matrix.gif"/>
Here is how the above array is expressed in C++:
<programlisting>
int a[3][4] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
</programlisting>
This is an example of row-major storage, where elements of each row
are stored contiguously.
While C++ transparently handles accessing elements of an array, you
can also manage the array and its indexing manually. One way that
this may be expressed in memory is as follows:
<programlisting>
int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
int s[] = { 4, 1 };
</programlisting>
With the latter declaration of <literal>a</literal> and
strides <literal>s</literal>, element <literal>a(i,j)</literal>
of the array can be
accessed using the expression
<programlisting>*a+i*s[0]+j*s[1]</programlisting>.
</para>
<para>The same two dimensional array could be laid out by column as follows:
<programlisting>
int a[] = { 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11 };
int s[] = { 3, 1 };
</programlisting>
Notice that the strides here are different. As a result,
The expression given above to access values will work with this pair
of data and strides as well.
</para>
<para>In addition to dimension order, it is also possible to
store any dimension in descending order. For example, returning to the
first example, the first dimension of the example array, the
rows, could be stored in
reverse, resulting in the following:
<programlisting>
int data[] = { 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3 };
int *a = data + 8;
int s[] = { -4, 1 };
</programlisting>
Note that in this example <literal>a</literal> must be explicitly set
to the origin. In the previous examples, the
first element stored in memory was the origin; here this is no longer
the case.
</para>
<para>
Alternatively, the second dimension, or the columns, could be reversed
and the rows stored in ascending order:
<programlisting>
int data[] = { 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8 };
int *a = data + 3;
int s[] = { 4, -1 };
</programlisting>
</para>
<para>
Finally, both dimensions could be stored in descending order:
<programlisting>
int data[] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
int *a = data + 11;
int s[] = { -4, -1 };
</programlisting>
<literal>
</literal>
</para>
<para>
All of the above arrays are equivalent. The expression
given above for <literal>a(i,j)</literal> will yield the same value
regardless of the memory layout.
Boost.MultiArray arrays can be created with customized storage
parameters as described above. Thus, existing data can be adapted
(with <literal>multi_array_ref</literal> or
<literal>const_multi_array_ref</literal>) as suited to the array
abstraction. A common usage of this feature would be to wrap arrays
that must interoperate with Fortran routines so they can be
manipulated naturally at both the C++ and Fortran levels. The
following sections describe the Boost.MultiArray components used to
specify memory layout.
</para>
<sect3 id="c_storage_order">
<title><literal>c_storage_order</literal></title>
<programlisting>
<![CDATA[class c_storage_order {
c_storage_order();
};]]>
</programlisting>
<para><literal>c_storage_order</literal> is used to specify that an
array should store its elements using the same layout as that used by
primitive C++ multidimensional arrays, that is, from last dimension
to first. This is the default storage order for the arrays provided by
this library.</para>
</sect3>
<sect3 id="fortran_storage_order">
<title><literal>fortran_storage_order</literal></title>
<programlisting>
<![CDATA[class fortran_storage_order {
fortran_storage_order();
};]]>
</programlisting>
<para><literal>fortran_storage_order</literal> is used to specify that
an array should store its elements using the same memory layout as a
Fortran multidimensional array would, that is, from first dimension to
last.</para>
</sect3>
<sect3 id="general_storage_order">
<title><literal>general_storage_order</literal></title>
<programlisting>
<![CDATA[template <std::size_t NumDims>
class general_storage_order {
template <typename OrderingIter, typename AscendingIter>
general_storage_order(OrderingIter ordering, AscendingIter ascending);
};]]>
</programlisting>
<para><literal>general_storage_order</literal> allows the user to
specify an arbitrary memory layout for the contents of an array. The
constructed object is passed to the array constructor in order to
specify storage order.</para>
<para>
<literal>OrderingIter</literal> and <literal>AscendingIter</literal>
must model the <literal>InputIterator</literal> concept. Both
iterators must refer to a range of <literal>NumDims</literal>
elements. <literal>AscendingIter</literal> points to objects
convertible to <literal>bool</literal>. A value of
<literal>true</literal> means that a dimension is stored in ascending
order while <literal>false</literal> means that a dimension is stored
in descending order. <literal>OrderingIter</literal> specifies the
order in which dimensions are stored.
</para>
</sect3>
</sect2>
<sect2 id="range_checking">
<title>Range Checking</title>
<para>
By default, the array access methods <literal>operator()</literal> and
<literal>operator[]</literal> perform range
checking. If a supplied index is out of the range defined for an
array, an assertion will abort the program. To disable range
checking (for performance reasons in production releases), define
the <literal>BOOST_DISABLE_ASSERTS</literal> preprocessor macro prior to
including multi_array.hpp in an application.
</para>
</sect2>
</sect1>
</library>

View File

@@ -17,7 +17,7 @@ of the constructors.
<link linkend="MultiArray">MultiArray</link>,
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>.
and depending on the element type, it may also model
<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>.
<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
not described in the <literal>multi_array</literal> reference.

View File

@@ -1,4 +1,4 @@
<sect2 id="multi_array">
<sect2 id="multi_array_class">
<title><literal>multi_array</literal></title>
<para>
@@ -18,7 +18,7 @@ using a replaceable allocator.
<para>
<link linkend="MultiArray">MultiArray</link>,
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>. Depending on the element type,
it may also model <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>.
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>.
</para>
</formalpara>
@@ -51,7 +51,7 @@ public:
typedef multi_array_types::extent_gen extent_gen;
typedef multi_array_types::extent_range extent_range;
typedef *unspecified* storage_order_type;
// template typedefs
template <std::size_t Dims> struct subarray;
@@ -60,9 +60,12 @@ public:
template <std::size_t Dims> struct const_array_view;
static const std::size_t dimensionality = NumDims;
// constructors and destructors
multi_array();
multi_array(const Allocator& alloc = Allocator());
template <typename ExtentList>
explicit multi_array(const ExtentList& sizes,
@@ -72,13 +75,19 @@ public:
const storage_order_type& store = c_storage_order(),
const Allocator& alloc = Allocator());
multi_array(const multi_array& x);
multi_array(const const_multi_array_ref<ValueType,NumDims>& x);
multi_array(const const_subarray<NumDims>::type& x);
multi_array(const const_array_view<NumDims>::type& x);
multi_array(const const_multi_array_ref<ValueType,NumDims>& x,
const Allocator& alloc = Allocator());
multi_array(const const_subarray<NumDims>::type& x,
const Allocator& alloc = Allocator());
multi_array(const const_array_view<NumDims>::type& x,
const Allocator& alloc = Allocator());
multi_array(const multi_array_ref<ValueType,NumDims>& x);
multi_array(const subarray<NumDims>::type& x);
multi_array(const array_view<NumDims>::type& x);
multi_array(const multi_array_ref<ValueType,NumDims>& x,
const Allocator& alloc = Allocator());
multi_array(const subarray<NumDims>::type& x,
const Allocator& alloc = Allocator());
multi_array(const array_view<NumDims>::type& x,
const Allocator& alloc = Allocator());
~multi_array();
@@ -204,12 +213,18 @@ elements.
<varlistentry>
<term><programlisting>
<![CDATA[multi_array(const multi_array& x);
multi_array(const const_multi_array_ref<ValueType,NumDims>& x);
multi_array(const const_subarray<NumDims>::type& x);
multi_array(const const_array_view<NumDims>::type& x);
multi_array(const multi_array_ref<ValueType,NumDims>& x);
multi_array(const subarray<NumDims>::type& x);
multi_array(const array_view<NumDims>::type& x);]]>
multi_array(const const_multi_array_ref<ValueType,NumDims>& x,
const Allocator& alloc = Allocator());
multi_array(const const_subarray<NumDims>::type& x,
const Allocator& alloc = Allocator());
multi_array(const const_array_view<NumDims>::type& x,
const Allocator& alloc = Allocator());
multi_array(const multi_array_ref<ValueType,NumDims>& x,
const Allocator& alloc = Allocator());
multi_array(const subarray<NumDims>::type& x,
const Allocator& alloc = Allocator());
multi_array(const array_view<NumDims>::type& x,
const Allocator& alloc = Allocator());]]>
</programlisting></term>
<listitem>
<para>These constructors all constructs a <literal>multi_array</literal> and

View File

@@ -17,7 +17,7 @@ of the constructors.
<link linkend="MultiArray">MultiArray</link>,
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>.
and depending on the element type, it may also model
<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>.
<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
not described in the <literal>multi_array</literal> reference.
</para>
@@ -59,7 +59,10 @@ public:
template <std::size_t Dims> struct const_array_view;
// structors
static const std::size_t dimensionality = NumDims;
// constructors and destructors
template <typename ExtentList>
explicit multi_array_ref(element* data, const ExtentList& sizes,

View File

@@ -1,5 +1,8 @@
// Copyright 2002 The Trustees of Indiana University.
// Copyright 2018 Glen Joseph Fernandes
// (glenjofe@gmail.com)
// Use, modification and distribution is subject to 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)
@@ -18,6 +21,11 @@
// declaration and definition
//
#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wshadow"
#endif
#include "boost/multi_array/base.hpp"
#include "boost/multi_array/collection_concept.hpp"
#include "boost/multi_array/copy_array.hpp"
@@ -25,6 +33,8 @@
#include "boost/multi_array/subarray.hpp"
#include "boost/multi_array/multi_array_ref.hpp"
#include "boost/multi_array/algorithm.hpp"
#include "boost/multi_array/allocators.hpp"
#include "boost/core/empty_value.hpp"
#include "boost/array.hpp"
#include "boost/mpl/if.hpp"
#include "boost/type_traits.hpp"
@@ -109,8 +119,10 @@ struct disable_multi_array_impl<int>
template<typename T, std::size_t NumDims,
typename Allocator>
class multi_array :
public multi_array_ref<T,NumDims>
public multi_array_ref<T,NumDims>,
private boost::empty_value<Allocator>
{
typedef boost::empty_value<Allocator> alloc_base;
typedef multi_array_ref<T,NumDims> super_type;
public:
typedef typename super_type::value_type value_type;
@@ -137,22 +149,25 @@ public:
typedef boost::detail::multi_array::multi_array_view<T,NDims> type;
};
explicit multi_array() :
explicit multi_array(const Allocator& alloc = Allocator()) :
super_type((T*)initial_base_,c_storage_order(),
/*index_bases=*/0, /*extents=*/0) {
/*index_bases=*/0, /*extents=*/0),
alloc_base(boost::empty_init_t(),alloc) {
allocate_space();
}
template <class ExtentList>
explicit multi_array(
ExtentList const& extents
ExtentList const& extents,
const Allocator& alloc = Allocator()
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
, typename mpl::if_<
detail::multi_array::is_multi_array_impl<ExtentList>,
int&,int>::type* = 0
#endif
) :
super_type((T*)initial_base_,extents) {
super_type((T*)initial_base_,extents),
alloc_base(boost::empty_init_t(),alloc) {
boost::function_requires<
detail::multi_array::CollectionConcept<ExtentList> >();
allocate_space();
@@ -162,7 +177,8 @@ public:
template <class ExtentList>
explicit multi_array(ExtentList const& extents,
const general_storage_order<NumDims>& so) :
super_type((T*)initial_base_,extents,so) {
super_type((T*)initial_base_,extents,so),
alloc_base(boost::empty_init_t()) {
boost::function_requires<
detail::multi_array::CollectionConcept<ExtentList> >();
allocate_space();
@@ -172,7 +188,8 @@ public:
explicit multi_array(ExtentList const& extents,
const general_storage_order<NumDims>& so,
Allocator const& alloc) :
super_type((T*)initial_base_,extents,so), allocator_(alloc) {
super_type((T*)initial_base_,extents,so),
alloc_base(boost::empty_init_t(),alloc) {
boost::function_requires<
detail::multi_array::CollectionConcept<ExtentList> >();
allocate_space();
@@ -180,8 +197,10 @@ public:
explicit multi_array(const detail::multi_array
::extent_gen<NumDims>& ranges) :
super_type((T*)initial_base_,ranges) {
::extent_gen<NumDims>& ranges,
const Allocator& alloc = Allocator()) :
super_type((T*)initial_base_,ranges),
alloc_base(boost::empty_init_t(),alloc) {
allocate_space();
}
@@ -190,7 +209,8 @@ public:
explicit multi_array(const detail::multi_array
::extent_gen<NumDims>& ranges,
const general_storage_order<NumDims>& so) :
super_type((T*)initial_base_,ranges,so) {
super_type((T*)initial_base_,ranges,so),
alloc_base(boost::empty_init_t()) {
allocate_space();
}
@@ -200,13 +220,15 @@ public:
::extent_gen<NumDims>& ranges,
const general_storage_order<NumDims>& so,
Allocator const& alloc) :
super_type((T*)initial_base_,ranges,so), allocator_(alloc) {
super_type((T*)initial_base_,ranges,so),
alloc_base(boost::empty_init_t(),alloc) {
allocate_space();
}
multi_array(const multi_array& rhs) :
super_type(rhs), allocator_(rhs.allocator_) {
super_type(rhs),
alloc_base(static_cast<const alloc_base&>(rhs)) {
allocate_space();
boost::detail::multi_array::copy_n(rhs.base_,rhs.num_elements(),base_);
}
@@ -223,8 +245,10 @@ public:
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template <typename OPtr>
multi_array(const const_multi_array_ref<T,NumDims,OPtr>& rhs,
const general_storage_order<NumDims>& so = c_storage_order())
: super_type(0,so,rhs.index_bases(),rhs.shape())
const general_storage_order<NumDims>& so = c_storage_order(),
const Allocator& alloc = Allocator())
: super_type(0,so,rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
// Warning! storage order may change, hence the following copy technique.
@@ -234,8 +258,10 @@ public:
template <typename OPtr>
multi_array(const detail::multi_array::
const_sub_array<T,NumDims,OPtr>& rhs,
const general_storage_order<NumDims>& so = c_storage_order())
: super_type(0,so,rhs.index_bases(),rhs.shape())
const general_storage_order<NumDims>& so = c_storage_order(),
const Allocator& alloc = Allocator())
: super_type(0,so,rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -245,8 +271,10 @@ public:
template <typename OPtr>
multi_array(const detail::multi_array::
const_multi_array_view<T,NumDims,OPtr>& rhs,
const general_storage_order<NumDims>& so = c_storage_order())
: super_type(0,so,rhs.index_bases(),rhs.shape())
const general_storage_order<NumDims>& so = c_storage_order(),
const Allocator& alloc = Allocator())
: super_type(0,so,rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -256,8 +284,10 @@ public:
// More limited support for MSVC
multi_array(const const_multi_array_ref<T,NumDims>& rhs)
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
multi_array(const const_multi_array_ref<T,NumDims>& rhs,
const Allocator& alloc = Allocator())
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
// Warning! storage order may change, hence the following copy technique.
@@ -265,8 +295,10 @@ public:
}
multi_array(const const_multi_array_ref<T,NumDims>& rhs,
const general_storage_order<NumDims>& so)
: super_type(0,so,rhs.index_bases(),rhs.shape())
const general_storage_order<NumDims>& so,
const Allocator& alloc = Allocator())
: super_type(0,so,rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
// Warning! storage order may change, hence the following copy technique.
@@ -274,8 +306,10 @@ public:
}
multi_array(const detail::multi_array::
const_sub_array<T,NumDims>& rhs)
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
const_sub_array<T,NumDims>& rhs,
const Allocator& alloc = Allocator())
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -283,8 +317,10 @@ public:
multi_array(const detail::multi_array::
const_sub_array<T,NumDims>& rhs,
const general_storage_order<NumDims>& so)
: super_type(0,so,rhs.index_bases(),rhs.shape())
const general_storage_order<NumDims>& so,
const Allocator& alloc = Allocator())
: super_type(0,so,rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -292,8 +328,10 @@ public:
multi_array(const detail::multi_array::
const_multi_array_view<T,NumDims>& rhs)
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
const_multi_array_view<T,NumDims>& rhs,
const Allocator& alloc = Allocator())
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -301,8 +339,10 @@ public:
multi_array(const detail::multi_array::
const_multi_array_view<T,NumDims>& rhs,
const general_storage_order<NumDims>& so)
: super_type(0,so,rhs.index_bases(),rhs.shape())
const general_storage_order<NumDims>& so,
const Allocator& alloc = Allocator())
: super_type(0,so,rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -311,8 +351,10 @@ public:
#endif // !BOOST_NO_FUNCTION_TEMPLATE_ORDERING
// Thes constructors are necessary because of more exact template matches.
multi_array(const multi_array_ref<T,NumDims>& rhs)
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
multi_array(const multi_array_ref<T,NumDims>& rhs,
const Allocator& alloc = Allocator())
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
// Warning! storage order may change, hence the following copy technique.
@@ -320,8 +362,10 @@ public:
}
multi_array(const multi_array_ref<T,NumDims>& rhs,
const general_storage_order<NumDims>& so)
: super_type(0,so,rhs.index_bases(),rhs.shape())
const general_storage_order<NumDims>& so,
const Allocator& alloc = Allocator())
: super_type(0,so,rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
// Warning! storage order may change, hence the following copy technique.
@@ -330,8 +374,10 @@ public:
multi_array(const detail::multi_array::
sub_array<T,NumDims>& rhs)
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
sub_array<T,NumDims>& rhs,
const Allocator& alloc = Allocator())
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -339,8 +385,10 @@ public:
multi_array(const detail::multi_array::
sub_array<T,NumDims>& rhs,
const general_storage_order<NumDims>& so)
: super_type(0,so,rhs.index_bases(),rhs.shape())
const general_storage_order<NumDims>& so,
const Allocator& alloc = Allocator())
: super_type(0,so,rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -348,8 +396,10 @@ public:
multi_array(const detail::multi_array::
multi_array_view<T,NumDims>& rhs)
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
multi_array_view<T,NumDims>& rhs,
const Allocator& alloc = Allocator())
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -357,8 +407,10 @@ public:
multi_array(const detail::multi_array::
multi_array_view<T,NumDims>& rhs,
const general_storage_order<NumDims>& so)
: super_type(0,so,rhs.index_bases(),rhs.shape())
const general_storage_order<NumDims>& so,
const Allocator& alloc = Allocator())
: super_type(0,so,rhs.index_bases(),rhs.shape()),
alloc_base(boost::empty_init_t(),alloc)
{
allocate_space();
std::copy(rhs.begin(),rhs.end(),this->begin());
@@ -403,7 +455,7 @@ public:
// build a multi_array with the specs given
multi_array new_array(ranges,this->storage_order());
multi_array new_array(ranges,this->storage_order(),allocator());
// build a view of tmp with the minimum extents
@@ -449,6 +501,7 @@ public:
using std::swap;
// Swap the internals of these arrays.
swap(this->super_type::base_,new_array.super_type::base_);
swap(this->allocator(),new_array.allocator());
swap(this->storage_,new_array.storage_);
swap(this->extent_list_,new_array.extent_list_);
swap(this->stride_list_,new_array.stride_list_);
@@ -456,7 +509,6 @@ public:
swap(this->origin_offset_,new_array.origin_offset_);
swap(this->directional_offset_,new_array.directional_offset_);
swap(this->num_elements_,new_array.num_elements_);
swap(this->allocator_,new_array.allocator_);
swap(this->base_,new_array.base_);
swap(this->allocated_elements_,new_array.allocated_elements_);
@@ -469,26 +521,43 @@ public:
}
private:
friend inline bool operator==(const multi_array& a, const multi_array& b) {
return a.base() == b.base();
}
friend inline bool operator!=(const multi_array& a, const multi_array& b) {
return !(a == b);
}
const super_type& base() const {
return *this;
}
const Allocator& allocator() const {
return alloc_base::get();
}
Allocator& allocator() {
return alloc_base::get();
}
void allocate_space() {
typename Allocator::const_pointer no_hint=0;
base_ = allocator_.allocate(this->num_elements(),no_hint);
base_ = allocator().allocate(this->num_elements());
this->set_base_ptr(base_);
allocated_elements_ = this->num_elements();
std::uninitialized_fill_n(base_,allocated_elements_,T());
detail::multi_array::construct(allocator(),base_,base_+allocated_elements_);
}
void deallocate_space() {
if(base_) {
for(T* i = base_; i != base_+allocated_elements_; ++i)
allocator_.destroy(i);
allocator_.deallocate(base_,allocated_elements_);
detail::multi_array::destroy(allocator(),base_,base_+allocated_elements_);
allocator().deallocate(base_,allocated_elements_);
}
}
typedef boost::array<size_type,NumDims> size_list;
typedef boost::array<index,NumDims> index_list;
Allocator allocator_;
T* base_;
size_type allocated_elements_;
enum {initial_base_ = 0};
@@ -496,4 +565,8 @@ private:
} // namespace boost
#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406)
# pragma GCC diagnostic pop
#endif
#endif // BOOST_MULTI_ARRAY_RG071801_HPP

View File

@@ -40,7 +40,7 @@
// See http://www.boost.org/libs/multi_array for documentation.
#include "boost/iterator.hpp"
#include <iterator>
namespace boost {
namespace detail {

View File

@@ -0,0 +1,72 @@
// Copyright 2018 Glen Joseph Fernandes
// (glenjofe@gmail.com)
//
// 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)
#ifndef BOOST_MULTI_ARRAY_ALLOCATORS_HPP
#define BOOST_MULTI_ARRAY_ALLOCATORS_HPP
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#include <memory>
#else
#include <new>
#endif
namespace boost {
namespace detail {
namespace multi_array {
template<class A, class T>
inline void destroy(A& allocator, T* ptr, T* end)
{
for (; ptr != end; ++ptr) {
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
std::allocator_traits<A>::destroy(allocator,ptr);
#else
ptr->~T();
#endif
}
}
template<class A, class T>
inline void construct(A& allocator, T* ptr)
{
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
std::allocator_traits<A>::construct(allocator,ptr);
#else
::new(static_cast<void*>(ptr)) T();
#endif
}
#if !defined(BOOST_NO_EXCEPTIONS)
template<class A, class T>
inline void construct(A& allocator, T* ptr, T* end)
{
T* start = ptr;
try {
for (; ptr != end; ++ptr) {
boost::detail::multi_array::construct(allocator,ptr);
}
} catch (...) {
boost::detail::multi_array::destroy(allocator,start,ptr);
throw;
}
}
#else
template<class A, class T>
inline void construct(A& allocator, T* ptr, T* end)
{
for (; ptr != end; ++ptr) {
boost::detail::multi_array::construct(allocator,ptr);
}
}
#endif
} // multi_array
} // detail
} // boost
#endif

View File

@@ -29,7 +29,6 @@
#include "boost/mpl/eval_if.hpp"
#include "boost/mpl/if.hpp"
#include "boost/mpl/size_t.hpp"
#include "boost/mpl/aux_/msvc_eti_base.hpp"
#include "boost/iterator/reverse_iterator.hpp"
#include "boost/static_assert.hpp"
#include "boost/type.hpp"
@@ -65,7 +64,7 @@ namespace multi_array_types {
// object creation in small-memory environments. Thus, the objects
// can be left undefined by defining BOOST_MULTI_ARRAY_NO_GENERATORS
// before loading multi_array.hpp.
#if !BOOST_MULTI_ARRAY_NO_GENERATORS
#ifndef BOOST_MULTI_ARRAY_NO_GENERATORS
namespace {
multi_array_types::extent_gen extents;
multi_array_types::index_gen indices;
@@ -210,44 +209,11 @@ struct value_accessor_generator {
>::type type;
};
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
struct eti_value_accessor
{
typedef int index;
typedef int size_type;
typedef int element;
typedef int index_range;
typedef int value_type;
typedef int reference;
typedef int const_reference;
};
template <>
struct value_accessor_generator<int,int>
{
typedef eti_value_accessor type;
};
template <class T, class NumDims>
struct associated_types
: mpl::aux::msvc_eti_base<
typename value_accessor_generator<T,NumDims>::type
>::type
{};
template <>
struct associated_types<int,int> : eti_value_accessor {};
#else
template <class T, class NumDims>
struct associated_types
: value_accessor_generator<T,NumDims>::type
{};
#endif
//
// choose value accessor ends
/////////////////////////////////////////////////////////////////////////
@@ -272,13 +238,7 @@ struct mutable_iterator_tag
template <typename T, std::size_t NumDims>
class multi_array_impl_base
:
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
public mpl::aux::msvc_eti_base<
typename value_accessor_generator<T,mpl::size_t<NumDims> >::type
>::type
#else
public value_accessor_generator<T,mpl::size_t<NumDims> >::type
#endif
{
typedef associated_types<T,mpl::size_t<NumDims> > types;
public:
@@ -503,6 +463,7 @@ protected:
index bound_adjustment = stride < 0 ? 1 : 0;
BOOST_ASSERT(((index_bases[n] - bound_adjustment) <= finish) &&
(finish <= (index_bases[n] + index(extents[n]) - bound_adjustment)));
ignore_unused_variable_warning(bound_adjustment);
#endif // BOOST_DISABLE_ASSERTS

View File

@@ -39,8 +39,6 @@ namespace detail {
template <typename Array, typename IdxGen, typename Call_Type>
static void call(Array& a, const IdxGen& idgen, Call_Type c) {
typedef typename Array::index_range index_range;
typedef typename Array::index index;
idgen_helper<N-1>::call(a,idgen[c],c);
}
};
@@ -50,8 +48,6 @@ namespace detail {
template <typename Array, typename IdxGen, typename Call_Type>
static void call(Array& a, const IdxGen& idgen, Call_Type) {
typedef typename Array::index_range index_range;
typedef typename Array::index index;
a[ idgen ];
}
};

View File

@@ -107,6 +107,12 @@ namespace multi_array {
index stride() const { return stride_; }
size_type size(index idx) const
{
return (start_ == from_start() || finish_ == to_end())
? idx : ((finish_ - start_) / stride_);
}
void set_index_range(index start, index finish, index stride=1)
{
start_ = start;

View File

@@ -20,7 +20,6 @@
#include "boost/multi_array/base.hpp"
#include "boost/iterator/iterator_facade.hpp"
#include "boost/mpl/aux_/msvc_eti_base.hpp"
#include <algorithm>
#include <cstddef>
#include <iterator>
@@ -59,15 +58,9 @@ class array_iterator
, Reference
>
, private
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
mpl::aux::msvc_eti_base<typename
#endif
value_accessor_generator<T,NumDims>::type
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
>::type
#endif
{
friend class iterator_core_access;
friend class ::boost::iterator_core_access;
typedef detail::multi_array::associated_types<T,NumDims> access_t;
typedef iterator_facade<

View File

@@ -225,11 +225,7 @@ public:
}
// see generate_array_view in base.hpp
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <int NDims>
#else
template <int NumDims, int NDims> // else ICE
#endif // BOOST_MSVC
typename const_array_view<NDims>::type
operator[](const detail::multi_array::
index_gen<NumDims,NDims>& indices)
@@ -529,11 +525,7 @@ public:
// See note attached to generate_array_view in base.hpp
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <int NDims>
#else
template <int NumDims, int NDims> // else ICE
#endif // BOOST_MSVC
typename array_view<NDims>::type
operator[](const detail::multi_array::
index_gen<NumDims,NDims>& indices) {
@@ -591,11 +583,7 @@ public:
}
// See note attached to generate_array_view in base.hpp
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <int NDims>
#else
template <int NumDims, int NDims> // else ICE
#endif // BOOST_MSVC
typename const_array_view<NDims>::type
operator[](const detail::multi_array::
index_gen<NumDims,NDims>& indices)

View File

@@ -87,11 +87,7 @@ public:
}
// see generate_array_view in base.hpp
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <int NDims>
#else
template <int NumDims, int NDims> // else ICE
#endif // BOOST_MSVC
typename const_array_view<NDims>::type
operator[](const boost::detail::multi_array::
index_gen<NumDims,NDims>& indices)
@@ -267,11 +263,7 @@ public:
}
// see generate_array_view in base.hpp
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <int NDims>
#else
template <int NumDims, int NDims> // else ICE
#endif // BOOST_MSVC
typename array_view<NDims>::type
operator[](const boost::detail::multi_array::
index_gen<NumDims,NDims>& indices) {
@@ -332,11 +324,7 @@ public:
}
// see generate_array_view in base.hpp
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <int NDims>
#else
template <int NumDims, int NDims> // else ICE
#endif // BOOST_MSVC
typename const_array_view<NDims>::type
operator[](const boost::detail::multi_array::
index_gen<NumDims,NDims>& indices)

View File

@@ -135,11 +135,7 @@ public:
}
// see generate_array_view in base.hpp
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <int NDims>
#else
template <int NumDims, int NDims> // else ICE
#endif // BOOST_MSVC
typename const_array_view<NDims>::type
operator[](const boost::detail::multi_array::
index_gen<NumDims,NDims>& indices)
@@ -346,11 +342,7 @@ public:
// see generate_array_view in base.hpp
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <int NDims>
#else
template <int NumDims, int NDims> // else ICE
#endif // BOOST_MSVC
typename array_view<NDims>::type
operator[](const boost::detail::multi_array::
index_gen<NumDims,NDims>& indices) {
@@ -402,11 +394,7 @@ public:
}
// see generate_array_view in base.hpp
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <int NDims>
#else
template <int NumDims, int NDims> // else ICE
#endif // BOOST_MSVC
typename const_array_view<NDims>::type
operator[](const boost::detail::multi_array::
index_gen<NumDims,NDims>& indices)

15
meta/libraries.json Normal file
View File

@@ -0,0 +1,15 @@
{
"key": "multi_array",
"name": "Multi-Array",
"authors": [
"Ron Garcia"
],
"description": "Boost.MultiArray provides a generic N-dimensional array concept definition and common implementations of that interface.",
"category": [
"Containers",
"Math"
],
"maintainers": [
"Ronald Garcia <garcia -at- osl.iu.edu>"
]
}

View File

@@ -4,48 +4,48 @@
# "as is" without express or implied warranty, and with no claim as
# to its suitability for any purpose.
test-suite multi_array
:
[ compile-fail fail_cbracket.cpp ]
[ compile-fail fail_cdata.cpp ]
[ compile-fail fail_citerator.cpp ]
[ compile-fail fail_cparen.cpp ]
[ compile-fail fail_criterator.cpp ]
[ compile-fail fail_csubarray.cpp ]
[ compile-fail fail_csubarray2.cpp ]
[ compile-fail fail_csubarray3.cpp ]
[ compile-fail fail_cview.cpp ]
[ compile-fail fail_cview2.cpp ]
[ compile-fail fail_cview3.cpp ]
[ compile-fail fail_ref_cbracket.cpp ]
[ compile-fail fail_ref_cdata.cpp ]
[ compile-fail fail_ref_citerator.cpp ]
[ compile-fail fail_ref_cparen.cpp ]
[ compile-fail fail_ref_criterator.cpp ]
[ compile-fail fail_ref_csubarray.cpp ]
[ compile-fail fail_ref_csubarray2.cpp ]
[ compile-fail fail_ref_csubarray3.cpp ]
[ compile-fail fail_ref_cview.cpp ]
[ compile-fail fail_ref_cview2.cpp ]
[ compile-fail fail_ref_cview3.cpp ]
[ run constructors.cpp ../../test/build//boost_test_exec_monitor ]
[ run access.cpp ../../test/build//boost_test_exec_monitor ]
[ run compare.cpp ../../test/build//boost_test_exec_monitor ]
[ run iterators.cpp ../../test/build//boost_test_exec_monitor ]
[ run slice.cpp ../../test/build//boost_test_exec_monitor ]
[ run assign.cpp ../../test/build//boost_test_exec_monitor ]
[ run assign_to_array.cpp ../../test/build//boost_test_exec_monitor ]
[ run index_bases.cpp ../../test/build//boost_test_exec_monitor ]
[ run storage_order_convert.cpp ../../test/build//boost_test_exec_monitor ]
[ run storage_order.cpp ../../test/build//boost_test_exec_monitor ]
[ run reshape.cpp ../../test/build//boost_test_exec_monitor ]
[ run range1.cpp ../../test/build//boost_test_exec_monitor ]
[ run idxgen1.cpp ../../test/build//boost_test_exec_monitor ]
[ run stl_interaction.cpp ../../test/build//boost_test_exec_monitor ]
[ run resize.cpp ../../test/build//boost_test_exec_monitor ]
[ run assert.cpp ../../test/build//boost_test_exec_monitor ]
[ run reverse_view.cpp ../../test/build//boost_test_exec_monitor ]
import testing ;
[ compile concept_checks.cpp ]
;
compile-fail fail_cbracket.cpp ;
compile-fail fail_cdata.cpp ;
compile-fail fail_citerator.cpp ;
compile-fail fail_cparen.cpp ;
compile-fail fail_criterator.cpp ;
compile-fail fail_csubarray.cpp ;
compile-fail fail_csubarray2.cpp ;
compile-fail fail_csubarray3.cpp ;
compile-fail fail_cview.cpp ;
compile-fail fail_cview2.cpp ;
compile-fail fail_cview3.cpp ;
compile-fail fail_ref_cbracket.cpp ;
compile-fail fail_ref_cdata.cpp ;
compile-fail fail_ref_citerator.cpp ;
compile-fail fail_ref_cparen.cpp ;
compile-fail fail_ref_criterator.cpp ;
compile-fail fail_ref_csubarray.cpp ;
compile-fail fail_ref_csubarray2.cpp ;
compile-fail fail_ref_csubarray3.cpp ;
compile-fail fail_ref_cview.cpp ;
compile-fail fail_ref_cview2.cpp ;
compile-fail fail_ref_cview3.cpp ;
run constructors.cpp ;
run access.cpp ;
run compare.cpp ;
run iterators.cpp ;
run slice.cpp ;
run assign.cpp ;
run assign_to_array.cpp ;
run index_bases.cpp ;
run storage_order_convert.cpp ;
run storage_order.cpp ;
run reshape.cpp ;
run range1.cpp ;
run idxgen1.cpp ;
run stl_interaction.cpp ;
run resize.cpp ;
run assert.cpp ;
run reverse_view.cpp ;
run allocators.cpp ;
compile concept_checks.cpp ;

View File

@@ -16,7 +16,7 @@
//
#include "generative_tests.hpp"
#include "boost/static_assert.hpp"
#include <boost/static_assert.hpp>
template <typename Array>
void access(Array& A, const mutable_array_tag&) {
@@ -42,8 +42,8 @@ void access(Array& A, const const_array_tag&) {
for (index i = idx0; i != idx0+2; ++i)
for (index j = idx1; j != idx1+3; ++j)
for (index k = idx2; k != idx2+4; ++k) {
BOOST_CHECK(A[i][j][k] == cnum++);
BOOST_CHECK(CA[i][j][k] == A[i][j][k]);
BOOST_TEST(A[i][j][k] == cnum++);
BOOST_TEST(CA[i][j][k] == A[i][j][k]);
}
// operator()
@@ -52,12 +52,12 @@ void access(Array& A, const const_array_tag&) {
for (index k2 = idx2; k2 != idx2+4; ++k2) {
boost::array<index,ndims> indices;
indices[0] = i2; indices[1] = j2; indices[2] = k2;
BOOST_CHECK(A(indices) == A[i2][j2][k2]);
BOOST_CHECK(CA(indices) == A(indices));
BOOST_TEST(A(indices) == A[i2][j2][k2]);
BOOST_TEST(CA(indices) == A(indices));
}
++tests_run;
}
int test_main(int,char*[]) {
int main() {
return run_generative_tests();
}

151
test/allocators.cpp Normal file
View File

@@ -0,0 +1,151 @@
// Copyright 2019 Glen Joseph Fernandes
// (glenjofe@gmail.com)
//
// 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)
#include <boost/core/lightweight_test.hpp>
#include <boost/multi_array.hpp>
#include <algorithm>
template<class T>
class creator {
public:
typedef T value_type;
typedef T* pointer;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
template<class U>
struct rebind {
typedef creator<U> other;
};
creator(int state)
: state_(state) { }
template<class U>
creator(const creator<U>& other)
: state_(other.state()) { }
T* allocate(std::size_t size) {
return static_cast<T*>(::operator new(sizeof(T) * size));
}
void deallocate(T* ptr, std::size_t) {
::operator delete(ptr);
}
int state() const {
return state_;
}
private:
int state_;
};
template<class T, class U>
inline bool
operator==(const creator<T>& a, const creator<U>& b)
{
return a.state() == b.state();
}
template<class T, class U>
inline bool
operator!=(const creator<T>& a, const creator<U>& b)
{
return !(a == b);
}
void test(const double&, std::size_t*, int*, unsigned)
{
}
template<class Array>
void test(const Array& array, std::size_t* sizes, int* strides,
unsigned elements)
{
BOOST_TEST(array.num_elements() == elements);
BOOST_TEST(array.size() == *sizes);
BOOST_TEST(std::equal(sizes, sizes + array.num_dimensions(), array.shape()));
BOOST_TEST(std::equal(strides, strides + array.num_dimensions(),
array.strides()));
test(array[0], ++sizes, ++strides, elements / array.size());
}
bool test(const double& a, const double& b)
{
return a == b;
}
template<class A1, class A2>
bool test(const A1& a1, const A2& a2)
{
typename A1::const_iterator i1 = a1.begin();
typename A2::const_iterator i2 = a2.begin();
for (; i1 != a1.end(); ++i1, ++i2) {
if (!test(*i1, *i2)) {
return false;
}
}
return true;
}
int main()
{
typedef boost::multi_array<double, 3, creator<double> > type;
creator<double> state(1);
{
type array(state);
}
boost::array<type::size_type, 3> sizes = { { 3, 3, 3 } };
type::size_type elements = 27;
{
int strides[] = { 9, 3, 1 };
type array(sizes, state);
test(array, &sizes[0], strides, elements);
}
{
int strides[] = { 1, 3, 9 };
type array(sizes, boost::fortran_storage_order(), state);
test(array, &sizes[0], strides, elements);
}
{
int strides[] = { 9, 3, 1 };
type::extent_gen extents;
type array(extents[3][3][3], state);
test(array, &sizes[0], strides, elements);
}
{
type array1(sizes, state);
std::vector<double> values(elements, 4.5);
array1.assign(values.begin(), values.end());
type array2(array1);
int strides[] = { 9, 3, 1 };
test(array2, &sizes[0], strides, elements);
BOOST_TEST(test(array1, array2));
}
{
type array1(sizes, state);
type array2(sizes, state);
std::vector<double> values(elements, 4.5);
array1.assign(values.begin(), values.end());
array2 = array1;
int strides[] = { 9, 3, 1 };
test(array2, &sizes[0], strides, elements);
BOOST_TEST(test(array1, array2));
}
{
type array1(sizes, state);
std::vector<double> values(elements, 4.5);
array1.assign(values.begin(), values.end());
typedef type::subarray<2>::type other;
other array2 = array1[1];
other::value_type value = array2[0];
BOOST_TEST(test(array1[1][0], value));
BOOST_TEST(test(array2[0], value));
}
return boost::report_errors();
}

View File

@@ -15,10 +15,10 @@
// with exceptions
//
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#define BOOST_ENABLE_ASSERT_HANDLER
#include "boost/multi_array.hpp" // includes assert.hpp
#include <boost/multi_array.hpp> // includes assert.hpp
#include <stdexcept>
@@ -40,7 +40,7 @@ namespace boost {
using namespace boost;
int
test_main(int,char*[]) {
main() {
typedef multi_array<int,2> array_t;
@@ -55,5 +55,5 @@ test_main(int,char*[]) {
//...all good
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,9 +15,9 @@
//
//
#include "generative_tests.hpp"
#include "boost/array.hpp"
#include "boost/multi_array.hpp"
#include "boost/cstdlib.hpp"
#include <boost/array.hpp>
#include <boost/multi_array.hpp>
#include <boost/cstdlib.hpp>
#include <algorithm>
#include <iostream>
@@ -59,7 +59,7 @@ void access(Array& A, const mutable_array_tag&) {
A = filler;
BOOST_CHECK(::equal(A,filler));
BOOST_TEST(::equal(A,filler));
++tests_run;
}
@@ -68,6 +68,6 @@ void access(Array&, const const_array_tag&) {
}
int test_main(int,char*[]) {
int main() {
return run_generative_tests();
}

View File

@@ -16,9 +16,9 @@
//
//
#include "generative_tests.hpp"
#include "boost/array.hpp"
#include "boost/multi_array.hpp"
#include "boost/cstdlib.hpp"
#include <boost/array.hpp>
#include <boost/multi_array.hpp>
#include <boost/cstdlib.hpp>
#include <algorithm>
#include <iostream>
@@ -50,11 +50,11 @@ template <typename Array>
void access(Array& A, const const_array_tag&) {
typedef boost::multi_array<int,3> array3;
array3 acopy(A);
BOOST_CHECK(::equal(acopy,A));
BOOST_TEST(::equal(acopy,A));
++tests_run;
}
int test_main(int,char*[]) {
int main() {
return run_generative_tests();
}

View File

@@ -12,16 +12,16 @@
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include <algorithm>
#include <list>
int
test_main(int, char*[])
main()
{
typedef boost::multi_array<double, 3> array;
typedef array::size_type size_type;
@@ -34,9 +34,9 @@ test_main(int, char*[])
std::vector<double> vals(num_elements, 4.5);
A.assign(vals.begin(),vals.end());
array B(A);
BOOST_CHECK(A == B);
BOOST_CHECK(B == A);
BOOST_CHECK(A[0] == B[0]);
BOOST_TEST(A == B);
BOOST_TEST(B == A);
BOOST_TEST(A[0] == B[0]);
}
// Assignment Operator
{
@@ -44,15 +44,15 @@ test_main(int, char*[])
std::vector<double> vals(num_elements, 4.5);
A.assign(vals.begin(),vals.end());
B = A;
BOOST_CHECK(A == B);
BOOST_CHECK(B == A);
BOOST_CHECK(B[0] == A[0]);
BOOST_TEST(A == B);
BOOST_TEST(B == A);
BOOST_TEST(B[0] == A[0]);
typedef array::index_range range;
array::index_gen indices;
array::array_view<2>::type C = A[indices[2][range()][range()]];
array::array_view<2>::type D = B[indices[2][range()][range()]];
BOOST_CHECK(C == D);
BOOST_TEST(C == D);
}
// Different Arrays
{
@@ -62,15 +62,15 @@ test_main(int, char*[])
A.assign(valsA.begin(),valsA.end());
B.assign(valsB.begin(),valsB.end());
BOOST_CHECK(A != B);
BOOST_CHECK(B != A);
BOOST_CHECK(A[0] != B[0]);
BOOST_TEST(A != B);
BOOST_TEST(B != A);
BOOST_TEST(A[0] != B[0]);
typedef array::index_range range;
array::index_gen indices;
array::array_view<2>::type C = A[indices[2][range()][range()]];
array::array_view<2>::type D = B[indices[2][range()][range()]];
BOOST_CHECK(C != D);
BOOST_TEST(C != D);
}
// Comparisons galore!
@@ -108,35 +108,35 @@ test_main(int, char*[])
A.assign(valsA,valsA+num_elements);
B.assign(valsB,valsB+num_elements);
BOOST_CHECK(B < A);
BOOST_CHECK(A > B);
BOOST_TEST(B < A);
BOOST_TEST(A > B);
BOOST_CHECK(B <= A);
BOOST_CHECK(A >= B);
BOOST_TEST(B <= A);
BOOST_TEST(A >= B);
BOOST_CHECK(B[0] == A[0]);
BOOST_CHECK(B[2] < A[2]);
BOOST_TEST(B[0] == A[0]);
BOOST_TEST(B[2] < A[2]);
array C = A;
BOOST_CHECK(C <= A);
BOOST_CHECK(C >= A);
BOOST_TEST(C <= A);
BOOST_TEST(C >= A);
BOOST_CHECK(!(C < A));
BOOST_CHECK(!(C > A));
BOOST_TEST(!(C < A));
BOOST_TEST(!(C > A));
typedef array::index_range range;
array::index_gen indices;
array::array_view<2>::type D = A[indices[2][range()][range()]];
array::array_view<2>::type E = B[indices[2][range()][range()]];
BOOST_CHECK(E < D);
BOOST_CHECK(E <= D);
BOOST_TEST(E < D);
BOOST_TEST(E <= D);
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,18 +15,18 @@
// make sure the types meet concept requirements
//
#include "boost/concept_check.hpp"
#include "boost/multi_array/concept_checks.hpp"
#include "boost/multi_array.hpp"
#include <boost/concept_check.hpp>
#include <boost/multi_array/concept_checks.hpp>
#include <boost/multi_array.hpp>
#include "boost/cstdlib.hpp"
#include <boost/cstdlib.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;

View File

@@ -15,9 +15,9 @@
//
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include <algorithm>
#include <list>
@@ -30,10 +30,10 @@ void check_shape(const Array& A,
int* strides,
unsigned int num_elements)
{
BOOST_CHECK(A.num_elements() == num_elements);
BOOST_CHECK(A.size() == *sizes);
BOOST_CHECK(std::equal(sizes, sizes + A.num_dimensions(), A.shape()));
BOOST_CHECK(std::equal(strides, strides + A.num_dimensions(), A.strides()));
BOOST_TEST(A.num_elements() == num_elements);
BOOST_TEST(A.size() == *sizes);
BOOST_TEST(std::equal(sizes, sizes + A.num_dimensions(), A.shape()));
BOOST_TEST(std::equal(strides, strides + A.num_dimensions(), A.strides()));
check_shape(A[0], ++sizes, ++strides, num_elements / A.size());
}
@@ -56,7 +56,7 @@ bool equal(const ArrayA& A, const ArrayB& B)
int
test_main(int, char*[])
main()
{
typedef boost::multi_array<double, 3>::size_type size_type;
boost::array<size_type,3> sizes = { { 3, 3, 3 } };
@@ -132,20 +132,20 @@ test_main(int, char*[])
A.assign(vals.begin(),vals.end());
boost::multi_array<double, 3> B(A);
check_shape(B, &sizes[0], strides, num_elements);
BOOST_CHECK(::equal(A, B));
BOOST_TEST(::equal(A, B));
double ptr[27];
boost::multi_array_ref<double, 3> C(ptr,sizes);
A.assign(vals.begin(),vals.end());
boost::multi_array_ref<double, 3> D(C);
check_shape(D, &sizes[0], strides, num_elements);
BOOST_CHECK(C.data() == D.data());
BOOST_TEST(C.data() == D.data());
const double* cptr = ptr;
boost::const_multi_array_ref<double, 3> E(cptr,sizes);
boost::const_multi_array_ref<double, 3> F(E);
check_shape(F, &sizes[0], strides, num_elements);
BOOST_CHECK(E.data() == F.data());
BOOST_TEST(E.data() == F.data());
}
@@ -161,15 +161,15 @@ test_main(int, char*[])
boost::const_multi_array_ref<double, 3> C(A);
check_shape(B, &sizes[0], strides, num_elements);
check_shape(C, &sizes[0], strides, num_elements);
BOOST_CHECK(B.data() == A.data());
BOOST_CHECK(C.data() == A.data());
BOOST_TEST(B.data() == A.data());
BOOST_TEST(C.data() == A.data());
double ptr[27];
boost::multi_array_ref<double, 3> D(ptr,sizes);
D.assign(vals.begin(),vals.end());
boost::const_multi_array_ref<double, 3> E(D);
check_shape(E, &sizes[0], strides, num_elements);
BOOST_CHECK(E.data() == D.data());
BOOST_TEST(E.data() == D.data());
}
// Assignment Operator
@@ -182,7 +182,7 @@ test_main(int, char*[])
A.assign(vals.begin(),vals.end());
B = A;
check_shape(B, &sizes[0], strides, num_elements);
BOOST_CHECK(::equal(A, B));
BOOST_TEST(::equal(A, B));
double ptr1[27];
double ptr2[27];
@@ -190,7 +190,7 @@ test_main(int, char*[])
C.assign(vals.begin(),vals.end());
D = C;
check_shape(D, &sizes[0], strides, num_elements);
BOOST_CHECK(::equal(C,D));
BOOST_TEST(::equal(C,D));
}
@@ -209,10 +209,10 @@ test_main(int, char*[])
subarray::value_type C = B[0];
// should comparisons between the types work?
BOOST_CHECK(::equal(A[1][0],C));
BOOST_CHECK(::equal(B[0],C));
BOOST_TEST(::equal(A[1][0],C));
BOOST_TEST(::equal(B[0],C));
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -13,9 +13,9 @@
//
// Trying to diagnose problems under visual
#include "boost/config.hpp"
#include "boost/array.hpp"
#include "boost/limits.hpp"
#include <boost/config.hpp>
#include <boost/array.hpp>
#include <boost/limits.hpp>
#include <algorithm>
#include <utility>

View File

@@ -15,14 +15,14 @@
// checking constness of const operator[].
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -36,5 +36,5 @@ test_main(int,char*[])
// FAIL! cannot assign to csma.
csma[0][0][0] = 5;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing data() member function constness.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -37,5 +37,5 @@ test_main(int,char*[])
// FAIL! data() returns a const int*
*csma.data() = 0;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,12 +15,12 @@
// const_iterator/iterator conversion test
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
int test_main(int,char*[]) {
int main() {
typedef boost::multi_array<int,3> array;
typedef array::iterator iterator1;
@@ -29,5 +29,5 @@ int test_main(int,char*[]) {
// ILLEGAL conversion from const_iterator to iterator
iterator1 in = citerator1();
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing const operator() constness.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -40,5 +40,5 @@ test_main(int,char*[])
// FAIL! Cannot assign to csma
csma(indices) = 5;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,12 +15,12 @@
// const_reverse_iterator/reverse_iterator conversion test
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
int test_main(int,char*[]) {
int main() {
typedef boost::multi_array<int,3> array;
typedef array::reverse_iterator riterator1;
@@ -29,5 +29,5 @@ int test_main(int,char*[]) {
// ILLEGAL conversion from const_reverse_iterator to reverse_iterator
riterator1 in = criterator1();
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing subarray and const_subarray assignment
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -42,5 +42,5 @@ test_main(int,char*[])
// FAIL! Preserve constness (no const_subarray -> subarray conversion).
array::subarray<ndims-1>::type sba = csba;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing constness of subarray operations.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -41,5 +41,5 @@ test_main(int,char*[])
// FAIL! preserve constness.
array::subarray<ndims-1>::type sba = sma_const[0];
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing constness of subarray operations.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -45,5 +45,5 @@ test_main(int,char*[])
// FAIL! sba cannot be assigned to.
sba[j][k] = num++;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,15 +15,15 @@
// ensure const_array_view doesn't allow element assignment.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include "boost/type.hpp"
#include <boost/array.hpp>
#include <boost/type.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -54,7 +54,7 @@ test_main(int,char*[])
// FAIL! const_array_view cannot be assigned to.
csma2(elmt) = 5;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,17 +15,17 @@
// ensure const_array_view cannot be converted to array_view
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#define BOOST_INCLUDE_MAIN
#include "boost/test/test_tools.hpp"
#include <boost/test/test_tools.hpp>
#include "boost/array.hpp"
#include "boost/type.hpp"
#include "boost/cstdlib.hpp"
#include <boost/array.hpp>
#include <boost/type.hpp>
#include <boost/cstdlib.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -52,7 +52,7 @@ test_main(int,char*[])
array::array_view<ndims>::type csma2 =
csma[indices[range(0,2)][range(1,3)][range(0,4,2)]];
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,15 +15,15 @@
// ensure const_array_ref doesn't allow assignment.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include "boost/type.hpp"
#include <boost/array.hpp>
#include <boost/type.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -55,7 +55,7 @@ test_main(int,char*[])
// FAIL! csma2 cannot be assigned to.
csma2[i][j][k] = 0;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// checking constness of const operator[].
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array_ref<int,ndims> array_ref;
@@ -40,5 +40,5 @@ test_main(int,char*[])
// FAIL! can't assign to const multi_array_ref.
csma[0][0][0] = 5;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing data() member function constness.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array_ref<int,ndims> array_ref;
@@ -36,5 +36,5 @@ test_main(int,char*[])
// FAIL! data() returns const int*.
*csma.data() = 0;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,12 +15,12 @@
// const_iterator/iterator conversion test
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
int test_main(int,char*[]) {
int main() {
typedef boost::multi_array_ref<int,3> array_ref;
typedef array_ref::iterator iterator1;
@@ -29,5 +29,5 @@ int test_main(int,char*[]) {
// FAIL! ILLEGAL conversion from const_iterator to iterator
iterator1 in = citerator1();
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing const operator() constness.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array_ref<int,ndims> array_ref;
@@ -40,5 +40,5 @@ test_main(int,char*[])
// FAIL! cannot assign to a const multi_array_ref
csma(indices) = 5;
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,12 +15,12 @@
// const_reverse_iterator/reverse_iterator conversion test
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
int test_main(int,char*[]) {
int main() {
typedef boost::multi_array_ref<int,3> array_ref;
typedef array_ref::reverse_iterator riterator1;
@@ -29,5 +29,5 @@ int test_main(int,char*[]) {
// Fail! ILLEGAL conversion from const_reverse_iterator to reverse_iterator
riterator1 in = criterator1();
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing subarray and const_subarray assignment
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array_ref<int,ndims> array_ref;
@@ -44,5 +44,5 @@ test_main(int,char*[])
array_ref::subarray<ndims-1>::type sba = csba; // FAIL! preserve constness.
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing constness of subarray operations.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array_ref<int,ndims> array_ref;
@@ -45,5 +45,5 @@ test_main(int,char*[])
array_ref::subarray<ndims-1>::type sba = sma_const[0]; // FAIL!
// preserve constness
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,14 +15,14 @@
// Testing constness of subarray operations.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array_ref<int,ndims> array_ref;
@@ -48,5 +48,5 @@ test_main(int,char*[])
for (array_ref::index k = 0; k != 4; ++k)
sba[j][k] = num++; // FAIL! can't assign to const_subarray.
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,15 +15,15 @@
// ensure const_array_view doesn't allow element assignment.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include "boost/type.hpp"
#include <boost/array.hpp>
#include <boost/type.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array_ref<int,ndims> array_ref;
@@ -51,7 +51,7 @@ test_main(int,char*[])
csma2(elmt) = 5; // FAIL! csma is read only
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,15 +15,15 @@
// ensure const_array_view cannot be converted to array_view
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include "boost/type.hpp"
#include <boost/array.hpp>
#include <boost/type.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array_ref<int,ndims> array_ref;
@@ -52,7 +52,7 @@ test_main(int,char*[])
for (array_ref::index k = 0; k != 2; ++k)
csma2[i][j][k] = 0; // FAIL! csma2 is read only
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,15 +15,15 @@
// ensure const_array_view doesn't allow assignment.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include "boost/type.hpp"
#include <boost/array.hpp>
#include <boost/type.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array_ref<int,ndims> array_ref;
@@ -53,7 +53,7 @@ test_main(int,char*[])
for (array_ref::index k = 0; k != 2; ++k)
csma2[i][j][k] = 0; // FAIL! csma2 is read only.
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -45,9 +45,9 @@
//
// int test_main(int,char*[]) { return run_generative_tests(); }
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp> /* BOOST_NO_SFINAE */
#include <algorithm>
@@ -100,7 +100,7 @@ template <typename Array>
void access(Array& A, const const_array_tag&);
template <typename StorageOrder3,typename StorageOrder4,typename Modifier>
int run_configuration(const StorageOrder3& so3,
void run_configuration(const StorageOrder3& so3,
const StorageOrder4& so4,
const Modifier& modifier) {
// multi_array
@@ -213,11 +213,10 @@ int run_configuration(const StorageOrder3& so3,
access(C,const_array_tag());
}
}
return boost::exit_success;
}
template <typename ArrayModifier>
int run_storage_tests(const ArrayModifier& modifier) {
void run_storage_tests(const ArrayModifier& modifier) {
run_configuration(boost::c_storage_order(),
boost::c_storage_order(),modifier);
run_configuration(boost::fortran_storage_order(),
@@ -228,8 +227,6 @@ int run_storage_tests(const ArrayModifier& modifier) {
run_configuration(boost::general_storage_order<3>(ordering,ascending),
boost::general_storage_order<4>(ordering,ascending),
modifier);
return boost::exit_success;
}
struct null_modifier {
@@ -279,7 +276,7 @@ int run_generative_tests() {
run_storage_tests(reindex_modifier());
run_storage_tests(reshape_modifier());
std::cout << "Total Tests Run: " << tests_run << '\n';
return boost::exit_success;
return boost::report_errors();
}
#endif // GENERATIVE_TESTS_RG072001_HPP

View File

@@ -14,12 +14,12 @@
// idxset1.cpp - testing the code for index_gen
//
#include "boost/multi_array/index_gen.hpp"
#include "boost/multi_array/index_range.hpp"
#include "boost/multi_array/types.hpp"
#include "boost/test/minimal.hpp"
#include <boost/multi_array/index_gen.hpp>
#include <boost/multi_array/index_range.hpp>
#include <boost/multi_array/types.hpp>
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
typedef boost::detail::multi_array::index index_type;
typedef boost::detail::multi_array::size_type size_type;
@@ -37,7 +37,7 @@ bool operator==(const range& lhs,const range& rhs) {
}
int
test_main(int,char*[])
main()
{
boost::detail::multi_array::index_gen<0,0> indices;
@@ -62,20 +62,20 @@ test_main(int,char*[])
{
boost::detail::multi_array::index_gen<3,3> is1 =
indices[range(0,1,2)][range(1,2,3)][range(2,3,4)];
BOOST_CHECK(is1.ranges_[0] == range(0,1,2));
BOOST_CHECK(is1.ranges_[1] == range(1,2,3));
BOOST_CHECK(is1.ranges_[2] == range(2,3,4));
BOOST_TEST(is1.ranges_[0] == range(0,1,2));
BOOST_TEST(is1.ranges_[1] == range(1,2,3));
BOOST_TEST(is1.ranges_[2] == range(2,3,4));
}
{
boost::detail::multi_array::index_gen<3,2> is2 =
indices[range(0,1,2)][2][range(2,3,4)];
BOOST_CHECK(is2.ranges_[0] == range(0,1,2));
BOOST_CHECK(is2.ranges_[1] == range(2));
BOOST_CHECK(is2.ranges_[1].is_degenerate());
BOOST_CHECK(is2.ranges_[2] == range(2,3,4));
BOOST_TEST(is2.ranges_[0] == range(0,1,2));
BOOST_TEST(is2.ranges_[1] == range(2));
BOOST_TEST(is2.ranges_[1].is_degenerate());
BOOST_TEST(is2.ranges_[2] == range(2,3,4));
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -14,15 +14,15 @@
// index_bases - test of the index_base modifying facilities.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
#include <vector>
#include <iostream>
int
test_main(int,char*[])
main()
{
typedef boost::multi_array<double, 3> array;
typedef boost::multi_array_ref<double, 3> array_ref;
@@ -63,11 +63,11 @@ test_main(int,char*[])
for (size_type a = 0; a < A.shape()[0]; ++a)
for (size_type b = 0; b < A.shape()[1]; ++b)
for (size_type c = 0; c < A.shape()[2]; ++c) {
BOOST_CHECK(A[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_CHECK(C[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_CHECK(D[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_TEST(A[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_TEST(C[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_TEST(D[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
// Test that E does not inherit A's index_base
BOOST_CHECK(E[a][b][c] == B[a][b][c]);
BOOST_TEST(E[a][b][c] == B[a][b][c]);
}
}
@@ -100,10 +100,10 @@ test_main(int,char*[])
for (size_type a = 0; a < A.shape()[0]; ++a)
for (size_type b = 0; b < A.shape()[1]; ++b)
for (size_type c = 0; c < A.shape()[2]; ++c) {
BOOST_CHECK(A[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_CHECK(C[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_CHECK(D[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_CHECK(E[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_TEST(A[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_TEST(C[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_TEST(D[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
BOOST_TEST(E[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
}
}
@@ -142,12 +142,12 @@ test_main(int,char*[])
for (size_type a = 0; a < A.shape()[0]; ++a)
for (size_type b = 0; b < A.shape()[1]; ++b)
for (size_type c = 0; c < A.shape()[2]; ++c) {
BOOST_CHECK(A[a+1][b+1][c+1] == B[a][b][c]);
BOOST_CHECK(C[a+1][b+1][c+1] == B[a][b][c]);
BOOST_CHECK(D[a+1][b+1][c+1] == B[a][b][c]);
BOOST_CHECK(E[a+1][b+1][c+1] == B[a][b][c]);
BOOST_TEST(A[a+1][b+1][c+1] == B[a][b][c]);
BOOST_TEST(C[a+1][b+1][c+1] == B[a][b][c]);
BOOST_TEST(D[a+1][b+1][c+1] == B[a][b][c]);
BOOST_TEST(E[a+1][b+1][c+1] == B[a][b][c]);
}
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -17,9 +17,9 @@
#define MULTIARRAY_TEST_ASSIGN
#include "generative_tests.hpp"
#include "boost/concept_check.hpp" // for ignore_unused_variable_warning
#include "boost/mpl/if.hpp"
#include "boost/type_traits/is_same.hpp"
#include <boost/concept_check.hpp> // for ignore_unused_variable_warning
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_same.hpp>
// iterator-test-specific code
@@ -107,8 +107,8 @@ void test_iterators(Array& A, const IterTraits&) {
typedef typename IterTraits::iterator3 iterator;
iterator i1 = A.begin();
iterator i2 = A.end();
BOOST_CHECK(i1 < i2);
BOOST_CHECK((i2 - i1) == typename iterator::difference_type(2));
BOOST_TEST(i1 < i2);
BOOST_TEST((i2 - i1) == typename iterator::difference_type(2));
}
// Standard Array Iteration
@@ -121,7 +121,7 @@ void test_iterators(Array& A, const IterTraits&) {
for (iterator3 i = A.begin(); i != A.end(); ++i)
for(iterator2 ii = (*i).begin(); ii != (*i).end(); ++ii)
for(iterator1 iii = (*ii).begin(); iii != (*ii).end(); ++iii)
BOOST_CHECK(*iii == vals++);
BOOST_TEST(*iii == vals++);
}
// Using operator->() on iterators
@@ -134,7 +134,7 @@ void test_iterators(Array& A, const IterTraits&) {
for (iterator3 i = A.begin(); i != A.end(); ++i)
for(iterator2 ii = i->begin(); ii != i->end(); ++ii)
for(iterator1 iii = ii->begin(); iii != ii->end(); ++iii)
BOOST_CHECK(*iii == vals++);
BOOST_TEST(*iii == vals++);
}
// Reverse Iterator Hierarchy Test
@@ -148,7 +148,7 @@ void test_iterators(Array& A, const IterTraits&) {
for(riterator2 ii = (*i).rbegin(); ii != (riterator2)(*i).rend(); ++ii)
for(riterator1 iii = (*ii).rbegin(); iii != (riterator1)(*ii).rend();
++iii)
BOOST_CHECK(*iii == check_iter_val--);
BOOST_TEST(*iii == check_iter_val--);
}
++tests_run;
}
@@ -182,7 +182,7 @@ void access(Array& A, const const_array_tag&) {
int
test_main(int, char*[])
main()
{
return run_generative_tests();
}

View File

@@ -15,91 +15,100 @@
//
#include "boost/multi_array/index_range.hpp"
#include <boost/multi_array/index_range.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
#include <cstddef>
int
test_main(int,char*[])
main()
{
typedef boost::detail::multi_array::index_range<int,std::size_t> range;
{
// typical range creation and extraction
range r1(-3,5);
BOOST_CHECK(r1.start() == -3);
BOOST_CHECK(r1.finish() == 5);
BOOST_CHECK(r1.stride() == 1);
BOOST_CHECK(!r1.is_degenerate());
BOOST_CHECK(r1.get_start(0) == -3);
BOOST_CHECK(r1.get_finish(100) == 5);
BOOST_TEST(r1.start() == -3);
BOOST_TEST(r1.finish() == 5);
BOOST_TEST(r1.stride() == 1);
BOOST_TEST(r1.size(0) == 8);
BOOST_TEST(!r1.is_degenerate());
BOOST_TEST(r1.get_start(0) == -3);
BOOST_TEST(r1.get_finish(100) == 5);
}
{
range r2(-3,5,2);
BOOST_CHECK(r2.start() == -3);
BOOST_CHECK(r2.finish() == 5);
BOOST_CHECK(r2.stride() == 2);
BOOST_CHECK(!r2.is_degenerate());
BOOST_TEST(r2.start() == -3);
BOOST_TEST(r2.finish() == 5);
BOOST_TEST(r2.stride() == 2);
BOOST_TEST(r2.size(0) == 4);
BOOST_TEST(!r2.is_degenerate());
}
{
// degenerate creation
range r3(5);
BOOST_CHECK(r3.start() == 5);
BOOST_CHECK(r3.finish() == 6);
BOOST_CHECK(r3.stride() == 1);
BOOST_CHECK(r3.is_degenerate());
BOOST_TEST(r3.start() == 5);
BOOST_TEST(r3.finish() == 6);
BOOST_TEST(r3.stride() == 1);
BOOST_TEST(r3.size(0) == 1);
BOOST_TEST(r3.is_degenerate());
}
{
// default range creation
range r4;
BOOST_CHECK(r4.get_start(0) == 0);
BOOST_CHECK(r4.get_finish(100) == 100);
BOOST_CHECK(r4.stride() == 1);
BOOST_TEST(r4.get_start(0) == 0);
BOOST_TEST(r4.get_finish(100) == 100);
BOOST_TEST(r4.stride() == 1);
BOOST_TEST(r4.size(0) == 0);
}
{
// create a range using the setter methods
range r5 = range().stride(2).start(-3).finish(7);
BOOST_CHECK(r5.start() == -3);
BOOST_CHECK(r5.stride() == 2);
BOOST_CHECK(r5.finish() == 7);
BOOST_TEST(r5.start() == -3);
BOOST_TEST(r5.stride() == 2);
BOOST_TEST(r5.finish() == 7);
BOOST_TEST(r5.size(0) == 5);
}
// try out all the comparison operators
{
range r6 = -3 <= range().stride(2) < 7;
BOOST_CHECK(r6.start() == -3);
BOOST_CHECK(r6.stride() == 2);
BOOST_CHECK(r6.finish() == 7);
BOOST_TEST(r6.start() == -3);
BOOST_TEST(r6.stride() == 2);
BOOST_TEST(r6.finish() == 7);
BOOST_TEST(r6.size(0) == 5);
}
{
range r7 = -3 < range() <= 7;
BOOST_CHECK(r7.start() == -2);
BOOST_CHECK(r7.stride() == 1);
BOOST_CHECK(r7.finish() == 8);
BOOST_TEST(r7.start() == -2);
BOOST_TEST(r7.stride() == 1);
BOOST_TEST(r7.finish() == 8);
BOOST_TEST(r7.size(0) == 10);
}
// arithmetic operators
{
range r8 = range(0,5) + 2;
BOOST_CHECK(r8.start() == 2);
BOOST_CHECK(r8.stride() == 1);
BOOST_CHECK(r8.finish() == 7);
BOOST_TEST(r8.start() == 2);
BOOST_TEST(r8.stride() == 1);
BOOST_TEST(r8.finish() == 7);
BOOST_TEST(r8.size(0) == 5);
}
{
range r9 = range(0,5) - 2;
BOOST_CHECK(r9.start() == -2);
BOOST_CHECK(r9.stride() == 1);
BOOST_CHECK(r9.finish() == 3);
BOOST_TEST(r9.start() == -2);
BOOST_TEST(r9.stride() == 1);
BOOST_TEST(r9.finish() == 3);
BOOST_TEST(r9.size(0) == 5);
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -14,15 +14,15 @@
// reshape.cpp - testing reshaping functionality
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include "boost/type.hpp"
#include <boost/array.hpp>
#include <boost/type.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
typedef boost::multi_array<int,ndims> array;
@@ -52,9 +52,9 @@ test_main(int,char*[])
for (array::index i = 0; i != 4; ++i)
for (array::index j = 0; j != 3; ++j)
for (array::index k = 0; k != 2; ++k) {
BOOST_CHECK(A[i][j][k] == *ptr);
BOOST_CHECK(B[i][j][k] == *ptr);
BOOST_CHECK(C[i][j][k] == *ptr++);
BOOST_TEST(A[i][j][k] == *ptr);
BOOST_TEST(B[i][j][k] == *ptr);
BOOST_TEST(C[i][j][k] == *ptr++);
}
}
@@ -80,13 +80,13 @@ test_main(int,char*[])
for (array::index i = 0; i != 4; ++i)
for (array::index j = 1; j != 4; ++j)
for (array::index k = -1; k != 1; ++k) {
BOOST_CHECK(A[i][j][k] == *ptr);
BOOST_CHECK(B[i][j][k] == *ptr);
BOOST_CHECK(C[i][j][k] == *ptr++);
BOOST_TEST(A[i][j][k] == *ptr);
BOOST_TEST(B[i][j][k] == *ptr);
BOOST_TEST(C[i][j][k] == *ptr++);
}
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -14,13 +14,13 @@
// resize.cpp - Test of resizing multi_arrays
//
#include "boost/test/minimal.hpp"
#include "boost/multi_array.hpp"
#include <boost/core/lightweight_test.hpp>
#include <boost/multi_array.hpp>
#include <iostream>
using namespace std;
int test_main(int,char*[]) {
int main() {
typedef boost::multi_array<int,3> marray;
@@ -58,7 +58,7 @@ int test_main(int,char*[]) {
marray A(boost::extents[2][3][4]);
A.assign(A_data,A_data+(2*3*4));
A.resize(boost::extents[4][3][2]);
BOOST_CHECK(std::equal(A_resize,A_resize+(4*3*2),A.data()));
BOOST_TEST(std::equal(A_resize,A_resize+(4*3*2),A.data()));
}
// resize through the Collection
@@ -67,14 +67,14 @@ int test_main(int,char*[]) {
A.assign(A_data,A_data+(2*3*4));
boost::array<int,3> new_extents = {{4,3,2}};
A.resize(new_extents);
BOOST_CHECK(std::equal(A_resize,A_resize+(4*3*2),A.data()));
BOOST_TEST(std::equal(A_resize,A_resize+(4*3*2),A.data()));
}
// default construct all the new elements (in this case, all elements)
{
marray defaultA;
defaultA.resize(boost::extents[2][3][4]);
BOOST_CHECK(std::accumulate(defaultA.data(),
BOOST_TEST(std::accumulate(defaultA.data(),
defaultA.data()+(2*3*4),0) == 0);
}
@@ -107,7 +107,7 @@ int test_main(int,char*[]) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 4; y++) {
for (int z = 0; z < 2; z++) {
BOOST_CHECK(*(A.data() + check) == check);
BOOST_TEST(*(A.data() + check) == check);
++check;
}
}
@@ -123,5 +123,5 @@ int test_main(int,char*[]) {
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -14,12 +14,12 @@
// reverse_view.cpp - a small test of creating a view with negative strides
//
#include "boost/multi_array.hpp"
#include "boost/test/minimal.hpp"
#include "boost/array.hpp"
#include <boost/multi_array.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
using namespace boost;
@@ -36,8 +36,8 @@ test_main(int,char*[])
array::array_view<1>::type B = A[indices[range(3, -1, -1)]];
for(multi_array_types::size_type i = 0; i != B.size(); ++i) {
BOOST_CHECK(B[i] == rdata[i]);
BOOST_TEST(B[i] == rdata[i]);
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -15,9 +15,9 @@
//
#include "generative_tests.hpp"
#include "boost/array.hpp"
#include "boost/mpl/if.hpp"
#include "boost/type_traits/is_same.hpp"
#include <boost/array.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_same.hpp>
template <typename Array>
struct view_traits_mutable {
@@ -71,10 +71,10 @@ void test_views(Array& A, const ViewTraits&) {
for (index i = 0; i != 2; ++i)
for (index j = 0; j != 2; ++j)
for (index k = 0; k != 2; ++k) {
BOOST_CHECK(B[i][j][k] == A[idx0+i][idx1+j+1][idx2+k*2]);
BOOST_TEST(B[i][j][k] == A[idx0+i][idx1+j+1][idx2+k*2]);
boost::array<index,3> elmts;
elmts[0]=i; elmts[1]=j; elmts[2]=k;
BOOST_CHECK(B(elmts) == A[idx0+i][idx1+j+1][idx2+k*2]);
BOOST_TEST(B(elmts) == A[idx0+i][idx1+j+1][idx2+k*2]);
}
}
// Degenerate dimensions
@@ -84,10 +84,10 @@ void test_views(Array& A, const ViewTraits&) {
for (index i = 0; i != 2; ++i)
for (index j = 0; j != 2; ++j) {
BOOST_CHECK(B[i][j] == A[idx0+i][idx1+1][idx2+j*2]);
BOOST_TEST(B[i][j] == A[idx0+i][idx1+1][idx2+j*2]);
boost::array<index,2> elmts;
elmts[0]=i; elmts[1]=j;
BOOST_CHECK(B(elmts) == A[idx0+i][idx1+1][idx2+j*2]);
BOOST_TEST(B(elmts) == A[idx0+i][idx1+1][idx2+j*2]);
}
}
@@ -105,10 +105,10 @@ void test_views(Array& A, const ViewTraits&) {
for (index i = 0; i != 2; ++i)
for (index j = 0; j != 2; ++j)
for (index k = 0; k != 2; ++k) {
BOOST_CHECK(B[i][j][k] == A[idx0+i][idx1+j][idx2+2-k]);
BOOST_TEST(B[i][j][k] == A[idx0+i][idx1+j][idx2+2-k]);
boost::array<index,3> elmts;
elmts[0]=i; elmts[1]=j; elmts[2]=k;
BOOST_CHECK(B(elmts) == A[idx0+i][idx1+j][idx2+2-k]);
BOOST_TEST(B(elmts) == A[idx0+i][idx1+j][idx2+2-k]);
}
}
@@ -141,6 +141,6 @@ void access(Array& A, const const_array_tag&) {
}
int test_main(int,char*[]) {
int main() {
return run_generative_tests();
}

View File

@@ -14,14 +14,14 @@
// stl_interaction.cpp - Make sure multi_arrays work with STL containers.
//
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include <algorithm>
#include <vector>
int
test_main(int, char*[])
main()
{
using boost::extents;
using boost::indices;
@@ -51,7 +51,7 @@ test_main(int, char*[])
myarray.assign(data,data+data_size);
array3vec myvec(5,myarray);
BOOST_CHECK(myarray == myvec[1]);
BOOST_TEST(myarray == myvec[1]);
array3::array_view<2>::type myview =
myarray[indices[1][range(0,2)][range(1,3)]];
@@ -65,8 +65,8 @@ test_main(int, char*[])
myvec.push_back(myarray);
BOOST_CHECK(myarray != myvec[1]);
BOOST_CHECK(myarray == myvec[5]);
BOOST_TEST(myarray != myvec[1]);
BOOST_TEST(myarray == myvec[5]);
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -14,14 +14,14 @@
// storage_order.cpp - testing storage_order-isms.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
int
test_main(int,char*[])
main()
{
const int ndims=3;
@@ -67,7 +67,7 @@ test_main(int,char*[])
for (array::index i = 0; i != 2; ++i)
for (array::index j = 0; j != 3; ++j)
for (array::index k = 0; k != 4; ++k)
BOOST_CHECK(A[i][j][k] == *num++);
BOOST_TEST(A[i][j][k] == *num++);
}
// Mimic fortran_storage_order using
@@ -88,7 +88,7 @@ test_main(int,char*[])
for (array::index i = 0; i != 2; ++i)
for (array::index j = 0; j != 3; ++j)
for (array::index k = 0; k != 4; ++k)
BOOST_CHECK(A[i][j][k] == *num++);
BOOST_TEST(A[i][j][k] == *num++);
}
// general_storage_order with arbitrary storage order
@@ -119,7 +119,7 @@ test_main(int,char*[])
for (array::index i = 0; i != 2; ++i)
for (array::index j = 0; j != 3; ++j)
for (array::index k = 0; k != 4; ++k)
BOOST_CHECK(A[i][j][k] == *num++);
BOOST_TEST(A[i][j][k] == *num++);
}
@@ -152,8 +152,8 @@ test_main(int,char*[])
for (array::index i = 0; i != 2; ++i)
for (array::index j = 0; j != 3; ++j)
for (array::index k = 0; k != 4; ++k)
BOOST_CHECK(A[i][j][k] == *num++);
BOOST_TEST(A[i][j][k] == *num++);
}
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -14,12 +14,12 @@
// test out my new storage_order stuff
//
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/multi_array/storage_order.hpp"
#include <boost/multi_array/storage_order.hpp>
int
test_main(int,char*[]) {
main() {
using namespace boost;
@@ -31,9 +31,9 @@ test_main(int,char*[]) {
general_storage_order<5> fortran_storage(fortran_ordering.begin(),
ascending.begin());
BOOST_CHECK(c_storage == (general_storage_order<5>) c_storage_order());
BOOST_CHECK(fortran_storage ==
BOOST_TEST(c_storage == (general_storage_order<5>) c_storage_order());
BOOST_TEST(fortran_storage ==
(general_storage_order<5>) fortran_storage_order());
return boost::exit_success;
return boost::report_errors();
}

View File

@@ -14,15 +14,15 @@
// index_bases - test of the index_base modifying facilities.
//
#include "boost/multi_array.hpp"
#include <boost/multi_array.hpp>
#include "boost/test/minimal.hpp"
#include <boost/core/lightweight_test.hpp>
#include "boost/array.hpp"
#include <boost/array.hpp>
#include <vector>
#include <iostream>
int
test_main(int,char*[])
main()
{
typedef boost::multi_array<double, 3> array;
typedef array::array_view<3>::type array_view;
@@ -40,5 +40,5 @@ test_main(int,char*[])
array_view E = A[indices[irange(1,2)][irange(1,2)][irange(1,2)]];
}
return boost::exit_success;
return boost::report_errors();
}