mirror of
https://github.com/boostorg/multi_array.git
synced 2026-02-07 22:52:08 +00:00
Compare commits
56 Commits
boost-1.62
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a31951fd81 | ||
|
|
88a22c7e11 | ||
|
|
15e5bd8665 | ||
|
|
2c89ceff08 | ||
|
|
e703d395d3 | ||
|
|
03710c74c7 | ||
|
|
34c8a706f4 | ||
|
|
99aa01c55f | ||
|
|
6471d119d7 | ||
|
|
3abaddaada | ||
|
|
8b1e05a1d0 | ||
|
|
00a17f84da | ||
|
|
a9f14e79f9 | ||
|
|
9e2150f864 | ||
|
|
333c304d84 | ||
|
|
d699673b1f | ||
|
|
0c5348bef7 | ||
|
|
dfbe377927 | ||
|
|
e8140d8183 | ||
|
|
3b40572055 | ||
|
|
eab203a2c5 | ||
|
|
e6f210c7ca | ||
|
|
74cbc0f659 | ||
|
|
2f03d28dab | ||
|
|
5bdb4f852c | ||
|
|
3ab14966b5 | ||
|
|
72763d70be | ||
|
|
f59629cebb | ||
|
|
55bba0ed5b | ||
|
|
9642ba7103 | ||
|
|
453d38b269 | ||
|
|
56b9b62ce4 | ||
|
|
11d00187fa | ||
|
|
25b8a5479f | ||
|
|
804dff44de | ||
|
|
17f9326ecc | ||
|
|
f126e8d7be | ||
|
|
f589527689 | ||
|
|
dedb1eaade | ||
|
|
e9229c8bf4 | ||
|
|
c30eee78db | ||
|
|
abcb2839d5 | ||
|
|
d259f853b5 | ||
|
|
83c3738519 | ||
|
|
fcfb551a1c | ||
|
|
fcf70a4560 | ||
|
|
5578fc341e | ||
|
|
973ef10b02 | ||
|
|
43ef0fec88 | ||
|
|
9ac138b91a | ||
|
|
bf7d4881c0 | ||
|
|
83493ba231 | ||
|
|
8b22b92d88 | ||
|
|
484645ee98 | ||
|
|
013ed850c5 | ||
|
|
8da3864210 |
297
.travis.yml
Normal file
297
.travis.yml
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
# Copyright 2018 Peter Dimov
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
|
language: cpp
|
||||||
|
|
||||||
|
sudo: false
|
||||||
|
|
||||||
|
dist: trusty
|
||||||
|
|
||||||
|
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
|
||||||
|
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,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-9
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-9
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++
|
||||||
|
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: /usr/bin/clang++
|
||||||
|
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.3
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: /usr/bin/clang++
|
||||||
|
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.4
|
||||||
|
|
||||||
|
- 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
|
||||||
|
- llvm-toolchain-precise-3.5
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.6
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.6
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.6
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.7
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.7
|
||||||
|
|
||||||
|
- 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
|
||||||
|
- llvm-toolchain-precise-3.8
|
||||||
|
|
||||||
|
- 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
|
||||||
|
- llvm-toolchain-precise-3.9
|
||||||
|
|
||||||
|
- 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,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-6.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-6.0
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-7
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-7
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-8
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-8
|
||||||
|
|
||||||
|
- 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
|
||||||
33
CMakeLists.txt
Normal file
33
CMakeLists.txt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Generated by `boostdep --cmake multi_array`
|
||||||
|
# Copyright 2020 Peter Dimov
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.5...3.16)
|
||||||
|
|
||||||
|
project(boost_multi_array VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||||
|
|
||||||
|
add_library(boost_multi_array INTERFACE)
|
||||||
|
add_library(Boost::multi_array ALIAS boost_multi_array)
|
||||||
|
|
||||||
|
target_include_directories(boost_multi_array INTERFACE include)
|
||||||
|
|
||||||
|
target_link_libraries(boost_multi_array
|
||||||
|
INTERFACE
|
||||||
|
Boost::array
|
||||||
|
Boost::assert
|
||||||
|
Boost::concept_check
|
||||||
|
Boost::config
|
||||||
|
Boost::core
|
||||||
|
Boost::functional
|
||||||
|
Boost::iterator
|
||||||
|
Boost::mpl
|
||||||
|
Boost::type_traits
|
||||||
|
)
|
||||||
|
|
||||||
|
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
||||||
|
|
||||||
|
add_subdirectory(test)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
56
appveyor.yml
Normal file
56
appveyor.yml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# 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 2015
|
||||||
|
TOOLSET: msvc-9.0
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
TOOLSET: msvc-10.0
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
TOOLSET: msvc-11.0
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
TOOLSET: msvc-12.0
|
||||||
|
ADDRMD: 32,64
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
TOOLSET: msvc-14.0
|
||||||
|
ADDRMD: 32,64
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
TOOLSET: msvc-14.1
|
||||||
|
ADDRMD: 32,64
|
||||||
|
STANDARD: 14,17
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
TOOLSET: clang-win
|
||||||
|
ADDRMD: 32,64
|
||||||
|
STANDARD: 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%
|
||||||
29
build.jam
Normal file
29
build.jam
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Copyright René Ferdinand Rivera Morell 2023-2024
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
require-b2 5.2 ;
|
||||||
|
|
||||||
|
constant boost_dependencies :
|
||||||
|
/boost/array//boost_array
|
||||||
|
/boost/assert//boost_assert
|
||||||
|
/boost/concept_check//boost_concept_check
|
||||||
|
/boost/config//boost_config
|
||||||
|
/boost/core//boost_core
|
||||||
|
/boost/functional//boost_functional
|
||||||
|
/boost/iterator//boost_iterator
|
||||||
|
/boost/mpl//boost_mpl
|
||||||
|
/boost/type_traits//boost_type_traits ;
|
||||||
|
|
||||||
|
project /boost/multi_array
|
||||||
|
;
|
||||||
|
|
||||||
|
explicit
|
||||||
|
[ alias boost_multi_array : : :
|
||||||
|
: <include>include <library>$(boost_dependencies) ]
|
||||||
|
[ alias all : boost_multi_array test ]
|
||||||
|
;
|
||||||
|
|
||||||
|
call-if : boost-library multi_array
|
||||||
|
;
|
||||||
15
doc/build.jam
Normal file
15
doc/build.jam
Normal 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 ;
|
||||||
@@ -651,8 +651,8 @@ Iterator</a>.
|
|||||||
</h3>The Forward Iterator is an iterator that can be incremented. Also, it is
|
</h3>The Forward Iterator is an iterator that can be incremented. Also, it is
|
||||||
permissible to make multiple passes through the iterator's range.
|
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
|
<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>, <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="http://www.sgi.com/tech/stl/EqualityComparable.html">Equality
|
Constructible</a>, and <a href="https://www.boost.org/sgi/stl/EqualityComparable.html">Equality
|
||||||
Comparable</a>
|
Comparable</a>
|
||||||
<h3>Associated types</h3>
|
<h3>Associated types</h3>
|
||||||
<table border="1">
|
<table border="1">
|
||||||
@@ -725,7 +725,7 @@ Traversal Iterator</a>
|
|||||||
Iterator </h3>An iterator that provides constant-time methods for moving forward
|
Iterator </h3>An iterator that provides constant-time methods for moving forward
|
||||||
and backward in arbitrary-sized steps.
|
and backward in arbitrary-sized steps.
|
||||||
<h3>Refinement of</h3><a href="#concept_BidirectionalTraversalIterator">Bidirectional
|
<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><</tt> is a total ordering
|
Comparable</a> where <tt><</tt> is a total ordering
|
||||||
<h3>Associated types</h3>
|
<h3>Associated types</h3>
|
||||||
<table border="1">
|
<table border="1">
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ containers. It specifies operations for accessing elements,
|
|||||||
traversing containers, and creating views
|
traversing containers, and creating views
|
||||||
of array data.
|
of array data.
|
||||||
MultiArray defines
|
MultiArray defines
|
||||||
a flexible memory model that accomodates
|
a flexible memory model that accommodates
|
||||||
a variety of data layouts.
|
a variety of data layouts.
|
||||||
</p><p>
|
</p><p>
|
||||||
At each level (or dimension) of a MultiArray's
|
At each level (or dimension) of a MultiArray's
|
||||||
@@ -145,7 +145,7 @@ base. Note that since positive index bases are
|
|||||||
possible, the origin need not exist in order to determine the location
|
possible, the origin need not exist in order to determine the location
|
||||||
in memory of the MultiArray's elements.
|
in memory of the MultiArray's elements.
|
||||||
The strides determine how index values are mapped to memory offsets.
|
The strides determine how index values are mapped to memory offsets.
|
||||||
They accomodate a
|
They accommodate a
|
||||||
number of possible element layouts. For example, the elements of a 2
|
number of possible element layouts. For example, the elements of a 2
|
||||||
dimensional array can be stored by row (i.e., the elements of each row
|
dimensional array can be stored by row (i.e., the elements of each row
|
||||||
are stored contiguously) or by column (i.e., the elements of each
|
are stored contiguously) or by column (i.e., the elements of each
|
||||||
@@ -303,7 +303,7 @@ This returns the number of values contained in
|
|||||||
<code class="literal">const element&</code> otherwise.
|
<code class="literal">const element&</code> otherwise.
|
||||||
</td><td>
|
</td><td>
|
||||||
This expression accesses a specific element of
|
This expression accesses a specific element of
|
||||||
<code class="literal">a</code>.<code class="literal">index_list</code> is the unique set
|
<code class="literal">a</code>. <code class="literal">index_list</code> is the unique set
|
||||||
of indices that address the element returned. It is
|
of indices that address the element returned. It is
|
||||||
equivalent to the following code (disregarding intermediate temporaries):
|
equivalent to the following code (disregarding intermediate temporaries):
|
||||||
<pre class="programlisting">
|
<pre class="programlisting">
|
||||||
@@ -353,21 +353,21 @@ This expression generates a view of the array determined by the
|
|||||||
used to construct <code class="literal">indices</code>.
|
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
|
</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
|
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 < b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
|
expression to be valid.</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
|
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 <= b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
|
expression to be valid.</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
|
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
|
type must model <a class="ulink" href="https://www.boost.org/sgi/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
|
<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 > b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
|
expression to be valid.</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
|
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
|
type must model <a class="ulink" href="https://www.boost.org/sgi/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
|
<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 >= b</code></td><td>bool</td><td>This performs a lexicographical comparison of the
|
expression to be valid.</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
|
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
|
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.
|
constant time.
|
||||||
<code class="literal">size()</code> executes in at most linear time in the
|
<code class="literal">size()</code> executes in at most linear time in the
|
||||||
@@ -427,16 +427,16 @@ with unspecified start and finish values.</td></tr><tr><td><code class="literal"
|
|||||||
value, this is equivalent to <code class="literal">i.start()</code>. Otherwise it
|
value, this is equivalent to <code class="literal">i.start()</code>. Otherwise it
|
||||||
returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i.get_finish(idx)</code></td><td><code class="literal">index</code></td><td>If <code class="literal">i</code> specifies a finish
|
returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i.get_finish(idx)</code></td><td><code class="literal">index</code></td><td>If <code class="literal">i</code> specifies a finish
|
||||||
value, this is equivalent to <code class="literal">i.finish()</code>. Otherwise it
|
value, this is equivalent to <code class="literal">i.finish()</code>. Otherwise it
|
||||||
returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i.size(idx)</code></td><td><code class="literal">size_type</code></td><td>If <code class="literal">i</code> specifies a both finish and
|
returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i.size(idx)</code></td><td><code class="literal">size_type</code></td><td>If <code class="literal">i</code> specifies both a finish and a
|
||||||
start values, this is equivalent to
|
start value, this is equivalent to
|
||||||
<code class="literal">(i.finish()-i.start())/i.stride()</code>. Otherwise it
|
<code class="literal">(i.finish()-i.start())/i.stride()</code>. Otherwise it
|
||||||
returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i < idx</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the finish
|
returns <code class="literal">idx</code>.</td></tr><tr><td><code class="literal">i < idx</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the finish
|
||||||
value. This notation does not include
|
value. This notation does not include
|
||||||
<code class="literal">idx</code> in the range of valid indices. It is equivalent to
|
<code class="literal">idx</code> in the range of valid indices. It is equivalent to
|
||||||
<code class="literal">index_range(r.start(), idx, r.stride())</code></td></tr><tr><td><code class="literal">i <= idx</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the finish
|
<code class="literal">index_range(r.start(), idx, r.stride())</code>.</td></tr><tr><td><code class="literal">i <= idx</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the finish
|
||||||
value. This notation includes
|
value. This notation includes
|
||||||
<code class="literal">idx</code> in the range of valid indices. It is equivalent to
|
<code class="literal">idx</code> in the range of valid indices. It is equivalent to
|
||||||
<code class="literal">index_range(r.start(), idx + 1, r.stride())</code></td></tr><tr><td><code class="literal">idx < i</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the start
|
<code class="literal">index_range(r.start(), idx + 1, r.stride())</code>.</td></tr><tr><td><code class="literal">idx < i</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the start
|
||||||
value. This notation does not include
|
value. This notation does not include
|
||||||
<code class="literal">idx</code> in the range of valid indices. It is equivalent to
|
<code class="literal">idx</code> in the range of valid indices. It is equivalent to
|
||||||
<code class="literal">index_range(idx + 1, i.finish(), i.stride())</code>.</td></tr><tr><td><code class="literal">idx <= i</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the start
|
<code class="literal">index_range(idx + 1, i.finish(), i.stride())</code>.</td></tr><tr><td><code class="literal">idx <= i</code></td><td><code class="literal">index</code></td><td>This is another syntax for specifying the start
|
||||||
@@ -444,9 +444,9 @@ value. This notation includes
|
|||||||
<code class="literal">idx1</code> in the range of valid indices. It is equivalent to
|
<code class="literal">idx1</code> in the range of valid indices. It is equivalent to
|
||||||
<code class="literal">index_range(idx, i.finish(), i.stride())</code>.</td></tr><tr><td><code class="literal">i + idx</code></td><td><code class="literal">index</code></td><td>This expression shifts the start and finish values
|
<code class="literal">index_range(idx, i.finish(), i.stride())</code>.</td></tr><tr><td><code class="literal">i + idx</code></td><td><code class="literal">index</code></td><td>This expression shifts the start and finish values
|
||||||
of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to
|
of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to
|
||||||
<code class="literal">index_range(r.start()+idx1, r.finish()+idx, r.stride())</code></td></tr><tr><td><code class="literal">i - idx</code></td><td><code class="literal">index</code></td><td>This expression shifts the start and finish values
|
<code class="literal">index_range(r.start()+idx1, r.finish()+idx, r.stride())</code>.</td></tr><tr><td><code class="literal">i - idx</code></td><td><code class="literal">index</code></td><td>This expression shifts the start and finish values
|
||||||
of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to
|
of <code class="literal">i</code> up by <code class="literal">idx</code>. It is equivalent to
|
||||||
<code class="literal">index_range(r.start()-idx1, r.finish()-idx, r.stride())</code></td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect3" title="index_gen"><div class="titlepage"><div><div><h4 class="title"><a name="index_gen"></a><code class="literal">index_gen</code></h4></div></div></div><p> <code class="literal">index_gen</code> aggregates
|
<code class="literal">index_range(r.start()-idx1, r.finish()-idx, r.stride())</code>.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect3" title="index_gen"><div class="titlepage"><div><div><h4 class="title"><a name="index_gen"></a><code class="literal">index_gen</code></h4></div></div></div><p> <code class="literal">index_gen</code> aggregates
|
||||||
<code class="literal">index_range</code> objects in order to specify view
|
<code class="literal">index_range</code> objects in order to specify view
|
||||||
parameters. Chained calls to <code class="literal">operator[]</code> store
|
parameters. Chained calls to <code class="literal">operator[]</code> store
|
||||||
range and dimension information used to
|
range and dimension information used to
|
||||||
@@ -560,7 +560,7 @@ void reindex(const BaseList& values);
|
|||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
</span></dt><dd><p>This changes the index bases of the <code class="literal">multi_array</code> to
|
</span></dt><dd><p>This changes the index bases of the <code class="literal">multi_array</code> to
|
||||||
correspond to the the values in <code class="literal">values</code>.</p><p title="BaseList Requirements"><b><code class="literal">BaseList</code> Requirements. </b><code class="literal">BaseList</code> must model
|
correspond to the values in <code class="literal">values</code>.</p><p title="BaseList Requirements"><b><code class="literal">BaseList</code> Requirements. </b><code class="literal">BaseList</code> must model
|
||||||
<a class="ulink" href="../../utility/Collection.html" target="_top">Collection</a>.</p><p title="Preconditions"><b>Preconditions. </b><code class="literal">values.size() == NumDims;</code></p><p title="Postconditions"><b>Postconditions. </b><code class="literal">std::equal(values.begin(),values.end(),this->index_bases());
|
<a class="ulink" href="../../utility/Collection.html" target="_top">Collection</a>.</p><p title="Preconditions"><b>Preconditions. </b><code class="literal">values.size() == NumDims;</code></p><p title="Postconditions"><b>Postconditions. </b><code class="literal">std::equal(values.begin(),values.end(),this->index_bases());
|
||||||
</code></p></dd><dt><span class="term">
|
</code></p></dd><dt><span class="term">
|
||||||
<pre class="programlisting">
|
<pre class="programlisting">
|
||||||
@@ -589,7 +589,7 @@ using a replaceable allocator.
|
|||||||
</p><p title="Model Of."><b>Model Of. </b>
|
</p><p title="Model Of."><b>Model Of. </b>
|
||||||
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
|
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
|
||||||
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>. Depending on the element type,
|
<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">
|
</p><p title="Synopsis"><b>Synopsis. </b></p><pre class="programlisting">
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
@@ -745,7 +745,7 @@ multi_array(const const_array_view<NumDims>::type& x);
|
|||||||
multi_array(const multi_array_ref<ValueType,NumDims>& x);
|
multi_array(const multi_array_ref<ValueType,NumDims>& x);
|
||||||
multi_array(const subarray<NumDims>::type& x);
|
multi_array(const subarray<NumDims>::type& x);
|
||||||
multi_array(const array_view<NumDims>::type& x);
|
multi_array(const array_view<NumDims>::type& x);
|
||||||
</pre></span></dt><dd><p>These constructors all constructs a <code class="literal">multi_array</code> and
|
</pre></span></dt><dd><p>These constructors all construct a <code class="literal">multi_array</code> and
|
||||||
perform a deep copy of <code class="literal">x</code>.
|
perform a deep copy of <code class="literal">x</code>.
|
||||||
</p><p title="Complexity"><b>Complexity. </b> This performs O(<code class="literal">x.num_elements()</code>) calls to
|
</p><p title="Complexity"><b>Complexity. </b> This performs O(<code class="literal">x.num_elements()</code>) calls to
|
||||||
<code class="literal">element</code>'s copy
|
<code class="literal">element</code>'s copy
|
||||||
@@ -816,9 +816,9 @@ of the constructors.
|
|||||||
</p><p title="Model Of."><b>Model Of. </b>
|
</p><p title="Model Of."><b>Model Of. </b>
|
||||||
<code class="literal">multi_array_ref</code> models
|
<code class="literal">multi_array_ref</code> models
|
||||||
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
|
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
|
||||||
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>.
|
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>
|
||||||
and depending on the element type, it may also model
|
and depending on the element type, it may also model
|
||||||
<a class="ulink" href="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
|
Detailed descriptions are provided here only for operations that are
|
||||||
not described in the <code class="literal">multi_array</code> reference.
|
not described in the <code class="literal">multi_array</code> reference.
|
||||||
</p><p title="Synopsis"><b>Synopsis. </b></p><pre class="programlisting">
|
</p><p title="Synopsis"><b>Synopsis. </b></p><pre class="programlisting">
|
||||||
@@ -954,7 +954,7 @@ dimensions.
|
|||||||
multi_array_ref(const multi_array_ref& x);
|
multi_array_ref(const multi_array_ref& x);
|
||||||
</pre></span></dt><dd><p>This constructs a shallow copy of <code class="literal">x</code>.
|
</pre></span></dt><dd><p>This constructs a shallow copy of <code class="literal">x</code>.
|
||||||
</p><p title="Complexity"><b>Complexity. </b> Constant time (for contrast, compare this to
|
</p><p title="Complexity"><b>Complexity. </b> Constant time (for contrast, compare this to
|
||||||
the <code class="literal">multi_array</code> class copy constructor.
|
the <code class="literal">multi_array</code> class copy constructor).
|
||||||
</p></dd></dl></div><p title="Modifiers"><b>Modifiers. </b></p><div class="variablelist"><dl><dt><span class="term"><pre class="programlisting">
|
</p></dd></dl></div><p title="Modifiers"><b>Modifiers. </b></p><div class="variablelist"><dl><dt><span class="term"><pre class="programlisting">
|
||||||
multi_array_ref& operator=(const multi_array_ref& x);
|
multi_array_ref& operator=(const multi_array_ref& x);
|
||||||
template <class Array> multi_array_ref& operator=(const Array& x);
|
template <class Array> multi_array_ref& operator=(const Array& x);
|
||||||
@@ -976,9 +976,9 @@ of the constructors.
|
|||||||
</p><p title="Model Of."><b>Model Of. </b>
|
</p><p title="Model Of."><b>Model Of. </b>
|
||||||
<code class="literal">const_multi_array_ref</code> models
|
<code class="literal">const_multi_array_ref</code> models
|
||||||
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
|
<a class="link" href="#MultiArray" title="MultiArray Concept">MultiArray</a>,
|
||||||
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>.
|
<a class="ulink" href="../../../libs/utility/CopyConstructible.html" target="_top">CopyConstructible</a>
|
||||||
and depending on the element type, it may also model
|
and depending on the element type, it may also model
|
||||||
<a class="ulink" href="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
|
Detailed descriptions are provided here only for operations that are
|
||||||
not described in the <code class="literal">multi_array</code> reference.
|
not described in the <code class="literal">multi_array</code> reference.
|
||||||
@@ -1110,7 +1110,7 @@ associated with <code class="literal">multi_array</code>,
|
|||||||
<code class="literal">multi_array_ref</code>, and
|
<code class="literal">multi_array_ref</code>, and
|
||||||
<code class="literal">const_multi_array_ref</code> that are not
|
<code class="literal">const_multi_array_ref</code> that are not
|
||||||
dependent upon template parameters. These types find common use with
|
dependent upon template parameters. These types find common use with
|
||||||
all Boost.Multiarray components. They are defined
|
all Boost.MultiArray components. They are defined
|
||||||
in a namespace from which they can be accessed conveniently.
|
in a namespace from which they can be accessed conveniently.
|
||||||
With the exception of <code class="literal">extent_gen</code> and
|
With the exception of <code class="literal">extent_gen</code> and
|
||||||
<code class="literal">extent_range</code>, these types fulfill the roles of the
|
<code class="literal">extent_range</code>, these types fulfill the roles of the
|
||||||
@@ -1144,7 +1144,7 @@ public:
|
|||||||
<code class="literal">finish</code> must be greater than <code class="literal">start</code>.
|
<code class="literal">finish</code> must be greater than <code class="literal">start</code>.
|
||||||
</p></dd><dt><span class="term"><code class="function">extent_range(index finish)</code></span></dt><dd><p>This constructor defines the half open interval
|
</p></dd><dt><span class="term"><code class="function">extent_range(index finish)</code></span></dt><dd><p>This constructor defines the half open interval
|
||||||
<code class="literal">[0,finish)</code>. The value of <code class="literal">finish</code>
|
<code class="literal">[0,finish)</code>. The value of <code class="literal">finish</code>
|
||||||
must be positive.</p></dd><dt><span class="term"><code class="function">index start()</code></span></dt><dd><p>This function returns the first index represented by the range</p></dd><dt><span class="term"><code class="function">index finish()</code></span></dt><dd><p>This function returns the upper boundary value of the half-open
|
must be positive.</p></dd><dt><span class="term"><code class="function">index start()</code></span></dt><dd><p>This function returns the first index represented by the range.</p></dd><dt><span class="term"><code class="function">index finish()</code></span></dt><dd><p>This function returns the upper boundary value of the half-open
|
||||||
interval. Note that the range does not include this value.</p></dd><dt><span class="term"><code class="function">size_type size()</code></span></dt><dd><p>This function returns the size of the specified range. It is
|
interval. Note that the range does not include this value.</p></dd><dt><span class="term"><code class="function">size_type size()</code></span></dt><dd><p>This function returns the size of the specified range. It is
|
||||||
equivalent to <code class="literal">finish()-start()</code>.</p></dd></dl></div></div><div class="sect2" title="extent_gen"><div class="titlepage"><div><div><h3 class="title"><a name="extent_gen"></a><code class="classname">extent_gen</code></h3></div></div></div><p>The <code class="classname">extent_gen</code> class defines an
|
equivalent to <code class="literal">finish()-start()</code>.</p></dd></dl></div></div><div class="sect2" title="extent_gen"><div class="titlepage"><div><div><h3 class="title"><a name="extent_gen"></a><code class="classname">extent_gen</code></h3></div></div></div><p>The <code class="classname">extent_gen</code> class defines an
|
||||||
interface for aggregating array shape and indexing information to be
|
interface for aggregating array shape and indexing information to be
|
||||||
@@ -1205,7 +1205,7 @@ For example,
|
|||||||
a 3 by 3 by 3 <code class="classname">multi_array</code> is constructed as follows:
|
a 3 by 3 by 3 <code class="classname">multi_array</code> is constructed as follows:
|
||||||
</p><pre class="programlisting">multi_array<int,3> A(extents[3][3][3]);</pre><p>
|
</p><pre class="programlisting">multi_array<int,3> A(extents[3][3][3]);</pre><p>
|
||||||
The same array could also be created by explicitly declaring an <code class="literal">extent_gen</code>
|
The same array could also be created by explicitly declaring an <code class="literal">extent_gen</code>
|
||||||
object locally,, but the global object makes this declaration unnecessary.
|
object locally, but the global object makes this declaration unnecessary.
|
||||||
</p></div><div class="sect3" title="indices"><div class="titlepage"><div><div><h4 class="title"><a name="indices"></a><code class="literal">indices</code></h4></div></div></div><pre class="programlisting">
|
</p></div><div class="sect3" title="indices"><div class="titlepage"><div><div><h4 class="title"><a name="indices"></a><code class="literal">indices</code></h4></div></div></div><pre class="programlisting">
|
||||||
namespace boost {
|
namespace boost {
|
||||||
multi_array_base::index_gen indices;
|
multi_array_base::index_gen indices;
|
||||||
@@ -1284,7 +1284,7 @@ int a[] = { 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11 };
|
|||||||
int s[] = { 3, 1 };
|
int s[] = { 3, 1 };
|
||||||
</pre><p>
|
</pre><p>
|
||||||
Notice that the strides here are different. As a result,
|
Notice that the strides here are different. As a result,
|
||||||
The expression given above to access values will work with this pair
|
the expression given above to access values will work with this pair
|
||||||
of data and strides as well.
|
of data and strides as well.
|
||||||
</p><p>In addition to dimension order, it is also possible to
|
</p><p>In addition to dimension order, it is also possible to
|
||||||
store any dimension in descending order. For example, returning to the
|
store any dimension in descending order. For example, returning to the
|
||||||
|
|||||||
@@ -179,6 +179,13 @@ by library users.
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</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>
|
<tr>
|
||||||
<td><a href="../test/generative_tests.hpp">libs/multi_array/test/generative_tests.hpp</a></td>
|
<td><a href="../test/generative_tests.hpp">libs/multi_array/test/generative_tests.hpp</a></td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ provides a specialized set of constructors. For further information,
|
|||||||
consult their reference pages.
|
consult their reference pages.
|
||||||
|
|
||||||
<p>All of the non-const array types in this library provide assignment
|
<p>All of the non-const array types in this library provide assignment
|
||||||
operators<tt>operator=()</tt>. Each of the array types <tt>multi_array</tt>,
|
operators <tt>operator=()</tt>. Each of the array types <tt>multi_array</tt>,
|
||||||
<tt>multi_array_ref</tt>, <tt>subarray</tt>, and
|
<tt>multi_array_ref</tt>, <tt>subarray</tt>, and
|
||||||
<tt>array_view</tt> can be assigned from any
|
<tt>array_view</tt> can be assigned from any
|
||||||
of the others, so long as their shapes match. The
|
of the others, so long as their shapes match. The
|
||||||
@@ -476,7 +476,7 @@ stored in ascending or descending order.
|
|||||||
// Store last dimension, then first, then middle
|
// Store last dimension, then first, then middle
|
||||||
array_type::size_type ordering[] = {2,0,1};
|
array_type::size_type ordering[] = {2,0,1};
|
||||||
|
|
||||||
// Store the first dimension(dimension 0) in descending order
|
// Store the first dimension (dimension 0) in descending order
|
||||||
bool ascending[] = {false,true,true};
|
bool ascending[] = {false,true,true};
|
||||||
|
|
||||||
array_type A(extents[3][4][2],storage(ordering,ascending));
|
array_type A(extents[3][4][2],storage(ordering,ascending));
|
||||||
@@ -488,7 +488,7 @@ stored in ascending or descending order.
|
|||||||
<h2>Setting The Array Base</h2>
|
<h2>Setting The Array Base</h2>
|
||||||
In some situations, it may be inconvenient or awkward to use an
|
In some situations, it may be inconvenient or awkward to use an
|
||||||
array that is zero-based.
|
array that is zero-based.
|
||||||
the Boost.MultiArray components provide two facilities for changing the
|
The Boost.MultiArray components provide two facilities for changing the
|
||||||
bases of an array. One may specify a pair of range values, with
|
bases of an array. One may specify a pair of range values, with
|
||||||
the <tt>extent_range</tt> type, to
|
the <tt>extent_range</tt> type, to
|
||||||
the <tt>extent_gen</tt> constructor in order to set the base value.
|
the <tt>extent_gen</tt> constructor in order to set the base value.
|
||||||
@@ -612,7 +612,7 @@ cases can be found <a href="./test_cases.html">here</a>.
|
|||||||
<h2>Related Work</h2>
|
<h2>Related Work</h2>
|
||||||
|
|
||||||
<a href="../../array/index.html">boost::array</a>
|
<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
|
one-dimensional containers of user data. Both manage their own
|
||||||
memory. <tt>std::valarray</tt> is a low-level
|
memory. <tt>std::valarray</tt> is a low-level
|
||||||
C++ Standard Library component
|
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>
|
<li><a href="mailto:bdawes@acm.org">Beman Dawes</a>
|
||||||
helped immensely with porting the library to Microsoft Windows
|
helped immensely with porting the library to Microsoft Windows
|
||||||
compilers.
|
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>
|
</ul>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|||||||
@@ -3,14 +3,17 @@
|
|||||||
# Distributed under the Boost Software License, Version 1.0.
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
# http://www.boost.org/LICENSE_1_0.txt)
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
project boost/doc ;
|
project multi_array/doc ;
|
||||||
import boostbook : boostbook ;
|
import boostbook : boostbook ;
|
||||||
|
|
||||||
|
path-constant here : . ;
|
||||||
|
|
||||||
boostbook multi_array-doc
|
boostbook multi_array-doc
|
||||||
:
|
:
|
||||||
bbref.xml
|
bbref.xml
|
||||||
:
|
:
|
||||||
<xsl:param>boost.root=../../../../..
|
<xsl:param>boost.root=../../../../..
|
||||||
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
|
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
|
||||||
|
<format>pdf:<xsl:param>img.src.path=$(here)/../
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ containers. It specifies operations for accessing elements,
|
|||||||
traversing containers, and creating views
|
traversing containers, and creating views
|
||||||
of array data.
|
of array data.
|
||||||
MultiArray defines
|
MultiArray defines
|
||||||
a flexible memory model that accomodates
|
a flexible memory model that accommodates
|
||||||
a variety of data layouts.
|
a variety of data layouts.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ base. Note that since positive index bases are
|
|||||||
possible, the origin need not exist in order to determine the location
|
possible, the origin need not exist in order to determine the location
|
||||||
in memory of the MultiArray's elements.
|
in memory of the MultiArray's elements.
|
||||||
The strides determine how index values are mapped to memory offsets.
|
The strides determine how index values are mapped to memory offsets.
|
||||||
They accomodate a
|
They accommodate a
|
||||||
number of possible element layouts. For example, the elements of a 2
|
number of possible element layouts. For example, the elements of a 2
|
||||||
dimensional array can be stored by row (i.e., the elements of each row
|
dimensional array can be stored by row (i.e., the elements of each row
|
||||||
are stored contiguously) or by column (i.e., the elements of each
|
are stored contiguously) or by column (i.e., the elements of each
|
||||||
@@ -477,7 +477,7 @@ This returns the number of values contained in
|
|||||||
</entry>
|
</entry>
|
||||||
<entry>
|
<entry>
|
||||||
This expression accesses a specific element of
|
This expression accesses a specific element of
|
||||||
<literal>a</literal>.<literal>index_list</literal> is the unique set
|
<literal>a</literal>. <literal>index_list</literal> is the unique set
|
||||||
of indices that address the element returned. It is
|
of indices that address the element returned. It is
|
||||||
equivalent to the following code (disregarding intermediate temporaries):
|
equivalent to the following code (disregarding intermediate temporaries):
|
||||||
<programlisting>
|
<programlisting>
|
||||||
@@ -567,7 +567,7 @@ This expression generates a view of the array determined by the
|
|||||||
<entry>bool</entry>
|
<entry>bool</entry>
|
||||||
<entry>This performs a lexicographical comparison of the
|
<entry>This performs a lexicographical comparison of the
|
||||||
values of <literal>a</literal> and <literal>b</literal>. The element
|
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>
|
expression to be valid.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -575,7 +575,7 @@ expression to be valid.</entry>
|
|||||||
<entry>bool</entry>
|
<entry>bool</entry>
|
||||||
<entry>This performs a lexicographical comparison of the
|
<entry>This performs a lexicographical comparison of the
|
||||||
values of <literal>a</literal> and <literal>b</literal>. The element
|
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>
|
expression to be valid.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -583,8 +583,8 @@ expression to be valid.</entry>
|
|||||||
<entry>bool</entry>
|
<entry>bool</entry>
|
||||||
<entry>This performs a lexicographical comparison of the
|
<entry>This performs a lexicographical comparison of the
|
||||||
values of <literal>a</literal> and <literal>b</literal>. The element
|
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
|
type must model <ulink url="https://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable</ulink> and
|
||||||
<ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink> for this
|
<ulink url="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable</ulink> for this
|
||||||
expression to be valid.</entry>
|
expression to be valid.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -592,8 +592,8 @@ expression to be valid.</entry>
|
|||||||
<entry>bool</entry>
|
<entry>bool</entry>
|
||||||
<entry>This performs a lexicographical comparison of the
|
<entry>This performs a lexicographical comparison of the
|
||||||
values of <literal>a</literal> and <literal>b</literal>. The element
|
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
|
type must model <ulink url="https://www.boost.org/sgi/stl/EqualityComparable.html">EqualityComparable</ulink> and
|
||||||
<ulink url="http://www.sgi.com/tech/stl/LessThanComparable.html">LessThanComparable</ulink> for this
|
<ulink url="https://www.boost.org/sgi/stl/LessThanComparable.html">LessThanComparable</ulink> for this
|
||||||
expression to be valid.</entry>
|
expression to be valid.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -601,7 +601,7 @@ expression to be valid.</entry>
|
|||||||
<entry>bool</entry>
|
<entry>bool</entry>
|
||||||
<entry>This performs a lexicographical comparison of the
|
<entry>This performs a lexicographical comparison of the
|
||||||
values of <literal>a</literal> and <literal>b</literal>. The element
|
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>
|
expression to be valid.</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -818,8 +818,8 @@ returns <literal>idx</literal>.</entry>
|
|||||||
<row>
|
<row>
|
||||||
<entry><literal>i.size(idx)</literal></entry>
|
<entry><literal>i.size(idx)</literal></entry>
|
||||||
<entry><literal>size_type</literal></entry>
|
<entry><literal>size_type</literal></entry>
|
||||||
<entry>If <literal>i</literal> specifies a both finish and
|
<entry>If <literal>i</literal> specifies both a finish and a
|
||||||
start values, this is equivalent to
|
start value, this is equivalent to
|
||||||
<literal>(i.finish()-i.start())/i.stride()</literal>. Otherwise it
|
<literal>(i.finish()-i.start())/i.stride()</literal>. Otherwise it
|
||||||
returns <literal>idx</literal>.</entry>
|
returns <literal>idx</literal>.</entry>
|
||||||
</row>
|
</row>
|
||||||
@@ -829,7 +829,7 @@ returns <literal>idx</literal>.</entry>
|
|||||||
<entry>This is another syntax for specifying the finish
|
<entry>This is another syntax for specifying the finish
|
||||||
value. This notation does not include
|
value. This notation does not include
|
||||||
<literal>idx</literal> in the range of valid indices. It is equivalent to
|
<literal>idx</literal> in the range of valid indices. It is equivalent to
|
||||||
<literal>index_range(r.start(), idx, r.stride())</literal></entry>
|
<literal>index_range(r.start(), idx, r.stride())</literal>.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>i <= idx</literal></entry>
|
<entry><literal>i <= idx</literal></entry>
|
||||||
@@ -837,7 +837,7 @@ value. This notation does not include
|
|||||||
<entry>This is another syntax for specifying the finish
|
<entry>This is another syntax for specifying the finish
|
||||||
value. This notation includes
|
value. This notation includes
|
||||||
<literal>idx</literal> in the range of valid indices. It is equivalent to
|
<literal>idx</literal> in the range of valid indices. It is equivalent to
|
||||||
<literal>index_range(r.start(), idx + 1, r.stride())</literal></entry>
|
<literal>index_range(r.start(), idx + 1, r.stride())</literal>.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>idx < i</literal></entry>
|
<entry><literal>idx < i</literal></entry>
|
||||||
@@ -860,14 +860,14 @@ value. This notation includes
|
|||||||
<entry><literal>index</literal></entry>
|
<entry><literal>index</literal></entry>
|
||||||
<entry>This expression shifts the start and finish values
|
<entry>This expression shifts the start and finish values
|
||||||
of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to
|
of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to
|
||||||
<literal>index_range(r.start()+idx1, r.finish()+idx, r.stride())</literal></entry>
|
<literal>index_range(r.start()+idx1, r.finish()+idx, r.stride())</literal>.</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>i - idx</literal></entry>
|
<entry><literal>i - idx</literal></entry>
|
||||||
<entry><literal>index</literal></entry>
|
<entry><literal>index</literal></entry>
|
||||||
<entry>This expression shifts the start and finish values
|
<entry>This expression shifts the start and finish values
|
||||||
of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to
|
of <literal>i</literal> up by <literal>idx</literal>. It is equivalent to
|
||||||
<literal>index_range(r.start()-idx1, r.finish()-idx, r.stride())</literal></entry>
|
<literal>index_range(r.start()-idx1, r.finish()-idx, r.stride())</literal>.</entry>
|
||||||
</row>
|
</row>
|
||||||
</tbody>
|
</tbody>
|
||||||
</tgroup>
|
</tgroup>
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ void reindex(const BaseList& values);
|
|||||||
</term>
|
</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This changes the index bases of the <literal>multi_array</literal> to
|
<para>This changes the index bases of the <literal>multi_array</literal> to
|
||||||
correspond to the the values in <literal>values</literal>.</para>
|
correspond to the values in <literal>values</literal>.</para>
|
||||||
|
|
||||||
<formalpara>
|
<formalpara>
|
||||||
<title><literal>BaseList</literal> Requirements</title>
|
<title><literal>BaseList</literal> Requirements</title>
|
||||||
@@ -364,7 +364,7 @@ associated with <literal>multi_array</literal>,
|
|||||||
<literal>multi_array_ref</literal>, and
|
<literal>multi_array_ref</literal>, and
|
||||||
<literal>const_multi_array_ref</literal> that are not
|
<literal>const_multi_array_ref</literal> that are not
|
||||||
dependent upon template parameters. These types find common use with
|
dependent upon template parameters. These types find common use with
|
||||||
all Boost.Multiarray components. They are defined
|
all Boost.MultiArray components. They are defined
|
||||||
in a namespace from which they can be accessed conveniently.
|
in a namespace from which they can be accessed conveniently.
|
||||||
With the exception of <literal>extent_gen</literal> and
|
With the exception of <literal>extent_gen</literal> and
|
||||||
<literal>extent_range</literal>, these types fulfill the roles of the
|
<literal>extent_range</literal>, these types fulfill the roles of the
|
||||||
@@ -434,7 +434,7 @@ must be positive.</para>
|
|||||||
|
|
||||||
<varlistentry><term><function>index start()</function></term>
|
<varlistentry><term><function>index start()</function></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>This function returns the first index represented by the range</para>
|
<para>This function returns the first index represented by the range.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@@ -562,7 +562,7 @@ For example,
|
|||||||
a 3 by 3 by 3 <classname>multi_array</classname> is constructed as follows:
|
a 3 by 3 by 3 <classname>multi_array</classname> is constructed as follows:
|
||||||
<programlisting>multi_array<int,3> A(extents[3][3][3]);</programlisting>
|
<programlisting>multi_array<int,3> A(extents[3][3][3]);</programlisting>
|
||||||
The same array could also be created by explicitly declaring an <literal>extent_gen</literal>
|
The same array could also be created by explicitly declaring an <literal>extent_gen</literal>
|
||||||
object locally,, but the global object makes this declaration unnecessary.
|
object locally, but the global object makes this declaration unnecessary.
|
||||||
</para>
|
</para>
|
||||||
</sect3>
|
</sect3>
|
||||||
|
|
||||||
@@ -666,7 +666,7 @@ int a[] = { 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11 };
|
|||||||
int s[] = { 3, 1 };
|
int s[] = { 3, 1 };
|
||||||
</programlisting>
|
</programlisting>
|
||||||
Notice that the strides here are different. As a result,
|
Notice that the strides here are different. As a result,
|
||||||
The expression given above to access values will work with this pair
|
the expression given above to access values will work with this pair
|
||||||
of data and strides as well.
|
of data and strides as well.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ of the constructors.
|
|||||||
<para>
|
<para>
|
||||||
<literal>const_multi_array_ref</literal> models
|
<literal>const_multi_array_ref</literal> models
|
||||||
<link linkend="MultiArray">MultiArray</link>,
|
<link linkend="MultiArray">MultiArray</link>,
|
||||||
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>.
|
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>
|
||||||
and depending on the element type, it may also model
|
and depending on the element type, it may also model
|
||||||
<ulink url="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
|
Detailed descriptions are provided here only for operations that are
|
||||||
not described in the <literal>multi_array</literal> reference.
|
not described in the <literal>multi_array</literal> reference.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using a replaceable allocator.
|
|||||||
<para>
|
<para>
|
||||||
<link linkend="MultiArray">MultiArray</link>,
|
<link linkend="MultiArray">MultiArray</link>,
|
||||||
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>. Depending on the element type,
|
<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>
|
</para>
|
||||||
</formalpara>
|
</formalpara>
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
|
|
||||||
// constructors and destructors
|
// constructors and destructors
|
||||||
|
|
||||||
multi_array();
|
multi_array(const Allocator& alloc = Allocator());
|
||||||
|
|
||||||
template <typename ExtentList>
|
template <typename ExtentList>
|
||||||
explicit multi_array(const ExtentList& sizes,
|
explicit multi_array(const ExtentList& sizes,
|
||||||
@@ -75,13 +75,19 @@ public:
|
|||||||
const storage_order_type& store = c_storage_order(),
|
const storage_order_type& store = c_storage_order(),
|
||||||
const Allocator& alloc = Allocator());
|
const Allocator& alloc = Allocator());
|
||||||
multi_array(const multi_array& x);
|
multi_array(const multi_array& x);
|
||||||
multi_array(const const_multi_array_ref<ValueType,NumDims>& x);
|
multi_array(const const_multi_array_ref<ValueType,NumDims>& x,
|
||||||
multi_array(const const_subarray<NumDims>::type& x);
|
const Allocator& alloc = Allocator());
|
||||||
multi_array(const const_array_view<NumDims>::type& x);
|
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 multi_array_ref<ValueType,NumDims>& x,
|
||||||
multi_array(const subarray<NumDims>::type& x);
|
const Allocator& alloc = Allocator());
|
||||||
multi_array(const array_view<NumDims>::type& x);
|
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();
|
~multi_array();
|
||||||
|
|
||||||
@@ -207,15 +213,21 @@ elements.
|
|||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><programlisting>
|
<term><programlisting>
|
||||||
<![CDATA[multi_array(const multi_array& x);
|
<![CDATA[multi_array(const multi_array& x);
|
||||||
multi_array(const const_multi_array_ref<ValueType,NumDims>& x);
|
multi_array(const const_multi_array_ref<ValueType,NumDims>& x,
|
||||||
multi_array(const const_subarray<NumDims>::type& x);
|
const Allocator& alloc = Allocator());
|
||||||
multi_array(const const_array_view<NumDims>::type& x);
|
multi_array(const const_subarray<NumDims>::type& x,
|
||||||
multi_array(const multi_array_ref<ValueType,NumDims>& x);
|
const Allocator& alloc = Allocator());
|
||||||
multi_array(const subarray<NumDims>::type& x);
|
multi_array(const const_array_view<NumDims>::type& x,
|
||||||
multi_array(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>
|
</programlisting></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>These constructors all constructs a <literal>multi_array</literal> and
|
<para>These constructors all construct a <literal>multi_array</literal> and
|
||||||
perform a deep copy of <literal>x</literal>.
|
perform a deep copy of <literal>x</literal>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ of the constructors.
|
|||||||
<para>
|
<para>
|
||||||
<literal>multi_array_ref</literal> models
|
<literal>multi_array_ref</literal> models
|
||||||
<link linkend="MultiArray">MultiArray</link>,
|
<link linkend="MultiArray">MultiArray</link>,
|
||||||
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>.
|
<ulink url="../../../libs/utility/CopyConstructible.html">CopyConstructible</ulink>
|
||||||
and depending on the element type, it may also model
|
and depending on the element type, it may also model
|
||||||
<ulink url="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
|
Detailed descriptions are provided here only for operations that are
|
||||||
not described in the <literal>multi_array</literal> reference.
|
not described in the <literal>multi_array</literal> reference.
|
||||||
</para>
|
</para>
|
||||||
@@ -198,7 +198,7 @@ dimensions.
|
|||||||
<formalpara>
|
<formalpara>
|
||||||
<title>Complexity</title>
|
<title>Complexity</title>
|
||||||
<para> Constant time (for contrast, compare this to
|
<para> Constant time (for contrast, compare this to
|
||||||
the <literal>multi_array</literal> class copy constructor.
|
the <literal>multi_array</literal> class copy constructor).
|
||||||
</para></formalpara>
|
</para></formalpara>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
// Copyright 2002 The Trustees of Indiana University.
|
// 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
|
// Use, modification and distribution is subject to the Boost Software
|
||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
@@ -10,14 +13,19 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BOOST_MULTI_ARRAY_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_HPP
|
||||||
#define BOOST_MULTI_ARRAY_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// multi_array.hpp - contains the multi_array class template
|
// multi_array.hpp - contains the multi_array class template
|
||||||
// declaration and definition
|
// 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/base.hpp"
|
||||||
#include "boost/multi_array/collection_concept.hpp"
|
#include "boost/multi_array/collection_concept.hpp"
|
||||||
#include "boost/multi_array/copy_array.hpp"
|
#include "boost/multi_array/copy_array.hpp"
|
||||||
@@ -25,6 +33,8 @@
|
|||||||
#include "boost/multi_array/subarray.hpp"
|
#include "boost/multi_array/subarray.hpp"
|
||||||
#include "boost/multi_array/multi_array_ref.hpp"
|
#include "boost/multi_array/multi_array_ref.hpp"
|
||||||
#include "boost/multi_array/algorithm.hpp"
|
#include "boost/multi_array/algorithm.hpp"
|
||||||
|
#include "boost/core/alloc_construct.hpp"
|
||||||
|
#include "boost/core/empty_value.hpp"
|
||||||
#include "boost/array.hpp"
|
#include "boost/array.hpp"
|
||||||
#include "boost/mpl/if.hpp"
|
#include "boost/mpl/if.hpp"
|
||||||
#include "boost/type_traits.hpp"
|
#include "boost/type_traits.hpp"
|
||||||
@@ -109,8 +119,10 @@ struct disable_multi_array_impl<int>
|
|||||||
template<typename T, std::size_t NumDims,
|
template<typename T, std::size_t NumDims,
|
||||||
typename Allocator>
|
typename Allocator>
|
||||||
class multi_array :
|
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;
|
typedef multi_array_ref<T,NumDims> super_type;
|
||||||
public:
|
public:
|
||||||
typedef typename super_type::value_type value_type;
|
typedef typename super_type::value_type value_type;
|
||||||
@@ -137,22 +149,25 @@ public:
|
|||||||
typedef boost::detail::multi_array::multi_array_view<T,NDims> type;
|
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(),
|
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();
|
allocate_space();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ExtentList>
|
template <class ExtentList>
|
||||||
explicit multi_array(
|
explicit multi_array(
|
||||||
ExtentList const& extents
|
ExtentList const& extents,
|
||||||
|
const Allocator& alloc = Allocator()
|
||||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
, typename mpl::if_<
|
, typename mpl::if_<
|
||||||
detail::multi_array::is_multi_array_impl<ExtentList>,
|
detail::multi_array::is_multi_array_impl<ExtentList>,
|
||||||
int&,int>::type* = 0
|
int&,int>::type* = 0
|
||||||
#endif
|
#endif
|
||||||
) :
|
) :
|
||||||
super_type((T*)initial_base_,extents) {
|
super_type((T*)initial_base_,extents),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||||
allocate_space();
|
allocate_space();
|
||||||
@@ -162,7 +177,8 @@ public:
|
|||||||
template <class ExtentList>
|
template <class ExtentList>
|
||||||
explicit multi_array(ExtentList const& extents,
|
explicit multi_array(ExtentList const& extents,
|
||||||
const general_storage_order<NumDims>& so) :
|
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<
|
boost::function_requires<
|
||||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||||
allocate_space();
|
allocate_space();
|
||||||
@@ -172,7 +188,8 @@ public:
|
|||||||
explicit multi_array(ExtentList const& extents,
|
explicit multi_array(ExtentList const& extents,
|
||||||
const general_storage_order<NumDims>& so,
|
const general_storage_order<NumDims>& so,
|
||||||
Allocator const& alloc) :
|
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<
|
boost::function_requires<
|
||||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||||
allocate_space();
|
allocate_space();
|
||||||
@@ -180,8 +197,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
explicit multi_array(const detail::multi_array
|
explicit multi_array(const detail::multi_array
|
||||||
::extent_gen<NumDims>& ranges) :
|
::extent_gen<NumDims>& ranges,
|
||||||
super_type((T*)initial_base_,ranges) {
|
const Allocator& alloc = Allocator()) :
|
||||||
|
super_type((T*)initial_base_,ranges),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc) {
|
||||||
|
|
||||||
allocate_space();
|
allocate_space();
|
||||||
}
|
}
|
||||||
@@ -190,7 +209,8 @@ public:
|
|||||||
explicit multi_array(const detail::multi_array
|
explicit multi_array(const detail::multi_array
|
||||||
::extent_gen<NumDims>& ranges,
|
::extent_gen<NumDims>& ranges,
|
||||||
const general_storage_order<NumDims>& so) :
|
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();
|
allocate_space();
|
||||||
}
|
}
|
||||||
@@ -200,13 +220,15 @@ public:
|
|||||||
::extent_gen<NumDims>& ranges,
|
::extent_gen<NumDims>& ranges,
|
||||||
const general_storage_order<NumDims>& so,
|
const general_storage_order<NumDims>& so,
|
||||||
Allocator const& alloc) :
|
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();
|
allocate_space();
|
||||||
}
|
}
|
||||||
|
|
||||||
multi_array(const multi_array& rhs) :
|
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();
|
allocate_space();
|
||||||
boost::detail::multi_array::copy_n(rhs.base_,rhs.num_elements(),base_);
|
boost::detail::multi_array::copy_n(rhs.base_,rhs.num_elements(),base_);
|
||||||
}
|
}
|
||||||
@@ -223,8 +245,10 @@ public:
|
|||||||
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
template <typename OPtr>
|
template <typename OPtr>
|
||||||
multi_array(const const_multi_array_ref<T,NumDims,OPtr>& rhs,
|
multi_array(const const_multi_array_ref<T,NumDims,OPtr>& rhs,
|
||||||
const general_storage_order<NumDims>& so = c_storage_order())
|
const general_storage_order<NumDims>& so = c_storage_order(),
|
||||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,so,rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
// Warning! storage order may change, hence the following copy technique.
|
// Warning! storage order may change, hence the following copy technique.
|
||||||
@@ -234,8 +258,10 @@ public:
|
|||||||
template <typename OPtr>
|
template <typename OPtr>
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
const_sub_array<T,NumDims,OPtr>& rhs,
|
const_sub_array<T,NumDims,OPtr>& rhs,
|
||||||
const general_storage_order<NumDims>& so = c_storage_order())
|
const general_storage_order<NumDims>& so = c_storage_order(),
|
||||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,so,rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -245,8 +271,10 @@ public:
|
|||||||
template <typename OPtr>
|
template <typename OPtr>
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
const_multi_array_view<T,NumDims,OPtr>& rhs,
|
const_multi_array_view<T,NumDims,OPtr>& rhs,
|
||||||
const general_storage_order<NumDims>& so = c_storage_order())
|
const general_storage_order<NumDims>& so = c_storage_order(),
|
||||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,so,rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -256,8 +284,10 @@ public:
|
|||||||
// More limited support for MSVC
|
// More limited support for MSVC
|
||||||
|
|
||||||
|
|
||||||
multi_array(const const_multi_array_ref<T,NumDims>& rhs)
|
multi_array(const const_multi_array_ref<T,NumDims>& rhs,
|
||||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
// Warning! storage order may change, hence the following copy technique.
|
// 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,
|
multi_array(const const_multi_array_ref<T,NumDims>& rhs,
|
||||||
const general_storage_order<NumDims>& so)
|
const general_storage_order<NumDims>& so,
|
||||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,so,rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
// Warning! storage order may change, hence the following copy technique.
|
// Warning! storage order may change, hence the following copy technique.
|
||||||
@@ -274,8 +306,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
const_sub_array<T,NumDims>& rhs)
|
const_sub_array<T,NumDims>& rhs,
|
||||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -283,8 +317,10 @@ public:
|
|||||||
|
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
const_sub_array<T,NumDims>& rhs,
|
const_sub_array<T,NumDims>& rhs,
|
||||||
const general_storage_order<NumDims>& so)
|
const general_storage_order<NumDims>& so,
|
||||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,so,rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -292,8 +328,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
const_multi_array_view<T,NumDims>& rhs)
|
const_multi_array_view<T,NumDims>& rhs,
|
||||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -301,8 +339,10 @@ public:
|
|||||||
|
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
const_multi_array_view<T,NumDims>& rhs,
|
const_multi_array_view<T,NumDims>& rhs,
|
||||||
const general_storage_order<NumDims>& so)
|
const general_storage_order<NumDims>& so,
|
||||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,so,rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -311,8 +351,10 @@ public:
|
|||||||
#endif // !BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
#endif // !BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
|
|
||||||
// Thes constructors are necessary because of more exact template matches.
|
// Thes constructors are necessary because of more exact template matches.
|
||||||
multi_array(const multi_array_ref<T,NumDims>& rhs)
|
multi_array(const multi_array_ref<T,NumDims>& rhs,
|
||||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
// Warning! storage order may change, hence the following copy technique.
|
// Warning! storage order may change, hence the following copy technique.
|
||||||
@@ -320,8 +362,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
multi_array(const multi_array_ref<T,NumDims>& rhs,
|
multi_array(const multi_array_ref<T,NumDims>& rhs,
|
||||||
const general_storage_order<NumDims>& so)
|
const general_storage_order<NumDims>& so,
|
||||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,so,rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
// Warning! storage order may change, hence the following copy technique.
|
// Warning! storage order may change, hence the following copy technique.
|
||||||
@@ -330,8 +374,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
sub_array<T,NumDims>& rhs)
|
sub_array<T,NumDims>& rhs,
|
||||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -339,8 +385,10 @@ public:
|
|||||||
|
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
sub_array<T,NumDims>& rhs,
|
sub_array<T,NumDims>& rhs,
|
||||||
const general_storage_order<NumDims>& so)
|
const general_storage_order<NumDims>& so,
|
||||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,so,rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -348,8 +396,10 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
multi_array_view<T,NumDims>& rhs)
|
multi_array_view<T,NumDims>& rhs,
|
||||||
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,c_storage_order(),rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -357,8 +407,10 @@ public:
|
|||||||
|
|
||||||
multi_array(const detail::multi_array::
|
multi_array(const detail::multi_array::
|
||||||
multi_array_view<T,NumDims>& rhs,
|
multi_array_view<T,NumDims>& rhs,
|
||||||
const general_storage_order<NumDims>& so)
|
const general_storage_order<NumDims>& so,
|
||||||
: super_type(0,so,rhs.index_bases(),rhs.shape())
|
const Allocator& alloc = Allocator())
|
||||||
|
: super_type(0,so,rhs.index_bases(),rhs.shape()),
|
||||||
|
alloc_base(boost::empty_init_t(),alloc)
|
||||||
{
|
{
|
||||||
allocate_space();
|
allocate_space();
|
||||||
std::copy(rhs.begin(),rhs.end(),this->begin());
|
std::copy(rhs.begin(),rhs.end(),this->begin());
|
||||||
@@ -403,7 +455,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// build a multi_array with the specs given
|
// 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
|
// build a view of tmp with the minimum extents
|
||||||
@@ -449,6 +501,7 @@ public:
|
|||||||
using std::swap;
|
using std::swap;
|
||||||
// Swap the internals of these arrays.
|
// Swap the internals of these arrays.
|
||||||
swap(this->super_type::base_,new_array.super_type::base_);
|
swap(this->super_type::base_,new_array.super_type::base_);
|
||||||
|
swap(this->allocator(),new_array.allocator());
|
||||||
swap(this->storage_,new_array.storage_);
|
swap(this->storage_,new_array.storage_);
|
||||||
swap(this->extent_list_,new_array.extent_list_);
|
swap(this->extent_list_,new_array.extent_list_);
|
||||||
swap(this->stride_list_,new_array.stride_list_);
|
swap(this->stride_list_,new_array.stride_list_);
|
||||||
@@ -456,7 +509,6 @@ public:
|
|||||||
swap(this->origin_offset_,new_array.origin_offset_);
|
swap(this->origin_offset_,new_array.origin_offset_);
|
||||||
swap(this->directional_offset_,new_array.directional_offset_);
|
swap(this->directional_offset_,new_array.directional_offset_);
|
||||||
swap(this->num_elements_,new_array.num_elements_);
|
swap(this->num_elements_,new_array.num_elements_);
|
||||||
swap(this->allocator_,new_array.allocator_);
|
|
||||||
swap(this->base_,new_array.base_);
|
swap(this->base_,new_array.base_);
|
||||||
swap(this->allocated_elements_,new_array.allocated_elements_);
|
swap(this->allocated_elements_,new_array.allocated_elements_);
|
||||||
|
|
||||||
@@ -469,26 +521,43 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
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() {
|
void allocate_space() {
|
||||||
typename Allocator::const_pointer no_hint=0;
|
base_ = allocator().allocate(this->num_elements());
|
||||||
base_ = allocator_.allocate(this->num_elements(),no_hint);
|
|
||||||
this->set_base_ptr(base_);
|
this->set_base_ptr(base_);
|
||||||
allocated_elements_ = this->num_elements();
|
allocated_elements_ = this->num_elements();
|
||||||
std::uninitialized_fill_n(base_,allocated_elements_,T());
|
boost::alloc_construct_n(allocator(),base_,allocated_elements_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void deallocate_space() {
|
void deallocate_space() {
|
||||||
if(base_) {
|
if(base_) {
|
||||||
for(T* i = base_; i != base_+allocated_elements_; ++i)
|
boost::alloc_destroy_n(allocator(),base_,allocated_elements_);
|
||||||
allocator_.destroy(i);
|
allocator().deallocate(base_,allocated_elements_);
|
||||||
allocator_.deallocate(base_,allocated_elements_);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef boost::array<size_type,NumDims> size_list;
|
typedef boost::array<size_type,NumDims> size_list;
|
||||||
typedef boost::array<index,NumDims> index_list;
|
typedef boost::array<index,NumDims> index_list;
|
||||||
|
|
||||||
Allocator allocator_;
|
|
||||||
T* base_;
|
T* base_;
|
||||||
size_type allocated_elements_;
|
size_type allocated_elements_;
|
||||||
enum {initial_base_ = 0};
|
enum {initial_base_ = 0};
|
||||||
@@ -496,4 +565,8 @@ private:
|
|||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_MULTI_ARRAY_RG071801_HPP
|
#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406)
|
||||||
|
# pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef BOOST_ALGORITHM_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_ALGORITHM_HPP
|
||||||
#define BOOST_ALGORITHM_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_ALGORITHM_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
|
|
||||||
#include "boost/iterator.hpp"
|
#include <iterator>
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@@ -100,4 +100,4 @@ copy_n(InputIter first, Size count, OutputIter result) {
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_ALGORITHM_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BASE_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_BASE_HPP
|
||||||
#define BASE_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_BASE_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// base.hpp - some implementation base classes for from which
|
// base.hpp - some implementation base classes for from which
|
||||||
@@ -463,6 +463,7 @@ protected:
|
|||||||
index bound_adjustment = stride < 0 ? 1 : 0;
|
index bound_adjustment = stride < 0 ? 1 : 0;
|
||||||
BOOST_ASSERT(((index_bases[n] - bound_adjustment) <= finish) &&
|
BOOST_ASSERT(((index_bases[n] - bound_adjustment) <= finish) &&
|
||||||
(finish <= (index_bases[n] + index(extents[n]) - bound_adjustment)));
|
(finish <= (index_bases[n] + index(extents[n]) - bound_adjustment)));
|
||||||
|
ignore_unused_variable_warning(bound_adjustment);
|
||||||
#endif // BOOST_DISABLE_ASSERTS
|
#endif // BOOST_DISABLE_ASSERTS
|
||||||
|
|
||||||
|
|
||||||
@@ -497,4 +498,4 @@ protected:
|
|||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BASE_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef COLLECTION_CONCEPT_RG103101_HPP
|
#ifndef BOOST_MULTI_ARRAY_COLLECTION_CONCEPT_HPP
|
||||||
#define COLLECTION_CONCEPT_RG103101_HPP
|
#define BOOST_MULTI_ARRAY_COLLECTION_CONCEPT_HPP
|
||||||
|
|
||||||
#include "boost/concept_check.hpp"
|
#include "boost/concept_check.hpp"
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ namespace multi_array { // Old location for this
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // COLLECTION_CONCEPT_RG103101_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BOOST_MULTI_ARRAY_CONCEPT_CHECKS_RG110101_HPP
|
#ifndef BOOST_MULTI_ARRAY_CONCEPT_CHECKS_HPP
|
||||||
#define BOOST_MULTI_ARRAY_CONCEPT_CHECKS_RG110101_HPP
|
#define BOOST_MULTI_ARRAY_CONCEPT_CHECKS_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// concept-checks.hpp - Checks out Const MultiArray and MultiArray
|
// concept-checks.hpp - Checks out Const MultiArray and MultiArray
|
||||||
@@ -39,8 +39,6 @@ namespace detail {
|
|||||||
|
|
||||||
template <typename Array, typename IdxGen, typename Call_Type>
|
template <typename Array, typename IdxGen, typename Call_Type>
|
||||||
static void call(Array& a, const IdxGen& idgen, Call_Type c) {
|
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);
|
idgen_helper<N-1>::call(a,idgen[c],c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -50,8 +48,6 @@ namespace detail {
|
|||||||
|
|
||||||
template <typename Array, typename IdxGen, typename Call_Type>
|
template <typename Array, typename IdxGen, typename Call_Type>
|
||||||
static void call(Array& a, const IdxGen& idgen, 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 ];
|
a[ idgen ];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -222,4 +218,4 @@ namespace detail {
|
|||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_MULTI_ARRAY_CONCEPT_CHECKS_RG110101_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef COPY_ARRAY_RG092101_HPP
|
#ifndef BOOST_MULTI_ARRAY_COPY_ARRAY_HPP
|
||||||
#define COPY_ARRAY_RG092101_HPP
|
#define BOOST_MULTI_ARRAY_COPY_ARRAY_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// copy_array.hpp - generic code for copying the contents of one
|
// copy_array.hpp - generic code for copying the contents of one
|
||||||
@@ -65,4 +65,4 @@ void copy_array (Array1& source, Array2& dest) {
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // COPY_ARRAY_RG092101_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BOOST_EXTENT_GEN_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_EXTENT_GEN_HPP
|
||||||
#define BOOST_EXTENT_GEN_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_EXTENT_GEN_HPP
|
||||||
|
|
||||||
#include "boost/multi_array/extent_range.hpp"
|
#include "boost/multi_array/extent_range.hpp"
|
||||||
#include "boost/multi_array/range_list.hpp"
|
#include "boost/multi_array/range_list.hpp"
|
||||||
@@ -72,4 +72,4 @@ public:
|
|||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_EXTENT_GEN_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BOOST_EXTENT_RANGE_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_EXTENT_RANGE_HPP
|
||||||
#define BOOST_EXTENT_RANGE_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_EXTENT_RANGE_HPP
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@@ -46,4 +46,4 @@ public:
|
|||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_EXTENT_RANGE_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BOOST_INDEX_GEN_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_INDEX_GEN_HPP
|
||||||
#define BOOST_INDEX_GEN_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_INDEX_GEN_HPP
|
||||||
|
|
||||||
#include "boost/array.hpp"
|
#include "boost/array.hpp"
|
||||||
#include "boost/multi_array/index_range.hpp"
|
#include "boost/multi_array/index_range.hpp"
|
||||||
@@ -78,4 +78,4 @@ public:
|
|||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_INDEX_GEN_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BOOST_INDEX_RANGE_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_INDEX_RANGE_HPP
|
||||||
#define BOOST_INDEX_RANGE_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_INDEX_RANGE_HPP
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -107,6 +107,12 @@ namespace multi_array {
|
|||||||
|
|
||||||
index stride() const { return stride_; }
|
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)
|
void set_index_range(index start, index finish, index stride=1)
|
||||||
{
|
{
|
||||||
start_ = start;
|
start_ = start;
|
||||||
@@ -185,4 +191,4 @@ namespace multi_array {
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_INDEX_RANGE_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Copyright 2002 The Trustees of Indiana University.
|
// Copyright 2002 The Trustees of Indiana University.
|
||||||
|
|
||||||
// Use, modification and distribution is subject to the Boost Software
|
// Use, modification and distribution is subject to the Boost Software
|
||||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
@@ -10,16 +10,19 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef ITERATOR_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_ITERATOR_HPP
|
||||||
#define ITERATOR_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_ITERATOR_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// iterator.hpp - implementation of iterators for the
|
// iterator.hpp - implementation of iterators for the
|
||||||
// multi-dimensional array class
|
// multi-dimensional array class
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "boost/multi_array/base.hpp"
|
#include <boost/multi_array/base.hpp>
|
||||||
#include "boost/iterator/iterator_facade.hpp"
|
#include <boost/type.hpp>
|
||||||
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
|
#include <boost/iterator/iterator_categories.hpp>
|
||||||
|
#include <boost/iterator/enable_if_convertible.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@@ -51,7 +54,7 @@ template <typename T, typename TPtr, typename NumDims, typename Reference,
|
|||||||
typename IteratorCategory>
|
typename IteratorCategory>
|
||||||
class array_iterator
|
class array_iterator
|
||||||
: public
|
: public
|
||||||
iterator_facade<
|
iterators::iterator_facade<
|
||||||
array_iterator<T,TPtr,NumDims,Reference,IteratorCategory>
|
array_iterator<T,TPtr,NumDims,Reference,IteratorCategory>
|
||||||
, typename associated_types<T,NumDims>::value_type
|
, typename associated_types<T,NumDims>::value_type
|
||||||
, IteratorCategory
|
, IteratorCategory
|
||||||
@@ -60,13 +63,13 @@ class array_iterator
|
|||||||
, private
|
, private
|
||||||
value_accessor_generator<T,NumDims>::type
|
value_accessor_generator<T,NumDims>::type
|
||||||
{
|
{
|
||||||
friend class iterator_core_access;
|
friend class ::boost::iterators::iterator_core_access;
|
||||||
typedef detail::multi_array::associated_types<T,NumDims> access_t;
|
typedef detail::multi_array::associated_types<T,NumDims> access_t;
|
||||||
|
|
||||||
typedef iterator_facade<
|
typedef iterators::iterator_facade<
|
||||||
array_iterator<T,TPtr,NumDims,Reference,IteratorCategory>
|
array_iterator<T,TPtr,NumDims,Reference,IteratorCategory>
|
||||||
, typename detail::multi_array::associated_types<T,NumDims>::value_type
|
, typename detail::multi_array::associated_types<T,NumDims>::value_type
|
||||||
, boost::random_access_traversal_tag
|
, boost::iterators::random_access_traversal_tag
|
||||||
, Reference
|
, Reference
|
||||||
> facade_type;
|
> facade_type;
|
||||||
|
|
||||||
@@ -78,14 +81,14 @@ class array_iterator
|
|||||||
friend class array_iterator;
|
friend class array_iterator;
|
||||||
#else
|
#else
|
||||||
public:
|
public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
index idx_;
|
index idx_;
|
||||||
TPtr base_;
|
TPtr base_;
|
||||||
const size_type* extents_;
|
const size_type* extents_;
|
||||||
const index* strides_;
|
const index* strides_;
|
||||||
const index* index_base_;
|
const index* index_base_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Typedefs to circumvent ambiguities between parent classes
|
// Typedefs to circumvent ambiguities between parent classes
|
||||||
typedef typename facade_type::reference reference;
|
typedef typename facade_type::reference reference;
|
||||||
@@ -103,7 +106,7 @@ public:
|
|||||||
template <typename OPtr, typename ORef, typename Cat>
|
template <typename OPtr, typename ORef, typename Cat>
|
||||||
array_iterator(
|
array_iterator(
|
||||||
const array_iterator<T,OPtr,NumDims,ORef,Cat>& rhs
|
const array_iterator<T,OPtr,NumDims,ORef,Cat>& rhs
|
||||||
, typename boost::enable_if_convertible<OPtr,TPtr>::type* = 0
|
, typename boost::iterators::enable_if_convertible<OPtr,TPtr>::type* = 0
|
||||||
)
|
)
|
||||||
: idx_(rhs.idx_), base_(rhs.base_), extents_(rhs.extents_),
|
: idx_(rhs.idx_), base_(rhs.base_), extents_(rhs.extents_),
|
||||||
strides_(rhs.strides_), index_base_(rhs.index_base_) { }
|
strides_(rhs.strides_), index_base_(rhs.index_base_) { }
|
||||||
@@ -115,7 +118,7 @@ public:
|
|||||||
{
|
{
|
||||||
return operator_arrow_proxy<reference>(this->dereference());
|
return operator_arrow_proxy<reference>(this->dereference());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
reference dereference() const
|
reference dereference() const
|
||||||
{
|
{
|
||||||
@@ -127,7 +130,7 @@ public:
|
|||||||
strides_,
|
strides_,
|
||||||
index_base_);
|
index_base_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void increment() { ++idx_; }
|
void increment() { ++idx_; }
|
||||||
void decrement() { --idx_; }
|
void decrement() { --idx_; }
|
||||||
|
|
||||||
@@ -162,4 +165,4 @@ public:
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // ITERATOR_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BOOST_MULTI_ARRAY_REF_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_MULTI_ARRAY_REF_HPP
|
||||||
#define BOOST_MULTI_ARRAY_REF_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_MULTI_ARRAY_REF_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// multi_array_ref.hpp - code for creating "views" of array data.
|
// multi_array_ref.hpp - code for creating "views" of array data.
|
||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
CollectionConcept<ExtentList> >();
|
CollectionConcept<ExtentList> >();
|
||||||
|
|
||||||
index_base_list_.assign(0);
|
index_base_list_.fill(0);
|
||||||
init_multi_array_ref(extents.begin());
|
init_multi_array_ref(extents.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ public:
|
|||||||
init_multi_array_ref(extents);
|
init_multi_array_ref(extents);
|
||||||
} else {
|
} else {
|
||||||
boost::array<index,NumDims> extent_list;
|
boost::array<index,NumDims> extent_list;
|
||||||
extent_list.assign(0);
|
extent_list.fill(0);
|
||||||
init_multi_array_ref(extent_list.begin());
|
init_multi_array_ref(extent_list.begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -619,4 +619,4 @@ protected:
|
|||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_MULTI_ARRAY_REF_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef RANGE_LIST_RG072501_HPP
|
#ifndef BOOST_MULTI_ARRAY_RANGE_LIST_HPP
|
||||||
#define RANGE_LIST_RG072501_HPP
|
#define BOOST_MULTI_ARRAY_RANGE_LIST_HPP
|
||||||
//
|
//
|
||||||
// range_list.hpp - helper to build boost::arrays for *_set types
|
// range_list.hpp - helper to build boost::arrays for *_set types
|
||||||
//
|
//
|
||||||
@@ -67,4 +67,4 @@ public:
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // RANGE_LIST_RG072501_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BOOST_STORAGE_ORDER_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_STORAGE_ORDER_HPP
|
||||||
#define BOOST_STORAGE_ORDER_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_STORAGE_ORDER_HPP
|
||||||
|
|
||||||
#include "boost/multi_array/types.hpp"
|
#include "boost/multi_array/types.hpp"
|
||||||
#include "boost/array.hpp"
|
#include "boost/array.hpp"
|
||||||
@@ -48,14 +48,14 @@ namespace boost {
|
|||||||
for (size_type i=0; i != NumDims; ++i) {
|
for (size_type i=0; i != NumDims; ++i) {
|
||||||
ordering_[i] = NumDims - 1 - i;
|
ordering_[i] = NumDims - 1 - i;
|
||||||
}
|
}
|
||||||
ascending_.assign(true);
|
ascending_.fill(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
general_storage_order(const fortran_storage_order&) {
|
general_storage_order(const fortran_storage_order&) {
|
||||||
for (size_type i=0; i != NumDims; ++i) {
|
for (size_type i=0; i != NumDims; ++i) {
|
||||||
ordering_[i] = i;
|
ordering_[i] = i;
|
||||||
}
|
}
|
||||||
ascending_.assign(true);
|
ascending_.fill(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type ordering(size_type dim) const { return ordering_[dim]; }
|
size_type ordering(size_type dim) const { return ordering_[dim]; }
|
||||||
@@ -122,4 +122,4 @@ namespace boost {
|
|||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_ARRAY_STORAGE_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef SUBARRAY_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_SUBARRAY_HPP
|
||||||
#define SUBARRAY_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_SUBARRAY_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// subarray.hpp - used to implement standard operator[] on
|
// subarray.hpp - used to implement standard operator[] on
|
||||||
@@ -384,4 +384,4 @@ public:
|
|||||||
};
|
};
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // SUBARRAY_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
|
|
||||||
#ifndef BOOST_MULTI_ARRAY_TYPES_RG071801_HPP
|
#ifndef BOOST_MULTI_ARRAY_TYPES_HPP
|
||||||
#define BOOST_MULTI_ARRAY_TYPES_RG071801_HPP
|
#define BOOST_MULTI_ARRAY_TYPES_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// types.hpp - supply types that are needed by several headers
|
// types.hpp - supply types that are needed by several headers
|
||||||
@@ -35,4 +35,4 @@ typedef std::ptrdiff_t index;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_MULTI_ARRAY_TYPES_RG071801_HPP
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// Andrew Lumsdaine
|
// Andrew Lumsdaine
|
||||||
// See http://www.boost.org/libs/multi_array for documentation.
|
// See http://www.boost.org/libs/multi_array for documentation.
|
||||||
|
|
||||||
#ifndef BOOST_MULTI_ARRAY_VIEW_RG071301_HPP
|
#ifndef BOOST_MULTI_ARRAY_VIEW_HPP
|
||||||
#define BOOST_MULTI_ARRAY_VIEW_RG071301_HPP
|
#define BOOST_MULTI_ARRAY_VIEW_HPP
|
||||||
|
|
||||||
//
|
//
|
||||||
// view.hpp - code for creating "views" of array data.
|
// view.hpp - code for creating "views" of array data.
|
||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void reindex(index value) {
|
void reindex(index value) {
|
||||||
index_base_list_.assign(value);
|
index_base_list_.fill(value);
|
||||||
origin_offset_ =
|
origin_offset_ =
|
||||||
this->calculate_indexing_offset(stride_list_,index_base_list_);
|
this->calculate_indexing_offset(stride_list_,index_base_list_);
|
||||||
}
|
}
|
||||||
@@ -231,7 +231,7 @@ public: // should be protected
|
|||||||
const boost::array<Index,NumDims>& strides):
|
const boost::array<Index,NumDims>& strides):
|
||||||
base_(base), origin_offset_(0) {
|
base_(base), origin_offset_(0) {
|
||||||
|
|
||||||
index_base_list_.assign(0);
|
index_base_list_.fill(0);
|
||||||
|
|
||||||
// Get the extents and strides
|
// Get the extents and strides
|
||||||
boost::detail::multi_array::
|
boost::detail::multi_array::
|
||||||
@@ -457,5 +457,4 @@ public:
|
|||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#endif // BOOST_MULTI_ARRAY_VIEW_RG071301_HPP
|
#endif
|
||||||
|
|
||||||
|
|||||||
16
meta/libraries.json
Normal file
16
meta/libraries.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"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>"
|
||||||
|
],
|
||||||
|
"cxxstd": "03"
|
||||||
|
}
|
||||||
@@ -4,48 +4,50 @@
|
|||||||
# "as is" without express or implied warranty, and with no claim as
|
# "as is" without express or implied warranty, and with no claim as
|
||||||
# to its suitability for any purpose.
|
# to its suitability for any purpose.
|
||||||
|
|
||||||
test-suite multi_array
|
import testing ;
|
||||||
:
|
|
||||||
[ 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 ]
|
|
||||||
|
|
||||||
[ compile concept_checks.cpp ]
|
project : requirements <library>/boost/multi_array//boost_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 : <library>/boost/test//included ;
|
||||||
|
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 ;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "generative_tests.hpp"
|
#include "generative_tests.hpp"
|
||||||
#include "boost/static_assert.hpp"
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
template <typename Array>
|
template <typename Array>
|
||||||
void access(Array& A, const mutable_array_tag&) {
|
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 i = idx0; i != idx0+2; ++i)
|
||||||
for (index j = idx1; j != idx1+3; ++j)
|
for (index j = idx1; j != idx1+3; ++j)
|
||||||
for (index k = idx2; k != idx2+4; ++k) {
|
for (index k = idx2; k != idx2+4; ++k) {
|
||||||
BOOST_CHECK(A[i][j][k] == cnum++);
|
BOOST_TEST(A[i][j][k] == cnum++);
|
||||||
BOOST_CHECK(CA[i][j][k] == A[i][j][k]);
|
BOOST_TEST(CA[i][j][k] == A[i][j][k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// operator()
|
// operator()
|
||||||
@@ -52,12 +52,12 @@ void access(Array& A, const const_array_tag&) {
|
|||||||
for (index k2 = idx2; k2 != idx2+4; ++k2) {
|
for (index k2 = idx2; k2 != idx2+4; ++k2) {
|
||||||
boost::array<index,ndims> indices;
|
boost::array<index,ndims> indices;
|
||||||
indices[0] = i2; indices[1] = j2; indices[2] = k2;
|
indices[0] = i2; indices[1] = j2; indices[2] = k2;
|
||||||
BOOST_CHECK(A(indices) == A[i2][j2][k2]);
|
BOOST_TEST(A(indices) == A[i2][j2][k2]);
|
||||||
BOOST_CHECK(CA(indices) == A(indices));
|
BOOST_TEST(CA(indices) == A(indices));
|
||||||
}
|
}
|
||||||
++tests_run;
|
++tests_run;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_main(int,char*[]) {
|
int main() {
|
||||||
return run_generative_tests();
|
return run_generative_tests();
|
||||||
}
|
}
|
||||||
|
|||||||
151
test/allocators.cpp
Normal file
151
test/allocators.cpp
Normal 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();
|
||||||
|
}
|
||||||
@@ -15,10 +15,10 @@
|
|||||||
// with exceptions
|
// with exceptions
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "boost/test/minimal.hpp"
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
#define BOOST_ENABLE_ASSERT_HANDLER
|
#define BOOST_ENABLE_ASSERT_HANDLER
|
||||||
#include "boost/multi_array.hpp" // includes assert.hpp
|
#include <boost/multi_array.hpp> // includes assert.hpp
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ namespace boost {
|
|||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[]) {
|
main() {
|
||||||
|
|
||||||
typedef multi_array<int,2> array_t;
|
typedef multi_array<int,2> array_t;
|
||||||
|
|
||||||
@@ -55,5 +55,5 @@ test_main(int,char*[]) {
|
|||||||
//...all good
|
//...all good
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
#include "generative_tests.hpp"
|
#include "generative_tests.hpp"
|
||||||
#include "boost/array.hpp"
|
#include <boost/array.hpp>
|
||||||
#include "boost/multi_array.hpp"
|
#include <boost/multi_array.hpp>
|
||||||
#include "boost/cstdlib.hpp"
|
#include <boost/cstdlib.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ void access(Array& A, const mutable_array_tag&) {
|
|||||||
|
|
||||||
A = filler;
|
A = filler;
|
||||||
|
|
||||||
BOOST_CHECK(::equal(A,filler));
|
BOOST_TEST(::equal(A,filler));
|
||||||
++tests_run;
|
++tests_run;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +68,6 @@ void access(Array&, const const_array_tag&) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_main(int,char*[]) {
|
int main() {
|
||||||
return run_generative_tests();
|
return run_generative_tests();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
#include "generative_tests.hpp"
|
#include "generative_tests.hpp"
|
||||||
#include "boost/array.hpp"
|
#include <boost/array.hpp>
|
||||||
#include "boost/multi_array.hpp"
|
#include <boost/multi_array.hpp>
|
||||||
#include "boost/cstdlib.hpp"
|
#include <boost/cstdlib.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -50,11 +50,11 @@ template <typename Array>
|
|||||||
void access(Array& A, const const_array_tag&) {
|
void access(Array& A, const const_array_tag&) {
|
||||||
typedef boost::multi_array<int,3> array3;
|
typedef boost::multi_array<int,3> array3;
|
||||||
array3 acopy(A);
|
array3 acopy(A);
|
||||||
BOOST_CHECK(::equal(acopy,A));
|
BOOST_TEST(::equal(acopy,A));
|
||||||
++tests_run;
|
++tests_run;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_main(int,char*[]) {
|
int main() {
|
||||||
return run_generative_tests();
|
return run_generative_tests();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 <algorithm>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int, char*[])
|
main()
|
||||||
{
|
{
|
||||||
typedef boost::multi_array<double, 3> array;
|
typedef boost::multi_array<double, 3> array;
|
||||||
typedef array::size_type size_type;
|
typedef array::size_type size_type;
|
||||||
@@ -34,9 +34,9 @@ test_main(int, char*[])
|
|||||||
std::vector<double> vals(num_elements, 4.5);
|
std::vector<double> vals(num_elements, 4.5);
|
||||||
A.assign(vals.begin(),vals.end());
|
A.assign(vals.begin(),vals.end());
|
||||||
array B(A);
|
array B(A);
|
||||||
BOOST_CHECK(A == B);
|
BOOST_TEST(A == B);
|
||||||
BOOST_CHECK(B == A);
|
BOOST_TEST(B == A);
|
||||||
BOOST_CHECK(A[0] == B[0]);
|
BOOST_TEST(A[0] == B[0]);
|
||||||
}
|
}
|
||||||
// Assignment Operator
|
// Assignment Operator
|
||||||
{
|
{
|
||||||
@@ -44,15 +44,15 @@ test_main(int, char*[])
|
|||||||
std::vector<double> vals(num_elements, 4.5);
|
std::vector<double> vals(num_elements, 4.5);
|
||||||
A.assign(vals.begin(),vals.end());
|
A.assign(vals.begin(),vals.end());
|
||||||
B = A;
|
B = A;
|
||||||
BOOST_CHECK(A == B);
|
BOOST_TEST(A == B);
|
||||||
BOOST_CHECK(B == A);
|
BOOST_TEST(B == A);
|
||||||
BOOST_CHECK(B[0] == A[0]);
|
BOOST_TEST(B[0] == A[0]);
|
||||||
|
|
||||||
typedef array::index_range range;
|
typedef array::index_range range;
|
||||||
array::index_gen indices;
|
array::index_gen indices;
|
||||||
array::array_view<2>::type C = A[indices[2][range()][range()]];
|
array::array_view<2>::type C = A[indices[2][range()][range()]];
|
||||||
array::array_view<2>::type D = B[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
|
// Different Arrays
|
||||||
{
|
{
|
||||||
@@ -62,15 +62,15 @@ test_main(int, char*[])
|
|||||||
A.assign(valsA.begin(),valsA.end());
|
A.assign(valsA.begin(),valsA.end());
|
||||||
B.assign(valsB.begin(),valsB.end());
|
B.assign(valsB.begin(),valsB.end());
|
||||||
|
|
||||||
BOOST_CHECK(A != B);
|
BOOST_TEST(A != B);
|
||||||
BOOST_CHECK(B != A);
|
BOOST_TEST(B != A);
|
||||||
BOOST_CHECK(A[0] != B[0]);
|
BOOST_TEST(A[0] != B[0]);
|
||||||
|
|
||||||
typedef array::index_range range;
|
typedef array::index_range range;
|
||||||
array::index_gen indices;
|
array::index_gen indices;
|
||||||
array::array_view<2>::type C = A[indices[2][range()][range()]];
|
array::array_view<2>::type C = A[indices[2][range()][range()]];
|
||||||
array::array_view<2>::type D = B[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!
|
// Comparisons galore!
|
||||||
@@ -108,35 +108,35 @@ test_main(int, char*[])
|
|||||||
A.assign(valsA,valsA+num_elements);
|
A.assign(valsA,valsA+num_elements);
|
||||||
B.assign(valsB,valsB+num_elements);
|
B.assign(valsB,valsB+num_elements);
|
||||||
|
|
||||||
BOOST_CHECK(B < A);
|
BOOST_TEST(B < A);
|
||||||
BOOST_CHECK(A > B);
|
BOOST_TEST(A > B);
|
||||||
|
|
||||||
BOOST_CHECK(B <= A);
|
BOOST_TEST(B <= A);
|
||||||
BOOST_CHECK(A >= B);
|
BOOST_TEST(A >= B);
|
||||||
|
|
||||||
BOOST_CHECK(B[0] == A[0]);
|
BOOST_TEST(B[0] == A[0]);
|
||||||
BOOST_CHECK(B[2] < A[2]);
|
BOOST_TEST(B[2] < A[2]);
|
||||||
|
|
||||||
array C = A;
|
array C = A;
|
||||||
|
|
||||||
BOOST_CHECK(C <= A);
|
BOOST_TEST(C <= A);
|
||||||
BOOST_CHECK(C >= A);
|
BOOST_TEST(C >= A);
|
||||||
|
|
||||||
BOOST_CHECK(!(C < A));
|
BOOST_TEST(!(C < A));
|
||||||
BOOST_CHECK(!(C > A));
|
BOOST_TEST(!(C > A));
|
||||||
|
|
||||||
typedef array::index_range range;
|
typedef array::index_range range;
|
||||||
array::index_gen indices;
|
array::index_gen indices;
|
||||||
array::array_view<2>::type D = A[indices[2][range()][range()]];
|
array::array_view<2>::type D = A[indices[2][range()][range()]];
|
||||||
array::array_view<2>::type E = B[indices[2][range()][range()]];
|
array::array_view<2>::type E = B[indices[2][range()][range()]];
|
||||||
|
|
||||||
BOOST_CHECK(E < D);
|
BOOST_TEST(E < D);
|
||||||
BOOST_CHECK(E <= D);
|
BOOST_TEST(E <= D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,18 +15,18 @@
|
|||||||
// make sure the types meet concept requirements
|
// make sure the types meet concept requirements
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "boost/concept_check.hpp"
|
#include <boost/concept_check.hpp>
|
||||||
#include "boost/multi_array/concept_checks.hpp"
|
#include <boost/multi_array/concept_checks.hpp>
|
||||||
#include "boost/multi_array.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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
|
|||||||
@@ -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 <algorithm>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
@@ -30,10 +30,10 @@ void check_shape(const Array& A,
|
|||||||
int* strides,
|
int* strides,
|
||||||
unsigned int num_elements)
|
unsigned int num_elements)
|
||||||
{
|
{
|
||||||
BOOST_CHECK(A.num_elements() == num_elements);
|
BOOST_TEST(A.num_elements() == num_elements);
|
||||||
BOOST_CHECK(A.size() == *sizes);
|
BOOST_TEST(A.size() == *sizes);
|
||||||
BOOST_CHECK(std::equal(sizes, sizes + A.num_dimensions(), A.shape()));
|
BOOST_TEST(std::equal(sizes, sizes + A.num_dimensions(), A.shape()));
|
||||||
BOOST_CHECK(std::equal(strides, strides + A.num_dimensions(), A.strides()));
|
BOOST_TEST(std::equal(strides, strides + A.num_dimensions(), A.strides()));
|
||||||
check_shape(A[0], ++sizes, ++strides, num_elements / A.size());
|
check_shape(A[0], ++sizes, ++strides, num_elements / A.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ bool equal(const ArrayA& A, const ArrayB& B)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int, char*[])
|
main()
|
||||||
{
|
{
|
||||||
typedef boost::multi_array<double, 3>::size_type size_type;
|
typedef boost::multi_array<double, 3>::size_type size_type;
|
||||||
boost::array<size_type,3> sizes = { { 3, 3, 3 } };
|
boost::array<size_type,3> sizes = { { 3, 3, 3 } };
|
||||||
@@ -132,20 +132,20 @@ test_main(int, char*[])
|
|||||||
A.assign(vals.begin(),vals.end());
|
A.assign(vals.begin(),vals.end());
|
||||||
boost::multi_array<double, 3> B(A);
|
boost::multi_array<double, 3> B(A);
|
||||||
check_shape(B, &sizes[0], strides, num_elements);
|
check_shape(B, &sizes[0], strides, num_elements);
|
||||||
BOOST_CHECK(::equal(A, B));
|
BOOST_TEST(::equal(A, B));
|
||||||
|
|
||||||
double ptr[27];
|
double ptr[27];
|
||||||
boost::multi_array_ref<double, 3> C(ptr,sizes);
|
boost::multi_array_ref<double, 3> C(ptr,sizes);
|
||||||
A.assign(vals.begin(),vals.end());
|
A.assign(vals.begin(),vals.end());
|
||||||
boost::multi_array_ref<double, 3> D(C);
|
boost::multi_array_ref<double, 3> D(C);
|
||||||
check_shape(D, &sizes[0], strides, num_elements);
|
check_shape(D, &sizes[0], strides, num_elements);
|
||||||
BOOST_CHECK(C.data() == D.data());
|
BOOST_TEST(C.data() == D.data());
|
||||||
|
|
||||||
const double* cptr = ptr;
|
const double* cptr = ptr;
|
||||||
boost::const_multi_array_ref<double, 3> E(cptr,sizes);
|
boost::const_multi_array_ref<double, 3> E(cptr,sizes);
|
||||||
boost::const_multi_array_ref<double, 3> F(E);
|
boost::const_multi_array_ref<double, 3> F(E);
|
||||||
check_shape(F, &sizes[0], strides, num_elements);
|
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);
|
boost::const_multi_array_ref<double, 3> C(A);
|
||||||
check_shape(B, &sizes[0], strides, num_elements);
|
check_shape(B, &sizes[0], strides, num_elements);
|
||||||
check_shape(C, &sizes[0], strides, num_elements);
|
check_shape(C, &sizes[0], strides, num_elements);
|
||||||
BOOST_CHECK(B.data() == A.data());
|
BOOST_TEST(B.data() == A.data());
|
||||||
BOOST_CHECK(C.data() == A.data());
|
BOOST_TEST(C.data() == A.data());
|
||||||
|
|
||||||
double ptr[27];
|
double ptr[27];
|
||||||
boost::multi_array_ref<double, 3> D(ptr,sizes);
|
boost::multi_array_ref<double, 3> D(ptr,sizes);
|
||||||
D.assign(vals.begin(),vals.end());
|
D.assign(vals.begin(),vals.end());
|
||||||
boost::const_multi_array_ref<double, 3> E(D);
|
boost::const_multi_array_ref<double, 3> E(D);
|
||||||
check_shape(E, &sizes[0], strides, num_elements);
|
check_shape(E, &sizes[0], strides, num_elements);
|
||||||
BOOST_CHECK(E.data() == D.data());
|
BOOST_TEST(E.data() == D.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assignment Operator
|
// Assignment Operator
|
||||||
@@ -182,7 +182,7 @@ test_main(int, char*[])
|
|||||||
A.assign(vals.begin(),vals.end());
|
A.assign(vals.begin(),vals.end());
|
||||||
B = A;
|
B = A;
|
||||||
check_shape(B, &sizes[0], strides, num_elements);
|
check_shape(B, &sizes[0], strides, num_elements);
|
||||||
BOOST_CHECK(::equal(A, B));
|
BOOST_TEST(::equal(A, B));
|
||||||
|
|
||||||
double ptr1[27];
|
double ptr1[27];
|
||||||
double ptr2[27];
|
double ptr2[27];
|
||||||
@@ -190,7 +190,7 @@ test_main(int, char*[])
|
|||||||
C.assign(vals.begin(),vals.end());
|
C.assign(vals.begin(),vals.end());
|
||||||
D = C;
|
D = C;
|
||||||
check_shape(D, &sizes[0], strides, num_elements);
|
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];
|
subarray::value_type C = B[0];
|
||||||
|
|
||||||
// should comparisons between the types work?
|
// should comparisons between the types work?
|
||||||
BOOST_CHECK(::equal(A[1][0],C));
|
BOOST_TEST(::equal(A[1][0],C));
|
||||||
BOOST_CHECK(::equal(B[0],C));
|
BOOST_TEST(::equal(B[0],C));
|
||||||
}
|
}
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
//
|
//
|
||||||
// Trying to diagnose problems under visual
|
// Trying to diagnose problems under visual
|
||||||
|
|
||||||
#include "boost/config.hpp"
|
#include <boost/config.hpp>
|
||||||
#include "boost/array.hpp"
|
#include <boost/array.hpp>
|
||||||
#include "boost/limits.hpp"
|
#include <boost/limits.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// checking constness of const operator[].
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
@@ -36,5 +36,5 @@ test_main(int,char*[])
|
|||||||
// FAIL! cannot assign to csma.
|
// FAIL! cannot assign to csma.
|
||||||
csma[0][0][0] = 5;
|
csma[0][0][0] = 5;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing data() member function constness.
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
@@ -37,5 +37,5 @@ test_main(int,char*[])
|
|||||||
|
|
||||||
// FAIL! data() returns a const int*
|
// FAIL! data() returns a const int*
|
||||||
*csma.data() = 0;
|
*csma.data() = 0;
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
// const_iterator/iterator conversion test
|
// 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 boost::multi_array<int,3> array;
|
||||||
|
|
||||||
typedef array::iterator iterator1;
|
typedef array::iterator iterator1;
|
||||||
@@ -29,5 +29,5 @@ int test_main(int,char*[]) {
|
|||||||
// ILLEGAL conversion from const_iterator to iterator
|
// ILLEGAL conversion from const_iterator to iterator
|
||||||
iterator1 in = citerator1();
|
iterator1 in = citerator1();
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing const operator() constness.
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
@@ -40,5 +40,5 @@ test_main(int,char*[])
|
|||||||
// FAIL! Cannot assign to csma
|
// FAIL! Cannot assign to csma
|
||||||
csma(indices) = 5;
|
csma(indices) = 5;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
// const_reverse_iterator/reverse_iterator conversion test
|
// 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 boost::multi_array<int,3> array;
|
||||||
|
|
||||||
typedef array::reverse_iterator riterator1;
|
typedef array::reverse_iterator riterator1;
|
||||||
@@ -29,5 +29,5 @@ int test_main(int,char*[]) {
|
|||||||
// ILLEGAL conversion from const_reverse_iterator to reverse_iterator
|
// ILLEGAL conversion from const_reverse_iterator to reverse_iterator
|
||||||
riterator1 in = criterator1();
|
riterator1 in = criterator1();
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing subarray and const_subarray assignment
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
@@ -42,5 +42,5 @@ test_main(int,char*[])
|
|||||||
// FAIL! Preserve constness (no const_subarray -> subarray conversion).
|
// FAIL! Preserve constness (no const_subarray -> subarray conversion).
|
||||||
array::subarray<ndims-1>::type sba = csba;
|
array::subarray<ndims-1>::type sba = csba;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing constness of subarray operations.
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
@@ -41,5 +41,5 @@ test_main(int,char*[])
|
|||||||
// FAIL! preserve constness.
|
// FAIL! preserve constness.
|
||||||
array::subarray<ndims-1>::type sba = sma_const[0];
|
array::subarray<ndims-1>::type sba = sma_const[0];
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing constness of subarray operations.
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
@@ -45,5 +45,5 @@ test_main(int,char*[])
|
|||||||
// FAIL! sba cannot be assigned to.
|
// FAIL! sba cannot be assigned to.
|
||||||
sba[j][k] = num++;
|
sba[j][k] = num++;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,15 +15,15 @@
|
|||||||
// ensure const_array_view doesn't allow element assignment.
|
// 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/array.hpp>
|
||||||
#include "boost/type.hpp"
|
#include <boost/type.hpp>
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
@@ -54,7 +54,7 @@ test_main(int,char*[])
|
|||||||
// FAIL! const_array_view cannot be assigned to.
|
// FAIL! const_array_view cannot be assigned to.
|
||||||
csma2(elmt) = 5;
|
csma2(elmt) = 5;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,17 @@
|
|||||||
// ensure const_array_view cannot be converted to array_view
|
// ensure const_array_view cannot be converted to array_view
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "boost/multi_array.hpp"
|
#include <boost/multi_array.hpp>
|
||||||
|
|
||||||
#define BOOST_INCLUDE_MAIN
|
#define BOOST_INCLUDE_MAIN
|
||||||
#include "boost/test/test_tools.hpp"
|
#include <boost/test/test_tools.hpp>
|
||||||
|
|
||||||
#include "boost/array.hpp"
|
#include <boost/array.hpp>
|
||||||
#include "boost/type.hpp"
|
#include <boost/type.hpp>
|
||||||
#include "boost/cstdlib.hpp"
|
#include <boost/cstdlib.hpp>
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
@@ -52,7 +52,7 @@ test_main(int,char*[])
|
|||||||
array::array_view<ndims>::type csma2 =
|
array::array_view<ndims>::type csma2 =
|
||||||
csma[indices[range(0,2)][range(1,3)][range(0,4,2)]];
|
csma[indices[range(0,2)][range(1,3)][range(0,4,2)]];
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,15 @@
|
|||||||
// ensure const_array_ref doesn't allow assignment.
|
// 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/array.hpp>
|
||||||
#include "boost/type.hpp"
|
#include <boost/type.hpp>
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
typedef boost::multi_array<int,ndims> array;
|
||||||
@@ -55,7 +55,7 @@ test_main(int,char*[])
|
|||||||
// FAIL! csma2 cannot be assigned to.
|
// FAIL! csma2 cannot be assigned to.
|
||||||
csma2[i][j][k] = 0;
|
csma2[i][j][k] = 0;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// checking constness of const operator[].
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array_ref<int,ndims> array_ref;
|
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.
|
// FAIL! can't assign to const multi_array_ref.
|
||||||
csma[0][0][0] = 5;
|
csma[0][0][0] = 5;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing data() member function constness.
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array_ref<int,ndims> array_ref;
|
typedef boost::multi_array_ref<int,ndims> array_ref;
|
||||||
@@ -36,5 +36,5 @@ test_main(int,char*[])
|
|||||||
|
|
||||||
// FAIL! data() returns const int*.
|
// FAIL! data() returns const int*.
|
||||||
*csma.data() = 0;
|
*csma.data() = 0;
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
// const_iterator/iterator conversion test
|
// 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 boost::multi_array_ref<int,3> array_ref;
|
||||||
|
|
||||||
typedef array_ref::iterator iterator1;
|
typedef array_ref::iterator iterator1;
|
||||||
@@ -29,5 +29,5 @@ int test_main(int,char*[]) {
|
|||||||
// FAIL! ILLEGAL conversion from const_iterator to iterator
|
// FAIL! ILLEGAL conversion from const_iterator to iterator
|
||||||
iterator1 in = citerator1();
|
iterator1 in = citerator1();
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing const operator() constness.
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array_ref<int,ndims> array_ref;
|
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
|
// FAIL! cannot assign to a const multi_array_ref
|
||||||
csma(indices) = 5;
|
csma(indices) = 5;
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
// const_reverse_iterator/reverse_iterator conversion test
|
// 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 boost::multi_array_ref<int,3> array_ref;
|
||||||
|
|
||||||
typedef array_ref::reverse_iterator riterator1;
|
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
|
// Fail! ILLEGAL conversion from const_reverse_iterator to reverse_iterator
|
||||||
riterator1 in = criterator1();
|
riterator1 in = criterator1();
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing subarray and const_subarray assignment
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array_ref<int,ndims> array_ref;
|
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.
|
array_ref::subarray<ndims-1>::type sba = csba; // FAIL! preserve constness.
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing constness of subarray operations.
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array_ref<int,ndims> array_ref;
|
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!
|
array_ref::subarray<ndims-1>::type sba = sma_const[0]; // FAIL!
|
||||||
// preserve constness
|
// preserve constness
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
// Testing constness of subarray operations.
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array_ref<int,ndims> array_ref;
|
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)
|
for (array_ref::index k = 0; k != 4; ++k)
|
||||||
sba[j][k] = num++; // FAIL! can't assign to const_subarray.
|
sba[j][k] = num++; // FAIL! can't assign to const_subarray.
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,15 +15,15 @@
|
|||||||
// ensure const_array_view doesn't allow element assignment.
|
// 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/array.hpp>
|
||||||
#include "boost/type.hpp"
|
#include <boost/type.hpp>
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array_ref<int,ndims> array_ref;
|
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
|
csma2(elmt) = 5; // FAIL! csma is read only
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,15 @@
|
|||||||
// ensure const_array_view cannot be converted to array_view
|
// 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/array.hpp>
|
||||||
#include "boost/type.hpp"
|
#include <boost/type.hpp>
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array_ref<int,ndims> array_ref;
|
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)
|
for (array_ref::index k = 0; k != 2; ++k)
|
||||||
csma2[i][j][k] = 0; // FAIL! csma2 is read only
|
csma2[i][j][k] = 0; // FAIL! csma2 is read only
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,15 @@
|
|||||||
// ensure const_array_view doesn't allow assignment.
|
// 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/array.hpp>
|
||||||
#include "boost/type.hpp"
|
#include <boost/type.hpp>
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array_ref<int,ndims> array_ref;
|
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)
|
for (array_ref::index k = 0; k != 2; ++k)
|
||||||
csma2[i][j][k] = 0; // FAIL! csma2 is read only.
|
csma2[i][j][k] = 0; // FAIL! csma2 is read only.
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef GENERATIVE_TESTS_RG072001_HPP
|
#ifndef BOOST_MULTI_ARRAY_GENERATIVE_TESTS_HPP
|
||||||
#define GENERATIVE_TESTS_RG072001_HPP
|
#define BOOST_MULTI_ARRAY_GENERATIVE_TESTS_HPP
|
||||||
|
|
||||||
// Copyright 2002 The Trustees of Indiana University.
|
// Copyright 2002 The Trustees of Indiana University.
|
||||||
|
|
||||||
@@ -45,9 +45,9 @@
|
|||||||
//
|
//
|
||||||
// int test_main(int,char*[]) { return run_generative_tests(); }
|
// 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 <boost/config.hpp> /* BOOST_NO_SFINAE */
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -100,7 +100,7 @@ template <typename Array>
|
|||||||
void access(Array& A, const const_array_tag&);
|
void access(Array& A, const const_array_tag&);
|
||||||
|
|
||||||
template <typename StorageOrder3,typename StorageOrder4,typename Modifier>
|
template <typename StorageOrder3,typename StorageOrder4,typename Modifier>
|
||||||
int run_configuration(const StorageOrder3& so3,
|
void run_configuration(const StorageOrder3& so3,
|
||||||
const StorageOrder4& so4,
|
const StorageOrder4& so4,
|
||||||
const Modifier& modifier) {
|
const Modifier& modifier) {
|
||||||
// multi_array
|
// multi_array
|
||||||
@@ -213,11 +213,10 @@ int run_configuration(const StorageOrder3& so3,
|
|||||||
access(C,const_array_tag());
|
access(C,const_array_tag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return boost::exit_success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ArrayModifier>
|
template <typename ArrayModifier>
|
||||||
int run_storage_tests(const ArrayModifier& modifier) {
|
void run_storage_tests(const ArrayModifier& modifier) {
|
||||||
run_configuration(boost::c_storage_order(),
|
run_configuration(boost::c_storage_order(),
|
||||||
boost::c_storage_order(),modifier);
|
boost::c_storage_order(),modifier);
|
||||||
run_configuration(boost::fortran_storage_order(),
|
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),
|
run_configuration(boost::general_storage_order<3>(ordering,ascending),
|
||||||
boost::general_storage_order<4>(ordering,ascending),
|
boost::general_storage_order<4>(ordering,ascending),
|
||||||
modifier);
|
modifier);
|
||||||
|
|
||||||
return boost::exit_success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct null_modifier {
|
struct null_modifier {
|
||||||
@@ -279,7 +276,7 @@ int run_generative_tests() {
|
|||||||
run_storage_tests(reindex_modifier());
|
run_storage_tests(reindex_modifier());
|
||||||
run_storage_tests(reshape_modifier());
|
run_storage_tests(reshape_modifier());
|
||||||
std::cout << "Total Tests Run: " << tests_run << '\n';
|
std::cout << "Total Tests Run: " << tests_run << '\n';
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GENERATIVE_TESTS_RG072001_HPP
|
#endif
|
||||||
|
|||||||
@@ -14,12 +14,12 @@
|
|||||||
// idxset1.cpp - testing the code for index_gen
|
// idxset1.cpp - testing the code for index_gen
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "boost/multi_array/index_gen.hpp"
|
#include <boost/multi_array/index_gen.hpp>
|
||||||
#include "boost/multi_array/index_range.hpp"
|
#include <boost/multi_array/index_range.hpp>
|
||||||
#include "boost/multi_array/types.hpp"
|
#include <boost/multi_array/types.hpp>
|
||||||
#include "boost/test/minimal.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::index index_type;
|
||||||
typedef boost::detail::multi_array::size_type size_type;
|
typedef boost::detail::multi_array::size_type size_type;
|
||||||
@@ -37,7 +37,7 @@ bool operator==(const range& lhs,const range& rhs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
|
|
||||||
boost::detail::multi_array::index_gen<0,0> indices;
|
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 =
|
boost::detail::multi_array::index_gen<3,3> is1 =
|
||||||
indices[range(0,1,2)][range(1,2,3)][range(2,3,4)];
|
indices[range(0,1,2)][range(1,2,3)][range(2,3,4)];
|
||||||
BOOST_CHECK(is1.ranges_[0] == range(0,1,2));
|
BOOST_TEST(is1.ranges_[0] == range(0,1,2));
|
||||||
BOOST_CHECK(is1.ranges_[1] == range(1,2,3));
|
BOOST_TEST(is1.ranges_[1] == range(1,2,3));
|
||||||
BOOST_CHECK(is1.ranges_[2] == range(2,3,4));
|
BOOST_TEST(is1.ranges_[2] == range(2,3,4));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::detail::multi_array::index_gen<3,2> is2 =
|
boost::detail::multi_array::index_gen<3,2> is2 =
|
||||||
indices[range(0,1,2)][2][range(2,3,4)];
|
indices[range(0,1,2)][2][range(2,3,4)];
|
||||||
BOOST_CHECK(is2.ranges_[0] == range(0,1,2));
|
BOOST_TEST(is2.ranges_[0] == range(0,1,2));
|
||||||
BOOST_CHECK(is2.ranges_[1] == range(2));
|
BOOST_TEST(is2.ranges_[1] == range(2));
|
||||||
BOOST_CHECK(is2.ranges_[1].is_degenerate());
|
BOOST_TEST(is2.ranges_[1].is_degenerate());
|
||||||
BOOST_CHECK(is2.ranges_[2] == range(2,3,4));
|
BOOST_TEST(is2.ranges_[2] == range(2,3,4));
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,15 +14,15 @@
|
|||||||
// index_bases - test of the index_base modifying facilities.
|
// 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 <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
typedef boost::multi_array<double, 3> array;
|
typedef boost::multi_array<double, 3> array;
|
||||||
typedef boost::multi_array_ref<double, 3> array_ref;
|
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 a = 0; a < A.shape()[0]; ++a)
|
||||||
for (size_type b = 0; b < A.shape()[1]; ++b)
|
for (size_type b = 0; b < A.shape()[1]; ++b)
|
||||||
for (size_type c = 0; c < A.shape()[2]; ++c) {
|
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_TEST(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_TEST(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(D[a+bases[0]][b+bases[1]][c+bases[2]] == B[a][b][c]);
|
||||||
// Test that E does not inherit A's index_base
|
// 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 a = 0; a < A.shape()[0]; ++a)
|
||||||
for (size_type b = 0; b < A.shape()[1]; ++b)
|
for (size_type b = 0; b < A.shape()[1]; ++b)
|
||||||
for (size_type c = 0; c < A.shape()[2]; ++c) {
|
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_TEST(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_TEST(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(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(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 a = 0; a < A.shape()[0]; ++a)
|
||||||
for (size_type b = 0; b < A.shape()[1]; ++b)
|
for (size_type b = 0; b < A.shape()[1]; ++b)
|
||||||
for (size_type c = 0; c < A.shape()[2]; ++c) {
|
for (size_type c = 0; c < A.shape()[2]; ++c) {
|
||||||
BOOST_CHECK(A[a+1][b+1][c+1] == B[a][b][c]);
|
BOOST_TEST(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_TEST(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_TEST(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(E[a+1][b+1][c+1] == B[a][b][c]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
#define MULTIARRAY_TEST_ASSIGN
|
#define MULTIARRAY_TEST_ASSIGN
|
||||||
#include "generative_tests.hpp"
|
#include "generative_tests.hpp"
|
||||||
#include "boost/concept_check.hpp" // for ignore_unused_variable_warning
|
#include <boost/concept_check.hpp> // for ignore_unused_variable_warning
|
||||||
#include "boost/mpl/if.hpp"
|
#include <boost/mpl/if.hpp>
|
||||||
#include "boost/type_traits/is_same.hpp"
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
|
||||||
// iterator-test-specific code
|
// iterator-test-specific code
|
||||||
|
|
||||||
@@ -107,8 +107,8 @@ void test_iterators(Array& A, const IterTraits&) {
|
|||||||
typedef typename IterTraits::iterator3 iterator;
|
typedef typename IterTraits::iterator3 iterator;
|
||||||
iterator i1 = A.begin();
|
iterator i1 = A.begin();
|
||||||
iterator i2 = A.end();
|
iterator i2 = A.end();
|
||||||
BOOST_CHECK(i1 < i2);
|
BOOST_TEST(i1 < i2);
|
||||||
BOOST_CHECK((i2 - i1) == typename iterator::difference_type(2));
|
BOOST_TEST((i2 - i1) == typename iterator::difference_type(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Standard Array Iteration
|
// Standard Array Iteration
|
||||||
@@ -121,7 +121,7 @@ void test_iterators(Array& A, const IterTraits&) {
|
|||||||
for (iterator3 i = A.begin(); i != A.end(); ++i)
|
for (iterator3 i = A.begin(); i != A.end(); ++i)
|
||||||
for(iterator2 ii = (*i).begin(); ii != (*i).end(); ++ii)
|
for(iterator2 ii = (*i).begin(); ii != (*i).end(); ++ii)
|
||||||
for(iterator1 iii = (*ii).begin(); iii != (*ii).end(); ++iii)
|
for(iterator1 iii = (*ii).begin(); iii != (*ii).end(); ++iii)
|
||||||
BOOST_CHECK(*iii == vals++);
|
BOOST_TEST(*iii == vals++);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using operator->() on iterators
|
// 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 (iterator3 i = A.begin(); i != A.end(); ++i)
|
||||||
for(iterator2 ii = i->begin(); ii != i->end(); ++ii)
|
for(iterator2 ii = i->begin(); ii != i->end(); ++ii)
|
||||||
for(iterator1 iii = ii->begin(); iii != ii->end(); ++iii)
|
for(iterator1 iii = ii->begin(); iii != ii->end(); ++iii)
|
||||||
BOOST_CHECK(*iii == vals++);
|
BOOST_TEST(*iii == vals++);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reverse Iterator Hierarchy Test
|
// 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(riterator2 ii = (*i).rbegin(); ii != (riterator2)(*i).rend(); ++ii)
|
||||||
for(riterator1 iii = (*ii).rbegin(); iii != (riterator1)(*ii).rend();
|
for(riterator1 iii = (*ii).rbegin(); iii != (riterator1)(*ii).rend();
|
||||||
++iii)
|
++iii)
|
||||||
BOOST_CHECK(*iii == check_iter_val--);
|
BOOST_TEST(*iii == check_iter_val--);
|
||||||
}
|
}
|
||||||
++tests_run;
|
++tests_run;
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ void access(Array& A, const const_array_tag&) {
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int, char*[])
|
main()
|
||||||
{
|
{
|
||||||
return run_generative_tests();
|
return run_generative_tests();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
#include <cstddef>
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
typedef boost::detail::multi_array::index_range<int,std::size_t> range;
|
typedef boost::detail::multi_array::index_range<int,std::size_t> range;
|
||||||
|
|
||||||
{
|
{
|
||||||
// typical range creation and extraction
|
// typical range creation and extraction
|
||||||
range r1(-3,5);
|
range r1(-3,5);
|
||||||
BOOST_CHECK(r1.start() == -3);
|
BOOST_TEST(r1.start() == -3);
|
||||||
BOOST_CHECK(r1.finish() == 5);
|
BOOST_TEST(r1.finish() == 5);
|
||||||
BOOST_CHECK(r1.stride() == 1);
|
BOOST_TEST(r1.stride() == 1);
|
||||||
BOOST_CHECK(!r1.is_degenerate());
|
BOOST_TEST(r1.size(0) == 8);
|
||||||
BOOST_CHECK(r1.get_start(0) == -3);
|
BOOST_TEST(!r1.is_degenerate());
|
||||||
BOOST_CHECK(r1.get_finish(100) == 5);
|
BOOST_TEST(r1.get_start(0) == -3);
|
||||||
|
BOOST_TEST(r1.get_finish(100) == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
range r2(-3,5,2);
|
range r2(-3,5,2);
|
||||||
BOOST_CHECK(r2.start() == -3);
|
BOOST_TEST(r2.start() == -3);
|
||||||
BOOST_CHECK(r2.finish() == 5);
|
BOOST_TEST(r2.finish() == 5);
|
||||||
BOOST_CHECK(r2.stride() == 2);
|
BOOST_TEST(r2.stride() == 2);
|
||||||
BOOST_CHECK(!r2.is_degenerate());
|
BOOST_TEST(r2.size(0) == 4);
|
||||||
|
BOOST_TEST(!r2.is_degenerate());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// degenerate creation
|
// degenerate creation
|
||||||
range r3(5);
|
range r3(5);
|
||||||
BOOST_CHECK(r3.start() == 5);
|
BOOST_TEST(r3.start() == 5);
|
||||||
BOOST_CHECK(r3.finish() == 6);
|
BOOST_TEST(r3.finish() == 6);
|
||||||
BOOST_CHECK(r3.stride() == 1);
|
BOOST_TEST(r3.stride() == 1);
|
||||||
BOOST_CHECK(r3.is_degenerate());
|
BOOST_TEST(r3.size(0) == 1);
|
||||||
|
BOOST_TEST(r3.is_degenerate());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// default range creation
|
// default range creation
|
||||||
range r4;
|
range r4;
|
||||||
BOOST_CHECK(r4.get_start(0) == 0);
|
BOOST_TEST(r4.get_start(0) == 0);
|
||||||
BOOST_CHECK(r4.get_finish(100) == 100);
|
BOOST_TEST(r4.get_finish(100) == 100);
|
||||||
BOOST_CHECK(r4.stride() == 1);
|
BOOST_TEST(r4.stride() == 1);
|
||||||
|
BOOST_TEST(r4.size(0) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// create a range using the setter methods
|
// create a range using the setter methods
|
||||||
range r5 = range().stride(2).start(-3).finish(7);
|
range r5 = range().stride(2).start(-3).finish(7);
|
||||||
BOOST_CHECK(r5.start() == -3);
|
BOOST_TEST(r5.start() == -3);
|
||||||
BOOST_CHECK(r5.stride() == 2);
|
BOOST_TEST(r5.stride() == 2);
|
||||||
BOOST_CHECK(r5.finish() == 7);
|
BOOST_TEST(r5.finish() == 7);
|
||||||
|
BOOST_TEST(r5.size(0) == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// try out all the comparison operators
|
// try out all the comparison operators
|
||||||
{
|
{
|
||||||
range r6 = -3 <= range().stride(2) < 7;
|
range r6 = -3 <= range().stride(2) < 7;
|
||||||
BOOST_CHECK(r6.start() == -3);
|
BOOST_TEST(r6.start() == -3);
|
||||||
BOOST_CHECK(r6.stride() == 2);
|
BOOST_TEST(r6.stride() == 2);
|
||||||
BOOST_CHECK(r6.finish() == 7);
|
BOOST_TEST(r6.finish() == 7);
|
||||||
|
BOOST_TEST(r6.size(0) == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
range r7 = -3 < range() <= 7;
|
range r7 = -3 < range() <= 7;
|
||||||
BOOST_CHECK(r7.start() == -2);
|
BOOST_TEST(r7.start() == -2);
|
||||||
BOOST_CHECK(r7.stride() == 1);
|
BOOST_TEST(r7.stride() == 1);
|
||||||
BOOST_CHECK(r7.finish() == 8);
|
BOOST_TEST(r7.finish() == 8);
|
||||||
|
BOOST_TEST(r7.size(0) == 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// arithmetic operators
|
// arithmetic operators
|
||||||
{
|
{
|
||||||
range r8 = range(0,5) + 2;
|
range r8 = range(0,5) + 2;
|
||||||
BOOST_CHECK(r8.start() == 2);
|
BOOST_TEST(r8.start() == 2);
|
||||||
BOOST_CHECK(r8.stride() == 1);
|
BOOST_TEST(r8.stride() == 1);
|
||||||
BOOST_CHECK(r8.finish() == 7);
|
BOOST_TEST(r8.finish() == 7);
|
||||||
|
BOOST_TEST(r8.size(0) == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
range r9 = range(0,5) - 2;
|
range r9 = range(0,5) - 2;
|
||||||
BOOST_CHECK(r9.start() == -2);
|
BOOST_TEST(r9.start() == -2);
|
||||||
BOOST_CHECK(r9.stride() == 1);
|
BOOST_TEST(r9.stride() == 1);
|
||||||
BOOST_CHECK(r9.finish() == 3);
|
BOOST_TEST(r9.finish() == 3);
|
||||||
|
BOOST_TEST(r9.size(0) == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,15 +14,15 @@
|
|||||||
// reshape.cpp - testing reshaping functionality
|
// 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/array.hpp>
|
||||||
#include "boost/type.hpp"
|
#include <boost/type.hpp>
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
typedef boost::multi_array<int,ndims> array;
|
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 i = 0; i != 4; ++i)
|
||||||
for (array::index j = 0; j != 3; ++j)
|
for (array::index j = 0; j != 3; ++j)
|
||||||
for (array::index k = 0; k != 2; ++k) {
|
for (array::index k = 0; k != 2; ++k) {
|
||||||
BOOST_CHECK(A[i][j][k] == *ptr);
|
BOOST_TEST(A[i][j][k] == *ptr);
|
||||||
BOOST_CHECK(B[i][j][k] == *ptr);
|
BOOST_TEST(B[i][j][k] == *ptr);
|
||||||
BOOST_CHECK(C[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 i = 0; i != 4; ++i)
|
||||||
for (array::index j = 1; j != 4; ++j)
|
for (array::index j = 1; j != 4; ++j)
|
||||||
for (array::index k = -1; k != 1; ++k) {
|
for (array::index k = -1; k != 1; ++k) {
|
||||||
BOOST_CHECK(A[i][j][k] == *ptr);
|
BOOST_TEST(A[i][j][k] == *ptr);
|
||||||
BOOST_CHECK(B[i][j][k] == *ptr);
|
BOOST_TEST(B[i][j][k] == *ptr);
|
||||||
BOOST_CHECK(C[i][j][k] == *ptr++);
|
BOOST_TEST(C[i][j][k] == *ptr++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,13 @@
|
|||||||
// resize.cpp - Test of resizing multi_arrays
|
// resize.cpp - Test of resizing multi_arrays
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "boost/test/minimal.hpp"
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include "boost/multi_array.hpp"
|
#include <boost/multi_array.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
int test_main(int,char*[]) {
|
int main() {
|
||||||
|
|
||||||
typedef boost::multi_array<int,3> marray;
|
typedef boost::multi_array<int,3> marray;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ int test_main(int,char*[]) {
|
|||||||
marray A(boost::extents[2][3][4]);
|
marray A(boost::extents[2][3][4]);
|
||||||
A.assign(A_data,A_data+(2*3*4));
|
A.assign(A_data,A_data+(2*3*4));
|
||||||
A.resize(boost::extents[4][3][2]);
|
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
|
// resize through the Collection
|
||||||
@@ -67,14 +67,14 @@ int test_main(int,char*[]) {
|
|||||||
A.assign(A_data,A_data+(2*3*4));
|
A.assign(A_data,A_data+(2*3*4));
|
||||||
boost::array<int,3> new_extents = {{4,3,2}};
|
boost::array<int,3> new_extents = {{4,3,2}};
|
||||||
A.resize(new_extents);
|
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)
|
// default construct all the new elements (in this case, all elements)
|
||||||
{
|
{
|
||||||
marray defaultA;
|
marray defaultA;
|
||||||
defaultA.resize(boost::extents[2][3][4]);
|
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);
|
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 x = 0; x < 3; x++) {
|
||||||
for (int y = 0; y < 4; y++) {
|
for (int y = 0; y < 4; y++) {
|
||||||
for (int z = 0; z < 2; z++) {
|
for (int z = 0; z < 2; z++) {
|
||||||
BOOST_CHECK(*(A.data() + check) == check);
|
BOOST_TEST(*(A.data() + check) == check);
|
||||||
++check;
|
++check;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,5 +123,5 @@ int test_main(int,char*[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,12 @@
|
|||||||
// reverse_view.cpp - a small test of creating a view with negative strides
|
// reverse_view.cpp - a small test of creating a view with negative strides
|
||||||
//
|
//
|
||||||
|
|
||||||
#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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@ test_main(int,char*[])
|
|||||||
array::array_view<1>::type B = A[indices[range(3, -1, -1)]];
|
array::array_view<1>::type B = A[indices[range(3, -1, -1)]];
|
||||||
|
|
||||||
for(multi_array_types::size_type i = 0; i != B.size(); ++i) {
|
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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "generative_tests.hpp"
|
#include "generative_tests.hpp"
|
||||||
#include "boost/array.hpp"
|
#include <boost/array.hpp>
|
||||||
#include "boost/mpl/if.hpp"
|
#include <boost/mpl/if.hpp>
|
||||||
#include "boost/type_traits/is_same.hpp"
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
|
||||||
template <typename Array>
|
template <typename Array>
|
||||||
struct view_traits_mutable {
|
struct view_traits_mutable {
|
||||||
@@ -71,10 +71,10 @@ void test_views(Array& A, const ViewTraits&) {
|
|||||||
for (index i = 0; i != 2; ++i)
|
for (index i = 0; i != 2; ++i)
|
||||||
for (index j = 0; j != 2; ++j)
|
for (index j = 0; j != 2; ++j)
|
||||||
for (index k = 0; k != 2; ++k) {
|
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;
|
boost::array<index,3> elmts;
|
||||||
elmts[0]=i; elmts[1]=j; elmts[2]=k;
|
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
|
// Degenerate dimensions
|
||||||
@@ -84,10 +84,10 @@ void test_views(Array& A, const ViewTraits&) {
|
|||||||
|
|
||||||
for (index i = 0; i != 2; ++i)
|
for (index i = 0; i != 2; ++i)
|
||||||
for (index j = 0; j != 2; ++j) {
|
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;
|
boost::array<index,2> elmts;
|
||||||
elmts[0]=i; elmts[1]=j;
|
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 i = 0; i != 2; ++i)
|
||||||
for (index j = 0; j != 2; ++j)
|
for (index j = 0; j != 2; ++j)
|
||||||
for (index k = 0; k != 2; ++k) {
|
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;
|
boost::array<index,3> elmts;
|
||||||
elmts[0]=i; elmts[1]=j; elmts[2]=k;
|
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();
|
return run_generative_tests();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,14 +14,14 @@
|
|||||||
// stl_interaction.cpp - Make sure multi_arrays work with STL containers.
|
// 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 <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
int
|
int
|
||||||
test_main(int, char*[])
|
main()
|
||||||
{
|
{
|
||||||
using boost::extents;
|
using boost::extents;
|
||||||
using boost::indices;
|
using boost::indices;
|
||||||
@@ -51,7 +51,7 @@ test_main(int, char*[])
|
|||||||
myarray.assign(data,data+data_size);
|
myarray.assign(data,data+data_size);
|
||||||
|
|
||||||
array3vec myvec(5,myarray);
|
array3vec myvec(5,myarray);
|
||||||
BOOST_CHECK(myarray == myvec[1]);
|
BOOST_TEST(myarray == myvec[1]);
|
||||||
|
|
||||||
array3::array_view<2>::type myview =
|
array3::array_view<2>::type myview =
|
||||||
myarray[indices[1][range(0,2)][range(1,3)]];
|
myarray[indices[1][range(0,2)][range(1,3)]];
|
||||||
@@ -65,8 +65,8 @@ test_main(int, char*[])
|
|||||||
|
|
||||||
myvec.push_back(myarray);
|
myvec.push_back(myarray);
|
||||||
|
|
||||||
BOOST_CHECK(myarray != myvec[1]);
|
BOOST_TEST(myarray != myvec[1]);
|
||||||
BOOST_CHECK(myarray == myvec[5]);
|
BOOST_TEST(myarray == myvec[5]);
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,14 +14,14 @@
|
|||||||
// storage_order.cpp - testing storage_order-isms.
|
// 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
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
const int ndims=3;
|
const int ndims=3;
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ test_main(int,char*[])
|
|||||||
for (array::index i = 0; i != 2; ++i)
|
for (array::index i = 0; i != 2; ++i)
|
||||||
for (array::index j = 0; j != 3; ++j)
|
for (array::index j = 0; j != 3; ++j)
|
||||||
for (array::index k = 0; k != 4; ++k)
|
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
|
// Mimic fortran_storage_order using
|
||||||
@@ -88,7 +88,7 @@ test_main(int,char*[])
|
|||||||
for (array::index i = 0; i != 2; ++i)
|
for (array::index i = 0; i != 2; ++i)
|
||||||
for (array::index j = 0; j != 3; ++j)
|
for (array::index j = 0; j != 3; ++j)
|
||||||
for (array::index k = 0; k != 4; ++k)
|
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
|
// 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 i = 0; i != 2; ++i)
|
||||||
for (array::index j = 0; j != 3; ++j)
|
for (array::index j = 0; j != 3; ++j)
|
||||||
for (array::index k = 0; k != 4; ++k)
|
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 i = 0; i != 2; ++i)
|
||||||
for (array::index j = 0; j != 3; ++j)
|
for (array::index j = 0; j != 3; ++j)
|
||||||
for (array::index k = 0; k != 4; ++k)
|
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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,12 @@
|
|||||||
// test out my new storage_order stuff
|
// 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
|
int
|
||||||
test_main(int,char*[]) {
|
main() {
|
||||||
|
|
||||||
using namespace boost;
|
using namespace boost;
|
||||||
|
|
||||||
@@ -31,9 +31,9 @@ test_main(int,char*[]) {
|
|||||||
general_storage_order<5> fortran_storage(fortran_ordering.begin(),
|
general_storage_order<5> fortran_storage(fortran_ordering.begin(),
|
||||||
ascending.begin());
|
ascending.begin());
|
||||||
|
|
||||||
BOOST_CHECK(c_storage == (general_storage_order<5>) c_storage_order());
|
BOOST_TEST(c_storage == (general_storage_order<5>) c_storage_order());
|
||||||
BOOST_CHECK(fortran_storage ==
|
BOOST_TEST(fortran_storage ==
|
||||||
(general_storage_order<5>) fortran_storage_order());
|
(general_storage_order<5>) fortran_storage_order());
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,15 +14,15 @@
|
|||||||
// index_bases - test of the index_base modifying facilities.
|
// 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 <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
int
|
int
|
||||||
test_main(int,char*[])
|
main()
|
||||||
{
|
{
|
||||||
typedef boost::multi_array<double, 3> array;
|
typedef boost::multi_array<double, 3> array;
|
||||||
typedef array::array_view<3>::type array_view;
|
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)]];
|
array_view E = A[indices[irange(1,2)][irange(1,2)][irange(1,2)]];
|
||||||
|
|
||||||
}
|
}
|
||||||
return boost::exit_success;
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user