Compare commits

...

78 Commits

Author SHA1 Message Date
ecc47cb42c Merge branch 'feature/use_invoke_swap' of https://github.com/Lastique/array into feature/pr-20 2023-09-08 09:57:29 +03:00
d9ccba0907 Update ci.yml 2023-09-08 09:49:45 +03:00
bdc9ff1e24 Add CMake tests 2023-09-08 09:47:09 +03:00
8ad6749d4a Update test/Jamfile 2023-09-08 09:38:28 +03:00
ec72fd87a1 Regenerate CMakeLists.txt 2023-09-08 09:36:13 +03:00
3dfc2a089c Update ci.yml 2023-09-08 09:35:15 +03:00
b19ce675ad Trim trailing spaces. 2023-09-03 00:06:37 +03:00
c774c93b3b Switch to boost::core::invoke_swap.
boost::swap is deprecated and will be removed. Use boost::core::invoke_swap
as a replacement.
2023-09-03 00:05:33 +03:00
868af27d82 Merge pull request #19 from fanquake/use_core_swap
refactor: use core/swap.hpp over boost/swap.hpp
2022-08-23 09:23:28 -07:00
4647fc7095 refactor: use core/swap.hpp over boost/swap.hpp
The later is deprecated:
```cpp
ifndef BOOST_SWAP_HPP
define BOOST_SWAP_HPP

// The header file at this path is deprecated;
// use boost/core/swap.hpp instead.

include <boost/core/swap.hpp>

endif

```
2022-08-23 15:55:19 +01:00
9cc63ae0dd Merge pull request #18 from renbaoshuo/patch-1
chore: bump macos runner version
2022-07-26 09:51:51 -07:00
a3f15458b8 chore: bump macos runner version
GitHub Action is sunsetting the macOS 10.15 Actions runner. It will stop working intermittently until being completely removed by 2022-8-30: https://github.blog/changelog/2022-07-20-github-actions-the-macos-10-15-actions-runner-image-is-being-deprecated-and-will-be-removed-by-8-30-22
2022-07-25 18:03:08 +08:00
a9a3dbbc41 Merge pull request #16 from sdarwin/feature/gha_fix_1
Update GitHub Actions CI file
2021-08-04 07:08:17 -07:00
e384e3780b Update GitHub Actions CI file 2021-07-30 16:10:15 +00:00
63f83dc350 Merge branch 'master' into develop 2021-06-10 01:29:29 +03:00
37c18b3094 Update CMakeLists.txt 2021-06-10 01:22:46 +03:00
42d974e5df Merge pull request #15 from sdarwin/githubactions
GitHub Actions config
2021-03-03 18:17:33 -08:00
1572eac629 Add GitHub Actions config [ci skip] 2021-03-01 15:31:58 +00:00
0db8c56d3f Merge pull request #14 from eldiener/develop
[skip ci] Add "cxxstd" json field
2021-01-18 18:26:54 -08:00
674234d401 [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. 2021-01-18 20:49:35 -05:00
427c8fad2f Merge pull request #13 from sdarwin/drone
Drone config; I have no idea if this is right or not; Let's give it a try.
2021-01-07 20:47:11 -08:00
f0e79b8ebc add drone config [ci skip] 2021-01-07 18:08:52 +00:00
d026fbcee3 Merge changes from develop for the 1.74.0 release 2020-06-26 10:22:51 -07:00
92f66a9f14 Merge pull request #11 from Lastique/patch-1
Avoid using deprecated header iterator.hpp
2020-05-10 12:40:34 -07:00
e329330031 Avoid using deprecated header iterator.hpp
<boost/detail/iterator.hpp> is marked deprecated and is going to be removed in a future release. Replace it with <iterator> to avoid deprecation warnings.
2020-05-10 19:39:21 +03:00
32b074c9ae Array: Merge bug fixes to master for 1.72.0 beta 2019-12-03 07:47:51 -08:00
453cf59eb9 Replace Boost.Test with lightweight_test from Boost.Core. Modified version of https://github.com/boostorg/array/pull/6. Thanks to mloskot for the patch. 2019-07-10 15:25:46 -07:00
520d8987f7 Merge bug fixes to master for 1.70 2019-03-07 06:33:59 -08:00
b279a9005b Fix off-by-one error in range-checking for 'at()'. thanks to DHilbrich for the bug report. 2019-02-07 07:52:11 -08:00
854215e54c Merge pull request #7 from Mike-Devel/feature/min_cmake
Add minimal make file; Sorry for the long delay.
2019-01-14 09:52:33 -08:00
ee03e0bae8 [CI] Add travis file 2018-12-07 11:34:20 +01:00
e5f4af3dd2 [CMake] Add self-test for cmake 2018-12-07 11:34:20 +01:00
85e33cd138 [CMake] Generate cmake target that other libraries can use
... to express their dependency on this library and retrieve any
configuration information such as the include directory, binary
to link to (if any), transitive dependencies, necessary compiler
options or the required c++ standards level.
2018-12-07 11:31:02 +01:00
8f3aea2200 Merge array bug fixes to master 2017-01-31 08:00:48 -08:00
cef221d8b4 Merge pull request #5 from Lastique/patch-1
Fix compilation for Oracle Studio 12.5
2017-01-23 20:00:25 -08:00
5d06f1074a Fix compilation for Oracle Studio 12.5
The compiler expects a qualified dependent name after `typename`, so move `const` after the name.
2017-01-24 02:31:27 +04:00
4c27456a43 Copy doc jamfile from develop
It's need to build the documentation now.
2016-10-27 20:12:38 +01:00
16824fe0f1 Add, and update, documentation build targets. 2016-10-07 23:03:40 -05:00
0d4fa276f4 Merge pull request #3 from boostorg/pull_request/remove_hash_fwd
Replace inclusion of hash_fwd.hpp with a declaration of hash_range. Patch from Peter Dimov.
2015-01-08 14:10:08 -08:00
cb4df41bd6 Replace inclusion of hash_fwd.hpp with a declaration of hash_range 2015-01-09 00:01:41 +02:00
cd9888316a Merge pull request #2 from danieljames/metadata
Create metadata file.
2014-08-18 09:16:48 -07:00
ce71078681 Add metadata file. 2014-08-18 14:57:18 +01:00
9678f6aa3b Create merge base for git. 2014-04-06 13:53:46 +01:00
c0b1609ddb Merge r86524 (Correct broken links to C++ standard papers); fixes #9212
[SVN r86673]
2013-11-13 03:22:55 +00:00
dfeb6bd0a5 Correct broken links to C++ standard papers. Refs #9212.
[SVN r86524]
2013-10-30 12:51:24 +00:00
1966dd034b Updated license and copyright
[SVN r86311]
2013-10-14 21:35:20 +00:00
40c5dae84c Remove tabs
[SVN r86310]
2013-10-14 21:31:19 +00:00
4584f63f01 Simplify multi-component ifdefs containing BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
[SVN r86248]
2013-10-11 23:20:59 +00:00
2e0052d49f Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Process #ifndef...#endif conditions.

[SVN r86244]
2013-10-11 23:15:00 +00:00
6ad6249e1c Array: Remove obsolete MSVC version check.
[SVN r85903]
2013-09-25 13:51:37 +00:00
a73b6fb582 Merged boost::algorithm::gather and updated tests for Utility, Algorithm and Utility libraries
[SVN r83154]
2013-02-25 18:43:26 +00:00
ba1a2437cf Merge doc changes to release; fixes #6988
[SVN r78948]
2012-06-14 16:01:03 +00:00
3db6930a22 Added support Boost.Hash; checked in a test yesterday, but forgot to merge the actual code
[SVN r78581]
2012-05-24 13:04:02 +00:00
859fb5aa97 Merged changes for Boost.Array to release; adds support for Boost.Hash
[SVN r78558]
2012-05-23 16:35:13 +00:00
5a97de6f2e Merge changes in Boost.Array to release
[SVN r70698]
2011-03-29 14:49:32 +00:00
eea368fadf Merge changes in Boost.Array to release
[SVN r70697]
2011-03-29 14:47:50 +00:00
26edbea113 Merging changes to release; fixes #4761
[SVN r68100]
2011-01-13 15:49:03 +00:00
9644ee6662 Merged array changes to release; fixes #4757
[SVN r67477]
2010-12-28 18:28:22 +00:00
a603bffc48 Merged Array changes to release
[SVN r63410]
2010-06-28 17:59:21 +00:00
0c8902e8c2 Merged array changes from trunk to release; Fixes #3893 and #3168
[SVN r60824]
2010-03-25 15:32:12 +00:00
88868ba0df Merged array changes from trunk to release
[SVN r58921]
2010-01-12 05:55:52 +00:00
99631823f6 rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release.
[SVN r56941]
2009-10-17 01:10:45 +00:00
5661b8cd63 Add basic copyright/license to keep cmake out of the inspection report
[SVN r55095]
2009-07-22 21:51:01 +00:00
86b069ad0e Merge [53104] and [53105] from the trunk
[SVN r53198]
2009-05-23 06:00:42 +00:00
3d20bb1310 merge of cmake build files from trunk per beman
[SVN r50756]
2009-01-24 18:57:20 +00:00
e7122b3f20 merge tests and Jamfiles for 7 libraries
[SVN r50456]
2009-01-04 05:17:02 +00:00
4dd2cf1b64 Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41370]
2007-11-25 18:38:02 +00:00
2e88dc228d Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41369]
2007-11-25 18:07:19 +00:00
0a4d7e81ef Starting point for releases
[SVN r39706]
2007-10-05 14:25:06 +00:00
96d4c5f737 This commit was manufactured by cvs2svn to create tag
'Version_1_34_1'.

[SVN r38286]
2007-07-24 19:28:14 +00:00
5a23b06a83 Merged L & C issue fixes from trunk to branch.
[SVN r36225]
2006-12-01 11:34:43 +00:00
e85feee293 Merged copyright and license addition
[SVN r35907]
2006-11-07 19:27:00 +00:00
b6522b3f60 (merge from head)
http://www.josuttis.com/ hasn't the latest version any more


[SVN r34856]
2006-08-08 18:53:30 +00:00
3044ab376c Simplified code.
[SVN r34384]
2006-06-24 11:31:19 +00:00
69188c998f Fix compiler errors resulting from missing return values.
[SVN r34259]
2006-06-09 11:40:07 +00:00
4c5212f5e4 Remove size zero support for old compilers that do not support partial template specialization
[SVN r34162]
2006-06-04 12:10:17 +00:00
276cd991f3 Support for zero length arrays
[SVN r34156]
2006-06-03 13:04:27 +00:00
1f8298fb08 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r33417]
2006-03-21 02:26:31 +00:00
25 changed files with 1211 additions and 141 deletions

37
.drone.star Normal file
View File

@ -0,0 +1,37 @@
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt)
#
# Copyright Rene Rivera 2020.
# For Drone CI we use the Starlark scripting language to reduce duplication.
# As the yaml syntax for Drone CI is rather limited.
#
#
globalenv={}
linuxglobalimage="cppalliance/droneubuntu1604:1"
windowsglobalimage="cppalliance/dronevs2019"
def main(ctx):
return [
linux_cxx("TEST_CMAKE=TRUE Job 0", "g++", packages="", buildtype="96ad197d74-2319b6d45f", image=linuxglobalimage, environment={'TEST_CMAKE': 'TRUE', 'DRONE_JOB_UUID': 'b6589fc6ab'}, globalenv=globalenv),
linux_cxx("TOOLSET=gcc COMPILER=g++ CXXSTD=03,11 Job 1", "g++", packages="", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++', 'CXXSTD': '03,11', 'DRONE_JOB_UUID': '356a192b79'}, globalenv=globalenv),
linux_cxx("TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 Job 2", "g++-4.7", packages="g++-4.7", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.7', 'CXXSTD': '03,11', 'DRONE_JOB_UUID': 'da4b9237ba'}, globalenv=globalenv),
linux_cxx("TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11 Job 3", "g++-4.8", packages="g++-4.8", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.8', 'CXXSTD': '03,11', 'DRONE_JOB_UUID': '77de68daec'}, globalenv=globalenv),
linux_cxx("TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11 Job 4", "g++-4.9", packages="g++-4.9", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.9', 'CXXSTD': '03,11', 'DRONE_JOB_UUID': '1b64538924'}, globalenv=globalenv),
linux_cxx("TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z Job 5", "g++-5", packages="g++-5", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-5', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': 'ac3478d69a'}, globalenv=globalenv),
linux_cxx("TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z Job 6", "g++-6", packages="g++-6", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-6', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': 'c1dfd96eea'}, globalenv=globalenv),
linux_cxx("TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 Job 7", "g++-7", packages="g++-7", buildtype="boost", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-7', 'CXXSTD': '03,11,14,17', 'DRONE_JOB_UUID': '902ba3cda1'}, globalenv=globalenv),
linux_cxx("TOOLSET=clang COMPILER=clang++ CXXSTD=03,11 Job 8", "clang++", packages="", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11', 'DRONE_JOB_UUID': 'fe5dbbcea5'}, globalenv=globalenv),
linux_cxx("TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03, Job 9", "clang++", packages="clang-3.5 libstdc++-4.9-dev", llvm_os="precise", llvm_ver="3.5", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.5', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': '0ade7c2cf9'}, globalenv=globalenv),
linux_cxx("TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03, Job 10", "clang++", packages="clang-3.6", llvm_os="precise", llvm_ver="3.6", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.6', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': 'b1d5781111'}, globalenv=globalenv),
linux_cxx("TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03, Job 11", "clang++", packages="clang-3.7", llvm_os="precise", llvm_ver="3.7", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.7', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': '17ba079149'}, globalenv=globalenv),
linux_cxx("TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03, Job 12", "clang++-3.8", packages="clang-3.8 libstdc++-4.9-dev", llvm_os="precise", llvm_ver="3.8", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.8', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': '7b52009b64'}, globalenv=globalenv),
linux_cxx("TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03, Job 13", "clang++-3.9", packages="clang-3.9 libstdc++-4.9-dev", llvm_os="precise", llvm_ver="3.9", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-3.9', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': 'bd307a3ec3'}, globalenv=globalenv),
linux_cxx("TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03, Job 14", "clang++-4.0", packages="clang-4.0", llvm_os="xenial", llvm_ver="4.0", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-4.0', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': 'fa35e19212'}, globalenv=globalenv),
linux_cxx("TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03, Job 15", "clang++-5.0", packages="clang-5.0", llvm_os="xenial", llvm_ver="5.0", buildtype="boost", image=linuxglobalimage, environment={'TOOLSET': 'clang', 'COMPILER': 'clang++-5.0', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': 'f1abd67035'}, globalenv=globalenv),
osx_cxx("TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,1 Job 16", "clang++", packages="", buildtype="boost", environment={'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,1z', 'DRONE_JOB_UUID': '1574bddb75'}, globalenv=globalenv),
]
# from https://github.com/boostorg/boost-ci
load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx")

37
.drone/96ad197d74-2319b6d45f.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
set -ex
export TRAVIS_BUILD_DIR=$(pwd)
export DRONE_BUILD_DIR=$(pwd)
export TRAVIS_BRANCH=$DRONE_BRANCH
export VCS_COMMIT_ID=$DRONE_COMMIT
export GIT_COMMIT=$DRONE_COMMIT
export REPO_NAME=$DRONE_REPO
export PATH=~/.local/bin:/usr/local/bin:$PATH
echo '==================================> BEFORE_INSTALL'
. .drone/before-install.sh
echo '==================================> INSTALL'
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/assert.git ../assert
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/config.git ../config
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/core.git ../core
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/static_assert.git ../static_assert
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/throw_exception.git ../throw_exception
echo '==================================> BEFORE_SCRIPT'
. $DRONE_BUILD_DIR/.drone/before-script.sh
echo '==================================> SCRIPT'
mkdir __build__ && cd __build__
cmake ../test/test_cmake
cmake --build .
echo '==================================> AFTER_SUCCESS'
. $DRONE_BUILD_DIR/.drone/after-success.sh

3
.drone/after-success.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash

3
.drone/before-install.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash

3
.drone/before-script.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash

41
.drone/boost.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
set -ex
export TRAVIS_BUILD_DIR=$(pwd)
export DRONE_BUILD_DIR=$(pwd)
export TRAVIS_BRANCH=$DRONE_BRANCH
export VCS_COMMIT_ID=$DRONE_COMMIT
export GIT_COMMIT=$DRONE_COMMIT
export REPO_NAME=$DRONE_REPO
export PATH=~/.local/bin:/usr/local/bin:$PATH
echo '==================================> BEFORE_INSTALL'
. .drone/before-install.sh
echo '==================================> INSTALL'
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init tools/build
git submodule update --init libs/config
git submodule update --init tools/boostdep
cp -r $TRAVIS_BUILD_DIR/* libs/array
python tools/boostdep/depinst/depinst.py array
./bootstrap.sh
./b2 headers
echo '==================================> BEFORE_SCRIPT'
. $DRONE_BUILD_DIR/.drone/before-script.sh
echo '==================================> SCRIPT'
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
./b2 -j 3 libs/array/test toolset=$TOOLSET cxxstd=$CXXSTD
echo '==================================> AFTER_SUCCESS'
. $DRONE_BUILD_DIR/.drone/after-success.sh

609
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,609 @@
name: CI
on:
pull_request:
push:
branches:
- master
- develop
- feature/**
env:
UBSAN_OPTIONS: print_stacktrace=1
jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- toolset: gcc-4.8
cxxstd: "03,11"
os: ubuntu-latest
container: ubuntu:18.04
install: g++-4.8-multilib
address-model: 32,64
- toolset: gcc-5
cxxstd: "03,11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
install: g++-5-multilib
address-model: 32,64
- toolset: gcc-6
cxxstd: "03,11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
install: g++-6-multilib
address-model: 32,64
- toolset: gcc-7
cxxstd: "03,11,14,17"
os: ubuntu-20.04
install: g++-7-multilib
address-model: 32,64
- toolset: gcc-8
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: g++-8-multilib
address-model: 32,64
- toolset: gcc-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: g++-9-multilib
address-model: 32,64
- toolset: gcc-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-22.04
install: g++-10-multilib
address-model: 32,64
- toolset: gcc-11
cxxstd: "03,11,14,17,20"
os: ubuntu-22.04
install: g++-11-multilib
address-model: 32,64
- toolset: gcc-12
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04
install: g++-12-multilib
address-model: 32,64
- toolset: gcc-13
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-latest
container: ubuntu:23.04
install: g++-13-multilib
address-model: 32,64
- toolset: clang
compiler: clang++-3.9
cxxstd: "03,11,14"
os: ubuntu-latest
container: ubuntu:18.04
install: clang-3.9
- toolset: clang
compiler: clang++-4.0
cxxstd: "03,11,14"
os: ubuntu-latest
container: ubuntu:18.04
install: clang-4.0
- toolset: clang
compiler: clang++-5.0
cxxstd: "03,11,14,1z"
os: ubuntu-latest
container: ubuntu:18.04
install: clang-5.0
- toolset: clang
compiler: clang++-6.0
cxxstd: "03,11,14,17"
os: ubuntu-20.04
install: clang-6.0
- toolset: clang
compiler: clang++-7
cxxstd: "03,11,14,17"
os: ubuntu-20.04
install: clang-7
- toolset: clang
compiler: clang++-8
cxxstd: "03,11,14,17"
os: ubuntu-20.04
install: clang-8
- toolset: clang
compiler: clang++-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
- toolset: clang
compiler: clang++-11
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
- toolset: clang
compiler: clang++-12
cxxstd: "03,11,14,17,20"
os: ubuntu-20.04
- toolset: clang
compiler: clang++-13
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04
install: clang-13
- toolset: clang
compiler: clang++-14
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04
install: clang-14
- toolset: clang
compiler: clang++-15
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04
install: clang-15
- toolset: clang
compiler: clang++-16
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-latest
container: ubuntu:23.04
install: clang-16
- toolset: clang
cxxstd: "03,11,14,17,2a"
os: macos-11
- toolset: clang
cxxstd: "03,11,14,17,20,2b"
os: macos-12
- toolset: clang
cxxstd: "03,11,14,17,20,2b"
os: macos-13
runs-on: ${{matrix.os}}
container: ${{matrix.container}}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Setup container environment
if: matrix.container
run: |
apt-get update
apt-get -y install sudo python3 git g++
- name: Install packages
if: matrix.install
run: |
sudo apt-get update
sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python3 tools/boostdep/depinst/depinst.py -I examples --git_args "--jobs 3" $LIBRARY
./bootstrap.sh
./b2 -d0 headers
- name: Create user-config.jam
if: matrix.compiler
run: |
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
- name: Run tests
run: |
cd ../boost-root
export ADDRMD=${{matrix.address-model}}
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} ${ADDRMD:+address-model=$ADDRMD} variant=debug,release
windows:
strategy:
fail-fast: false
matrix:
include:
- toolset: msvc-14.0
cxxstd: 14,latest
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.2
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.3
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2022
- toolset: clang-win
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2022
- toolset: gcc
cxxstd: "03,11,14,17,2a"
addrmd: 64
os: windows-2019
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py -I examples --git_args "--jobs 3" %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
- name: Run tests
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release embed-manifest-via=linker
posix-cmake-subdir:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: macos-11
- os: macos-12
- os: macos-13
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Install packages
if: matrix.install
run: sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Use library with add_subdirectory
run: |
cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
mkdir __build__ && cd __build__
cmake ..
cmake --build .
ctest --output-on-failure --no-tests=error
posix-cmake-install:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: macos-11
- os: macos-12
- os: macos-13
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Install packages
if: matrix.install
run: sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Configure
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
- name: Install
run: |
cd ../boost-root/__build__
cmake --build . --target install
- name: Use the installed library
run: |
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
cmake --build .
ctest --output-on-failure --no-tests=error
posix-cmake-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
- os: macos-11
- os: macos-12
- os: macos-13
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Install packages
if: matrix.install
run: sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
- name: Configure
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
- name: Build tests
run: |
cd ../boost-root/__build__
cmake --build . --target tests
- name: Run tests
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error
windows-cmake-subdir:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
- name: Use library with add_subdirectory (Debug)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test
mkdir __build__ && cd __build__
cmake ..
cmake --build . --config Debug
ctest --output-on-failure --no-tests=error -C Debug
- name: Use library with add_subdirectory (Release)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
cmake --build . --config Release
ctest --output-on-failure --no-tests=error -C Release
windows-cmake-install:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
- name: Configure
shell: cmd
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
- name: Install (Debug)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target install --config Debug
- name: Install (Release)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target install --config Release
- name: Use the installed library (Debug)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
cmake --build . --config Debug
ctest --output-on-failure --no-tests=error -C Debug
- name: Use the installed library (Release)
shell: cmd
run: |
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
cmake --build . --config Release
ctest --output-on-failure --no-tests=error -C Release
windows-cmake-test:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
- name: Configure
shell: cmd
run: |
cd ../boost-root
mkdir __build__ && cd __build__
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_TESTING=ON ..
- name: Build tests (Debug)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target tests --config Debug
- name: Run tests (Debug)
shell: cmd
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error -C Debug
- name: Build tests (Release)
shell: cmd
run: |
cd ../boost-root/__build__
cmake --build . --target tests --config Release
- name: Run tests (Release)
shell: cmd
run: |
cd ../boost-root/__build__
ctest --output-on-failure --no-tests=error -C Release

217
.travis.yml Normal file
View File

@ -0,0 +1,217 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2018, Mike-Dev
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
language: cpp
sudo: false
python: "2.7"
branches:
only:
- master
- develop
- /feature\/.*/
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
# cmake self-test
- os: linux
env: TEST_CMAKE=TRUE #Only for easier identification in travis web gui
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/assert.git ../assert
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/config.git ../config
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/core.git ../core
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/static_assert.git ../static_assert
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/throw_exception.git ../throw_exception
script:
- mkdir __build__ && cd __build__
- cmake ../test/test_cmake
- cmake --build .
- os: linux
compiler: g++
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
- os: linux
compiler: g++-4.7
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.8
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.9
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
addons:
apt:
packages:
- g++-4.9
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
- os: linux
compiler: clang++-3.5
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.5
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- 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: 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 --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- cp -r $TRAVIS_BUILD_DIR/* libs/array
- python tools/boostdep/depinst/depinst.py array
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 -j 3 libs/array/test toolset=$TOOLSET cxxstd=$CXXSTD
notifications:
email:
on_success: always

28
CMakeLists.txt Normal file
View File

@ -0,0 +1,28 @@
# Generated by `boostdep --cmake array`
# Copyright 2020, 2021 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.20)
project(boost_array VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_array INTERFACE)
add_library(Boost::array ALIAS boost_array)
target_include_directories(boost_array INTERFACE include)
target_link_libraries(boost_array
INTERFACE
Boost::assert
Boost::config
Boost::core
Boost::static_assert
Boost::throw_exception
)
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()

View File

@ -1,5 +1,19 @@
#~ Copyright Marshall Clow 2013
#~ 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)
using boostbook ; using boostbook ;
boostbook standalone boostbook standalone
: array.xml : array.xml
: <xsl:param>boost.root=../../../.. ; : <xsl:param>boost.root=../../../.. ;
###############################################################################
alias boostdoc
: array.xml
:
:
: ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;

View File

@ -77,7 +77,7 @@
<para>Note that this class is suggested to be part of the next <para>Note that this class is suggested to be part of the next
Technical Report, which will extend the C++ Standard (see Technical Report, which will extend the C++ Standard (see
<ulink url="http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1548.htm">http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1548.htm</ulink>).</para> <ulink url="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1548.htm">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1548.htm</ulink>).</para>
<para>Update: <code>std::array</code> is (as of C++11) part of the C++ standard. <para>Update: <code>std::array</code> is (as of C++11) part of the C++ standard.
The differences between <code>boost::array</code> and <code>std::array</code> are minimal. The differences between <code>boost::array</code> and <code>std::array</code> are minimal.

View File

@ -33,23 +33,21 @@
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(push) # pragma warning(push)
# pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe # pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe
# pragma warning(disable:4510) // boost::array<T,N>' : default constructor could not be generated # pragma warning(disable:4510) // boost::array<T,N>' : default constructor could not be generated
# pragma warning(disable:4610) // warning C4610: class 'boost::array<T,N>' can never be instantiated - user defined constructor required # pragma warning(disable:4610) // warning C4610: class 'boost::array<T,N>' can never be instantiated - user defined constructor required
#endif #endif
#include <cstddef> #include <cstddef>
#include <iterator>
#include <stdexcept> #include <stdexcept>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/core/invoke_swap.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/swap.hpp>
// Handles broken standard libraries better than <iterator>
#include <boost/detail/iterator.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/functional/hash_fwd.hpp>
#include <algorithm> #include <algorithm>
// FIXES for broken compilers // FIXES for broken compilers
@ -77,24 +75,18 @@ namespace boost {
iterator begin() { return elems; } iterator begin() { return elems; }
const_iterator begin() const { return elems; } const_iterator begin() const { return elems; }
const_iterator cbegin() const { return elems; } const_iterator cbegin() const { return elems; }
iterator end() { return elems+N; } iterator end() { return elems+N; }
const_iterator end() const { return elems+N; } const_iterator end() const { return elems+N; }
const_iterator cend() const { return elems+N; } const_iterator cend() const { return elems+N; }
// reverse iterator support // reverse iterator support
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) #if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) #elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
// workaround for broken reverse_iterator in VC7 typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator, value_type, reference, iterator, difference_type> reverse_iterator;
reference, iterator, reference> > reverse_iterator;
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
const_reference, iterator, reference> > const_reverse_iterator;
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
value_type, reference, iterator, difference_type> reverse_iterator;
typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag, typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
value_type, const_reference, const_iterator, difference_type> const_reverse_iterator; value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
#else #else
@ -120,39 +112,39 @@ namespace boost {
} }
// operator[] // operator[]
reference operator[](size_type i) reference operator[](size_type i)
{ {
return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i];
} }
/*BOOST_CONSTEXPR*/ const_reference operator[](size_type i) const /*BOOST_CONSTEXPR*/ const_reference operator[](size_type i) const
{ {
return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i];
} }
// at() with range check // at() with range check
reference at(size_type i) { return rangecheck(i), elems[i]; } reference at(size_type i) { return rangecheck(i), elems[i]; }
/*BOOST_CONSTEXPR*/ const_reference at(size_type i) const { return rangecheck(i), elems[i]; } /*BOOST_CONSTEXPR*/ const_reference at(size_type i) const { return rangecheck(i), elems[i]; }
// front() and back() // front() and back()
reference front() reference front()
{
return elems[0];
}
BOOST_CONSTEXPR const_reference front() const
{ {
return elems[0]; return elems[0];
} }
reference back() BOOST_CONSTEXPR const_reference front() const
{ {
return elems[N-1]; return elems[0];
} }
BOOST_CONSTEXPR const_reference back() const reference back()
{ {
return elems[N-1]; return elems[N-1];
}
BOOST_CONSTEXPR const_reference back() const
{
return elems[N-1];
} }
// size is constant // size is constant
@ -164,7 +156,7 @@ namespace boost {
// swap (note: linear complexity) // swap (note: linear complexity)
void swap (array<T,N>& y) { void swap (array<T,N>& y) {
for (size_type i = 0; i < N; ++i) for (size_type i = 0; i < N; ++i)
boost::swap(elems[i],y.elems[i]); boost::core::invoke_swap(elems[i],y.elems[i]);
} }
// direct access to data (read-only) // direct access to data (read-only)
@ -190,12 +182,11 @@ namespace boost {
// check range (may be private because it is static) // check range (may be private because it is static)
static BOOST_CONSTEXPR bool rangecheck (size_type i) { static BOOST_CONSTEXPR bool rangecheck (size_type i) {
return i > size() ? boost::throw_exception(std::out_of_range ("array<>: index out of range")), true : true; return i >= size() ? boost::throw_exception(std::out_of_range ("array<>: index out of range")), true : true;
} }
}; };
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template< class T > template< class T >
class array< T, 0 > { class array< T, 0 > {
@ -219,18 +210,12 @@ namespace boost {
const_iterator cend() const { return cbegin(); } const_iterator cend() const { return cbegin(); }
// reverse iterator support // reverse iterator support
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) #if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310) #elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
// workaround for broken reverse_iterator in VC7 typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator, value_type, reference, iterator, difference_type> reverse_iterator;
reference, iterator, reference> > reverse_iterator;
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
const_reference, iterator, reference> > const_reverse_iterator;
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
typedef std::reverse_iterator<iterator, std::random_access_iterator_tag,
value_type, reference, iterator, difference_type> reverse_iterator;
typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag, typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag,
value_type, const_reference, const_iterator, difference_type> const_reverse_iterator; value_type, const_reference, const_iterator, difference_type> const_reverse_iterator;
#else #else
@ -316,7 +301,7 @@ namespace boost {
// assign one value to all elements // assign one value to all elements
void assign (const T& value) { fill ( value ); } void assign (const T& value) { fill ( value ); }
void fill (const T& ) {} void fill (const T& ) {}
// check range (may be private because it is static) // check range (may be private because it is static)
static reference failed_rangecheck () { static reference failed_rangecheck () {
std::out_of_range e("attempt to access element of an empty array"); std::out_of_range e("attempt to access element of an empty array");
@ -332,7 +317,6 @@ namespace boost {
#endif #endif
} }
}; };
#endif
// comparisons // comparisons
template<class T, std::size_t N> template<class T, std::size_t N>
@ -369,16 +353,16 @@ namespace boost {
#if defined(__SUNPRO_CC) #if defined(__SUNPRO_CC)
// Trac ticket #4757; the Sun Solaris compiler can't handle // Trac ticket #4757; the Sun Solaris compiler can't handle
// syntax like 'T(&get_c_array(boost::array<T,N>& arg))[N]' // syntax like 'T(&get_c_array(boost::array<T,N>& arg))[N]'
// //
// We can't just use this for all compilers, because the // We can't just use this for all compilers, because the
// borland compilers can't handle this form. // borland compilers can't handle this form.
namespace detail { namespace detail {
template <typename T, std::size_t N> struct c_array template <typename T, std::size_t N> struct c_array
{ {
typedef T type[N]; typedef T type[N];
}; };
} }
// Specific for boost::array: simply returns its elems data member. // Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N> template <typename T, std::size_t N>
typename detail::c_array<T,N>::type& get_c_array(boost::array<T,N>& arg) typename detail::c_array<T,N>::type& get_c_array(boost::array<T,N>& arg)
@ -388,7 +372,7 @@ namespace boost {
// Specific for boost::array: simply returns its elems data member. // Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N> template <typename T, std::size_t N>
typename const detail::c_array<T,N>::type& get_c_array(const boost::array<T,N>& arg) typename detail::c_array<T,N>::type const& get_c_array(const boost::array<T,N>& arg)
{ {
return arg.elems; return arg.elems;
} }
@ -399,7 +383,7 @@ namespace boost {
{ {
return arg.elems; return arg.elems;
} }
// Const version. // Const version.
template <typename T, std::size_t N> template <typename T, std::size_t N>
const T(&get_c_array(const boost::array<T,N>& arg))[N] const T(&get_c_array(const boost::array<T,N>& arg))[N]
@ -407,7 +391,7 @@ namespace boost {
return arg.elems; return arg.elems;
} }
#endif #endif
#if 0 #if 0
// Overload for std::array, assuming that std::array will have // Overload for std::array, assuming that std::array will have
// explicit conversion functions as discussed at the WG21 meeting // explicit conversion functions as discussed at the WG21 meeting
@ -417,7 +401,7 @@ namespace boost {
{ {
return static_cast<T(&)[N]>(arg); return static_cast<T(&)[N]>(arg);
} }
// Const version. // Const version.
template <typename T, std::size_t N> template <typename T, std::size_t N>
const T(&get_c_array(const std::array<T,N>& arg))[N] const T(&get_c_array(const std::array<T,N>& arg))[N]
@ -426,6 +410,7 @@ namespace boost {
} }
#endif #endif
template <class It> std::size_t hash_range(It, It);
template<class T, std::size_t N> template<class T, std::size_t N>
std::size_t hash_value(const array<T,N>& arr) std::size_t hash_value(const array<T,N>& arr)
@ -438,7 +423,7 @@ namespace boost {
BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(boost::array &) index out of range" ); BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(boost::array &) index out of range" );
return arr[Idx]; return arr[Idx];
} }
template <size_t Idx, typename T, size_t N> template <size_t Idx, typename T, size_t N>
const T &get(const boost::array<T,N> &arr) BOOST_NOEXCEPT { const T &get(const boost::array<T,N> &arr) BOOST_NOEXCEPT {
BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(const boost::array &) index out of range" ); BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(const boost::array &) index out of range" );
@ -455,7 +440,7 @@ namespace std {
BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(boost::array &) index out of range" ); BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(boost::array &) index out of range" );
return arr[Idx]; return arr[Idx];
} }
template <size_t Idx, typename T, size_t N> template <size_t Idx, typename T, size_t N>
const T &get(const boost::array<T,N> &arr) BOOST_NOEXCEPT { const T &get(const boost::array<T,N> &arr) BOOST_NOEXCEPT {
BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(const boost::array &) index out of range" ); BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(const boost::array &) index out of range" );
@ -464,8 +449,8 @@ namespace std {
} }
#endif #endif
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(pop) # pragma warning(pop)
#endif #endif
#endif /*BOOST_ARRAY_HPP*/ #endif /*BOOST_ARRAY_HPP*/

18
meta/libraries.json Normal file
View File

@ -0,0 +1,18 @@
{
"key": "array",
"name": "Array",
"authors": [
"Nicolai Josuttis"
],
"description": "STL compliant container wrapper for arrays of constant size.",
"std": [
"tr1"
],
"category": [
"Containers"
],
"maintainers": [
"Marshall Clow <marshall -at- idio.com>"
],
"cxxstd": "03"
}

12
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,12 @@
# Copyright 2018, 2019, 2021, 2022 Peter Dimov
# 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(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile.v2
LINK_LIBRARIES Boost::array Boost::container_hash Boost::core)
endif()

View File

@ -4,22 +4,17 @@
import testing ; import testing ;
alias unit_test_framework run array0.cpp ;
: # sources run array1.cpp ;
/boost//unit_test_framework run array2.cpp ;
; run array3.cpp ;
run array4.cpp ;
run array5.cpp ;
run array6.cpp ;
run array7.cpp ;
# run array_constexpr.cpp ;
compile-fail array_getfail1.cpp ;
compile-fail array_getfail2.cpp ;
run array_hash.cpp ;
test-suite array : run quick.cpp ;
[ run array0.cpp unit_test_framework : : : : array0 ]
[ run array1.cpp ]
[ run array2.cpp ]
[ run array3.cpp ]
[ run array4.cpp ]
[ run array5.cpp ]
[ run array6.cpp unit_test_framework : : : : array6 ]
[ run array7.cpp unit_test_framework : : : : array7 ]
# [ run array_constexpr.cpp unit_test_framework : : : : array_constexpr ]
[ compile-fail array_getfail1.cpp ]
[ compile-fail array_getfail2.cpp ]
[ run array_hash.cpp unit_test_framework : : : : array_hash ]
;

View File

@ -9,15 +9,14 @@
#include <iostream> #include <iostream>
#include <boost/array.hpp> #include <boost/array.hpp>
#define BOOST_TEST_MAIN #include <boost/core/lightweight_test_trait.hpp>
#include <boost/test/unit_test.hpp>
namespace { namespace {
template< class T > template< class T >
void BadValue( const T & ) void BadValue( const T & )
{ {
BOOST_CHECK ( false ); BOOST_TEST ( false );
} }
template< class T > template< class T >
@ -33,19 +32,19 @@ void RunTests()
// front/back and operator[] must compile, but calling them is undefined // front/back and operator[] must compile, but calling them is undefined
// Likewise, all tests below should evaluate to false, avoiding undefined behaviour // Likewise, all tests below should evaluate to false, avoiding undefined behaviour
BOOST_CHECK ( test_case.empty()); BOOST_TEST ( test_case.empty());
BOOST_CHECK ( const_test_case.empty()); BOOST_TEST ( const_test_case.empty());
BOOST_CHECK ( test_case.size() == 0 ); BOOST_TEST ( test_case.size() == 0 );
BOOST_CHECK ( const_test_case.size() == 0 ); BOOST_TEST ( const_test_case.size() == 0 );
// Assert requirements of TR1 6.2.2.4 // Assert requirements of TR1 6.2.2.4
BOOST_CHECK ( test_case.begin() == test_case.end()); BOOST_TEST ( test_case.begin() == test_case.end());
BOOST_CHECK ( test_case.cbegin() == test_case.cend()); BOOST_TEST ( test_case.cbegin() == test_case.cend());
BOOST_CHECK ( const_test_case.begin() == const_test_case.end()); BOOST_TEST ( const_test_case.begin() == const_test_case.end());
BOOST_CHECK ( const_test_case.cbegin() == const_test_case.cend()); BOOST_TEST ( const_test_case.cbegin() == const_test_case.cend());
BOOST_CHECK ( test_case.begin() != const_test_case.begin() ); BOOST_TEST ( test_case.begin() != const_test_case.begin() );
if( test_case.data() == const_test_case.data() ) { if( test_case.data() == const_test_case.data() ) {
// Value of data is unspecified in TR1, so no requirement this test pass or fail // Value of data is unspecified in TR1, so no requirement this test pass or fail
// However, it must compile! // However, it must compile!
@ -79,11 +78,12 @@ void RunTests()
} }
BOOST_AUTO_TEST_CASE( test_main ) int main()
{ {
RunTests< bool >(); RunTests< bool >();
RunTests< void * >(); RunTests< void * >();
RunTests< long double >(); RunTests< long double >();
RunTests< std::string >(); RunTests< std::string >();
}
return boost::report_errors();
}

View File

@ -10,8 +10,7 @@
#include <boost/array.hpp> #include <boost/array.hpp>
#include <algorithm> #include <algorithm>
#define BOOST_TEST_MAIN #include <boost/core/lightweight_test_trait.hpp>
#include <boost/test/unit_test.hpp>
namespace { namespace {
template< class T > template< class T >
@ -22,19 +21,40 @@ namespace {
test_type test_case; // = { 1, 1, 2, 3, 5 }; test_type test_case; // = { 1, 1, 2, 3, 5 };
arr &aRef = get_c_array ( test_case ); arr &aRef = get_c_array ( test_case );
BOOST_CHECK ( &*test_case.begin () == &aRef[0] ); BOOST_TEST ( &*test_case.begin () == &aRef[0] );
const arr &caRef = get_c_array ( test_case ); const arr &caRef = get_c_array ( test_case );
typename test_type::const_iterator iter = test_case.begin (); typename test_type::const_iterator iter = test_case.begin ();
BOOST_CHECK ( &*iter == &caRef[0] ); BOOST_TEST ( &*iter == &caRef[0] );
// Confirm at() throws the std lib defined exception
try {
test_case.at( test_case.size());
BOOST_TEST(false);
}
catch ( const std::out_of_range & ) {}
try {
test_case.at( test_case.size() + 1);
BOOST_TEST(false);
}
catch ( const std::out_of_range & ) {}
try {
test_case.at( test_case.size() + 100);
BOOST_TEST(false);
}
catch ( const std::out_of_range & ) {}
} }
} }
BOOST_AUTO_TEST_CASE( test_main ) int main ()
{ {
RunTests< bool >(); RunTests< bool >();
RunTests< void * >(); RunTests< void * >();
RunTests< long double >(); RunTests< long double >();
RunTests< std::string >(); RunTests< std::string >();
return boost::report_errors();
} }

View File

@ -13,8 +13,7 @@
#include <array> #include <array>
#endif #endif
#define BOOST_TEST_MAIN #include <boost/core/lightweight_test_trait.hpp>
#include <boost/test/unit_test.hpp>
namespace { namespace {
@ -23,14 +22,13 @@ namespace {
void RunStdTests() void RunStdTests()
{ {
typedef boost::array< T, 5 > test_type; typedef boost::array< T, 5 > test_type;
typedef T arr[5];
test_type test_case; // = { 1, 1, 2, 3, 5 }; test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = std::get<0> ( test_case ); T &aRef = std::get<0> ( test_case );
BOOST_CHECK ( &*test_case.begin () == &aRef ); BOOST_TEST ( &*test_case.begin () == &aRef );
const T &caRef = std::get<0> ( test_case ); const T &caRef = std::get<0> ( test_case );
BOOST_CHECK ( &*test_case.cbegin () == &caRef ); BOOST_TEST ( &*test_case.cbegin () == &caRef );
} }
#endif #endif
@ -38,19 +36,18 @@ namespace {
void RunBoostTests() void RunBoostTests()
{ {
typedef boost::array< T, 5 > test_type; typedef boost::array< T, 5 > test_type;
typedef T arr[5];
test_type test_case; // = { 1, 1, 2, 3, 5 }; test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = boost::get<0> ( test_case ); T &aRef = boost::get<0> ( test_case );
BOOST_CHECK ( &*test_case.begin () == &aRef ); BOOST_TEST ( &*test_case.begin () == &aRef );
const T &caRef = boost::get<0> ( test_case ); const T &caRef = boost::get<0> ( test_case );
BOOST_CHECK ( &*test_case.cbegin () == &caRef ); BOOST_TEST ( &*test_case.cbegin () == &caRef );
} }
} }
BOOST_AUTO_TEST_CASE( test_main ) int main()
{ {
RunBoostTests< bool >(); RunBoostTests< bool >();
RunBoostTests< void * >(); RunBoostTests< void * >();
@ -63,5 +60,7 @@ BOOST_AUTO_TEST_CASE( test_main )
RunStdTests< long double >(); RunStdTests< long double >();
RunStdTests< std::string >(); RunStdTests< std::string >();
#endif #endif
return boost::report_errors();
} }

View File

@ -13,9 +13,6 @@
#include <array> #include <array>
#endif #endif
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#ifndef BOOST_NO_CXX11_CONSTEXPR #ifndef BOOST_NO_CXX11_CONSTEXPR
constexpr boost::array<int, 10> arr {{ 0,1,2,3,4,5,6,7,8,9 }}; constexpr boost::array<int, 10> arr {{ 0,1,2,3,4,5,6,7,8,9 }};
constexpr std::array<int, 10> arr_std {{ 0,1,2,3,4,5,6,7,8,9 }}; constexpr std::array<int, 10> arr_std {{ 0,1,2,3,4,5,6,7,8,9 }};
@ -26,18 +23,17 @@ void sink ( T t ) {}
template <typename T, size_t N> template <typename T, size_t N>
void sink ( boost::array<T,N> &arr ) {} void sink ( boost::array<T,N> &arr ) {}
BOOST_AUTO_TEST_CASE( test_main ) int main()
{ {
// constexpr int two = arr_std.at (2); // constexpr int two = arr_std.at (2);
constexpr int three = arr.at (3); constexpr int three = arr.at (3);
int whatever [ arr.at(4) ]; int whatever [ arr.at(4) ];
(void)three; (void)three;
(void) whatever; (void) whatever;
} }
#else // no constexpr means no constexpr tests! #else // no constexpr means no constexpr tests!
BOOST_AUTO_TEST_CASE( test_main ) int main()
{ {
} }
#endif #endif

View File

@ -16,8 +16,7 @@
#include <array> #include <array>
#endif #endif
#define BOOST_TEST_MAIN #include <boost/core/lightweight_test_trait.hpp>
#include <boost/test/unit_test.hpp>
namespace { namespace {
@ -29,14 +28,14 @@ namespace {
typedef T arr[5]; typedef T arr[5];
test_type test_case; // = { 1, 1, 2, 3, 5 }; test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = std::get<5> ( test_case ); // should fail to compile T &aRef = std::get<5> ( test_case ); // should fail to compile
BOOST_CHECK ( &*test_case.begin () == &aRef ); BOOST_TEST ( &*test_case.begin () == &aRef );
} }
#endif #endif
} }
BOOST_AUTO_TEST_CASE( test_main ) int main()
{ {
#ifndef BOOST_NO_CXX11_HDR_ARRAY #ifndef BOOST_NO_CXX11_HDR_ARRAY
RunStdTests< bool >(); RunStdTests< bool >();
@ -44,7 +43,8 @@ BOOST_AUTO_TEST_CASE( test_main )
RunStdTests< long double >(); RunStdTests< long double >();
RunStdTests< std::string >(); RunStdTests< std::string >();
#else #else
BOOST_STATIC_ASSERT ( false ); // fail on C++03 systems. BOOST_STATIC_ASSERT ( false ); // fail on C++03 systems.
#endif #endif
}
return boost::report_errors();
}

View File

@ -13,8 +13,7 @@
#include <array> #include <array>
#endif #endif
#define BOOST_TEST_MAIN #include <boost/core/lightweight_test_trait.hpp>
#include <boost/test/unit_test.hpp>
namespace { namespace {
@ -27,10 +26,10 @@ namespace {
test_type test_case; // = { 1, 1, 2, 3, 5 }; test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = std::get<0> ( test_case ); T &aRef = std::get<0> ( test_case );
BOOST_CHECK ( &*test_case.begin () == &aRef ); BOOST_TEST ( &*test_case.begin () == &aRef );
const T &caRef = std::get<0> ( test_case ); const T &caRef = std::get<0> ( test_case );
BOOST_CHECK ( &*test_case.cbegin () == &caRef ); BOOST_TEST ( &*test_case.cbegin () == &caRef );
} }
#endif #endif
@ -42,12 +41,12 @@ namespace {
test_type test_case; // = { 1, 1, 2, 3, 5 }; test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = boost::get<5> ( test_case ); T &aRef = boost::get<5> ( test_case );
BOOST_CHECK ( &*test_case.begin () == &aRef ); BOOST_TEST ( &*test_case.begin () == &aRef );
} }
} }
BOOST_AUTO_TEST_CASE( test_main ) int main()
{ {
RunBoostTests< bool >(); RunBoostTests< bool >();
RunBoostTests< void * >(); RunBoostTests< void * >();
@ -60,5 +59,7 @@ BOOST_AUTO_TEST_CASE( test_main )
RunStdTests< long double >(); RunStdTests< long double >();
RunStdTests< std::string >(); RunStdTests< std::string >();
#endif #endif
return boost::report_errors();
} }

View File

@ -11,8 +11,7 @@
#include <algorithm> #include <algorithm>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#define BOOST_TEST_MAIN #include <boost/core/lightweight_test_trait.hpp>
#include <boost/test/unit_test.hpp>
namespace { namespace {
@ -29,15 +28,17 @@ namespace {
std::size_t bhash = boost::hash<barr> () ( test_barr ); std::size_t bhash = boost::hash<barr> () ( test_barr );
std::size_t ahash = boost::hash<arr> () ( test_arr ); std::size_t ahash = boost::hash<arr> () ( test_arr );
BOOST_CHECK ( ahash == bhash ); BOOST_TEST ( ahash == bhash );
} }
} }
BOOST_AUTO_TEST_CASE( test_main ) int main()
{ {
RunTests< int >(); RunTests< int >();
RunTests< long >(); RunTests< long >();
RunTests< long double >(); RunTests< long double >();
return boost::report_errors();
} }

View File

@ -0,0 +1,17 @@
# Copyright 2018, 2019, 2021 Peter Dimov
# 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
cmake_minimum_required(VERSION 3.5...3.20)
project(cmake_install_test LANGUAGES CXX)
find_package(boost_array REQUIRED)
add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::array)
enable_testing()
add_test(quick quick)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -0,0 +1,23 @@
# Copyright 2018, 2019, 2021 Peter Dimov
# 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
cmake_minimum_required(VERSION 3.5...3.20)
project(cmake_subdir_test LANGUAGES CXX)
add_subdirectory(../.. boostorg/array)
add_subdirectory(../../../assert boostorg/assert)
add_subdirectory(../../../config boostorg/config)
add_subdirectory(../../../core boostorg/core)
add_subdirectory(../../../static_assert boostorg/static_assert)
add_subdirectory(../../../throw_exception boostorg/throw_exception)
add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::array)
enable_testing()
add_test(quick quick)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

11
test/quick.cpp Normal file
View File

@ -0,0 +1,11 @@
// Copyright 2023 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt)
#include <boost/array.hpp>
int main()
{
boost::array<int, 2> a = {{ 0, 1 }};
return a[0];
}