Compare commits

...

74 Commits

Author SHA1 Message Date
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
12fcbb59c2 Back out some of the constexpr support Boost.Array; it crashes gcc
[SVN r82906]
2013-02-15 17:11:09 +00:00
4a60b8c146 Add constexpr support to Boost.Array
[SVN r82834]
2013-02-12 18:07:15 +00:00
117584a2ce Update Boost.Array tests to use newer Boost.Test features
[SVN r82822]
2013-02-11 17:16:55 +00:00
97a26a1599 Documented boost::get support in Boost.Array
[SVN r82105]
2012-12-19 20:32:34 +00:00
88abb34b4d Fix bug where failure test failed for the wrong reason on C++03
[SVN r82102]
2012-12-19 17:49:04 +00:00
e02e7dcc00 Add boost::get<> support to Boost.Array
[SVN r82089]
2012-12-19 00:53:31 +00:00
daeb19f693 Add support for std::get<> to Boost.Array
[SVN r82083]
2012-12-18 17:59:08 +00:00
ba1a2437cf Merge doc changes to release; fixes #6988
[SVN r78948]
2012-06-14 16:01:03 +00:00
f41b1d2d4c Added a note about std::array in C++11
[SVN r78947]
2012-06-14 15:52:44 +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
f4a0cbd364 Added support for Boost.Hash to Boost.Array; fixes #6791
[SVN r77976]
2012-04-14 18:07:34 +00:00
992299f2bf Use BOOST_ASSERT_MSG instead of naked BOOST_ASSERT
[SVN r77135]
2012-02-28 18:47:28 +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
e6a44cf529 Removed tabs
[SVN r70442]
2011-03-22 23:55:20 +00:00
111e93aa4c qualify array to avoid conflict with std::array; Refs #5233
[SVN r69291]
2011-02-26 01:35:48 +00:00
5072c551ec Pathscale-4.0 configuration code/workarounds.
[SVN r68142]
2011-01-14 02:59:34 +00:00
26edbea113 Merging changes to release; fixes #4761
[SVN r68100]
2011-01-13 15:49:03 +00:00
97e912e82e Added crbegin and crend to Boost.Array; refs #4761. Will close ticket when merged to release branch
[SVN r67481]
2010-12-28 19:14:23 +00:00
05aa660128 Added cbegin and cend to Boost.Array; refs #4761. Will close ticket when merged to release branch
[SVN r67478]
2010-12-28 18:39:14 +00:00
9644ee6662 Merged array changes to release; fixes #4757
[SVN r67477]
2010-12-28 18:28:22 +00:00
7256882760 Fix? for borland
[SVN r66781]
2010-11-26 20:16:34 +00:00
5329bd6f1c Slight tweak of get_c_array
[SVN r66712]
2010-11-24 16:13:12 +00:00
80fa50df2e SunPro workaround; references #4757
[SVN r66651]
2010-11-20 00:48:33 +00:00
6fbc8ee741 Added a test for 'get_c_array'
[SVN r66294]
2010-10-31 02:25:04 +00:00
38217688e1 Fix elems for Sun compilers
[SVN r66154]
2010-10-23 19:11:16 +00:00
a603bffc48 Merged Array changes to release
[SVN r63410]
2010-06-28 17:59:21 +00:00
2595eda739 Removed tabs
[SVN r62803]
2010-06-11 14:46:31 +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
18 changed files with 901 additions and 119 deletions

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

24
CMakeLists.txt Normal file
View File

@ -0,0 +1,24 @@
# Copyright 2018 Mike Dev
# 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
# NOTE: CMake support for Boost.Array is currently experimental at best
# and the interface is likely to change in the future
cmake_minimum_required(VERSION 3.5)
project(boost-array 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
)

19
doc/Jamfile.v2 Normal file
View File

@ -0,0 +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 ;
boostbook standalone
: array.xml
: <xsl:param>boost.root=../../../.. ;
###############################################################################
alias boostdoc
: array.xml
:
:
: ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;

View File

@ -7,6 +7,10 @@
<firstname>Nicolai</firstname>
<surname>Josuttis</surname>
</author>
<maintainer>
<firstname>Marshall</firstname>
<surname>Clow</surname>
</maintainer>
<copyright>
<year>2001</year>
@ -16,6 +20,11 @@
<holder>Nicolai M. Josuttis</holder>
</copyright>
<copyright>
<year>2012</year>
<holder>Marshall Clow</holder>
</copyright>
<legalnotice>
<para>Distributed under the Boost Software License, Version 1.0.
(See accompanying file <filename>LICENSE_1_0.txt</filename> or copy at
@ -68,7 +77,12 @@
<para>Note that this class is suggested to be part of the next
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.
The differences between <code>boost::array</code> and <code>std::array</code> are minimal.
If you are using C++11, you should consider using <code>std::array</code> instead of <code>boost::array</code>.
</para>
<para>Class <code><classname>array</classname></code> fulfills most
but not all of the requirements of "reversible containers" (see
@ -171,6 +185,24 @@
<returns><simpara>iterator for position after the last element</simpara></returns>
<throws><simpara>will not throw</simpara></throws>
</overloaded-method>
<overloaded-method name="cbegin" cv="const">
<signature>
<type>const_iterator</type>
</signature>
<returns><simpara>constant iterator for the first element</simpara></returns>
<throws><simpara>will not throw</simpara></throws>
</overloaded-method>
<overloaded-method name="cend" cv="const">
<signature>
<type>const_iterator</type>
</signature>
<returns><simpara>constant iterator for position after the last element</simpara></returns>
<throws><simpara>will not throw</simpara></throws>
</overloaded-method>
</method-group>
<method-group name="reverse iterator support">
@ -195,6 +227,24 @@
<returns><simpara>reverse iterator for position after the last element in reverse iteration</simpara></returns>
</overloaded-method>
<overloaded-method name="crbegin" cv="const">
<signature>
<type>const_reverse_iterator</type>
</signature>
<returns><simpara>constant reverse iterator for the first element of reverse iteration</simpara></returns>
<throws><simpara>will not throw</simpara></throws>
</overloaded-method>
<overloaded-method name="crend" cv="const">
<signature>
<type>const_reverse_iterator</type>
</signature>
<returns><simpara>constant reverse iterator for position after the last element in reverse iteration</simpara></returns>
<throws><simpara>will not throw</simpara></throws>
</overloaded-method>
</method-group>
<method-group name="capacity">
@ -460,6 +510,49 @@
<returns><simpara><code>!(x &lt; y)</code></simpara></returns>
</function>
</free-function-group>
<free-function-group name="specializations">
<function name="boost::get">
<template>
<template-type-parameter name="T"/>
<template-nontype-parameter name="N">
<type>std::size_t</type>
</template-nontype-parameter>
<template-nontype-parameter name="Idx">
<type>std::size_t</type>
</template-nontype-parameter>
</template>
<type>T</type>
<parameter name="arr">
<paramtype><classname>array</classname>&lt;T, N&gt;&amp;</paramtype>
</parameter>
<returns><simpara>element of array with index <code>Idx</code></simpara></returns>
<effects><simpara>Will <code>static_assert</code> if <code>Idx >= N</code></simpara></effects>
</function>
<function name="boost::get">
<template>
<template-type-parameter name="T"/>
<template-nontype-parameter name="N">
<type>std::size_t</type>
</template-nontype-parameter>
<template-nontype-parameter name="Idx">
<type>std::size_t</type>
</template-nontype-parameter>
</template>
<type>T</type>
<parameter name="arr">
<paramtype>const <classname>array</classname>&lt;T, N&gt;&amp;</paramtype>
</parameter>
<returns><simpara>const element of array with index <code>Idx</code></simpara></returns>
<effects><simpara>Will <code>static_assert</code> if <code>Idx >= N</code></simpara></effects>
</function>
</free-function-group>
</class>
</namespace>
</header>

View File

@ -13,6 +13,9 @@
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* 9 Jan 2013 - (mtc) Added constexpr
* 14 Apr 2012 - (mtc) Added support for boost::hash
* 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility.
* 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group.
* See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168
* Eventually, we should remove "assign" which is now a synonym for "fill" (Marshall Clow)
@ -40,6 +43,7 @@
#include <cstddef>
#include <stdexcept>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/swap.hpp>
// Handles broken standard libraries better than <iterator>
@ -69,21 +73,18 @@ namespace boost {
typedef std::ptrdiff_t difference_type;
// iterator support
iterator begin() { return elems; }
const_iterator begin() const { return elems; }
iterator end() { return elems+N; }
const_iterator end() const { return elems+N; }
iterator begin() { return elems; }
const_iterator begin() const { return elems; }
const_iterator cbegin() const { return elems; }
iterator end() { return elems+N; }
const_iterator end() const { return elems+N; }
const_iterator cend() const { return elems+N; }
// 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<const_iterator> const_reverse_iterator;
#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310)
// workaround for broken reverse_iterator in VC7
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, 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;
@ -99,27 +100,32 @@ namespace boost {
const_reverse_iterator rbegin() const {
return const_reverse_iterator(end());
}
const_reverse_iterator crbegin() const {
return const_reverse_iterator(end());
}
reverse_iterator rend() { return reverse_iterator(begin()); }
const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
}
const_reverse_iterator crend() const {
return const_reverse_iterator(begin());
}
// operator[]
reference operator[](size_type i)
{
BOOST_ASSERT( i < N && "out of range" );
return elems[i];
return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i];
}
const_reference operator[](size_type i) const
/*BOOST_CONSTEXPR*/ const_reference operator[](size_type i) const
{
BOOST_ASSERT( i < N && "out of range" );
return elems[i];
return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i];
}
// at() with range check
reference at(size_type i) { rangecheck(i); return elems[i]; }
const_reference at(size_type i) const { rangecheck(i); return 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]; }
// front() and back()
reference front()
@ -127,7 +133,7 @@ namespace boost {
return elems[0];
}
const_reference front() const
BOOST_CONSTEXPR const_reference front() const
{
return elems[0];
}
@ -137,15 +143,15 @@ namespace boost {
return elems[N-1];
}
const_reference back() const
BOOST_CONSTEXPR const_reference back() const
{
return elems[N-1];
}
// size is constant
static size_type size() { return N; }
static bool empty() { return false; }
static size_type max_size() { return N; }
static BOOST_CONSTEXPR size_type size() { return N; }
static BOOST_CONSTEXPR bool empty() { return false; }
static BOOST_CONSTEXPR size_type max_size() { return N; }
enum { static_size = N };
// swap (note: linear complexity)
@ -176,16 +182,12 @@ namespace boost {
}
// check range (may be private because it is static)
static void rangecheck (size_type i) {
if (i >= size()) {
std::out_of_range e("array<>: index out of range");
boost::throw_exception(e);
}
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;
}
};
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template< class T >
class array< T, 0 > {
@ -200,21 +202,18 @@ namespace boost {
typedef std::ptrdiff_t difference_type;
// iterator support
iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); }
const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
iterator end() { return begin(); }
const_iterator end() const { return begin(); }
iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); }
const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
const_iterator cbegin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); }
iterator end() { return begin(); }
const_iterator end() const { return begin(); }
const_iterator cend() const { return cbegin(); }
// 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<const_iterator> const_reverse_iterator;
#elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310)
// workaround for broken reverse_iterator in VC7
typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, 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;
@ -230,10 +229,17 @@ namespace boost {
const_reverse_iterator rbegin() const {
return const_reverse_iterator(end());
}
const_reverse_iterator crbegin() const {
return const_reverse_iterator(end());
}
reverse_iterator rend() { return reverse_iterator(begin()); }
const_reverse_iterator rend() const {
return const_reverse_iterator(begin());
}
const_reverse_iterator crend() const {
return const_reverse_iterator(begin());
}
// operator[]
reference operator[](size_type /*i*/)
@ -241,14 +247,14 @@ namespace boost {
return failed_rangecheck();
}
const_reference operator[](size_type /*i*/) const
/*BOOST_CONSTEXPR*/ const_reference operator[](size_type /*i*/) const
{
return failed_rangecheck();
}
// at() with range check
reference at(size_type /*i*/) { return failed_rangecheck(); }
const_reference at(size_type /*i*/) const { return failed_rangecheck(); }
/*BOOST_CONSTEXPR*/ const_reference at(size_type /*i*/) const { return failed_rangecheck(); }
// front() and back()
reference front()
@ -256,7 +262,7 @@ namespace boost {
return failed_rangecheck();
}
const_reference front() const
BOOST_CONSTEXPR const_reference front() const
{
return failed_rangecheck();
}
@ -266,15 +272,15 @@ namespace boost {
return failed_rangecheck();
}
const_reference back() const
BOOST_CONSTEXPR const_reference back() const
{
return failed_rangecheck();
}
// size is constant
static size_type size() { return 0; }
static bool empty() { return true; }
static size_type max_size() { return 0; }
static BOOST_CONSTEXPR size_type size() { return 0; }
static BOOST_CONSTEXPR bool empty() { return true; }
static BOOST_CONSTEXPR size_type max_size() { return 0; }
enum { static_size = 0 };
void swap (array<T,0>& /*y*/) {
@ -301,7 +307,7 @@ namespace boost {
static reference failed_rangecheck () {
std::out_of_range e("attempt to access element of an empty array");
boost::throw_exception(e);
#if defined(BOOST_NO_EXCEPTIONS) || !defined(BOOST_MSVC)
#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__))
//
// We need to return something here to keep
// some compilers happy: however we will never
@ -312,7 +318,6 @@ namespace boost {
#endif
}
};
#endif
// comparisons
template<class T, std::size_t N>
@ -346,40 +351,104 @@ namespace boost {
x.swap(y);
}
// Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N>
T(&get_c_array(boost::array<T,N>& arg))[N]
{
return arg.elems;
}
// Const version.
template <typename T, std::size_t N>
const T(&get_c_array(const boost::array<T,N>& arg))[N]
{
return arg.elems;
}
#if defined(__SUNPRO_CC)
// Trac ticket #4757; the Sun Solaris compiler can't handle
// syntax like 'T(&get_c_array(boost::array<T,N>& arg))[N]'
//
// We can't just use this for all compilers, because the
// borland compilers can't handle this form.
namespace detail {
template <typename T, std::size_t N> struct c_array
{
typedef T type[N];
};
}
// Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N>
typename detail::c_array<T,N>::type& get_c_array(boost::array<T,N>& arg)
{
return arg.elems;
}
#if 0
// Overload for std::array, assuming that std::array will have
// explicit conversion functions as discussed at the WG21 meeting
// in Summit, March 2009.
template <typename T, std::size_t N>
T(&get_c_array(std::array<T,N>& arg))[N]
{
return static_cast<T(&)[N]>(arg);
}
// Const version.
template <typename T, std::size_t N>
const T(&get_c_array(const std::array<T,N>& arg))[N]
{
return static_cast<T(&)[N]>(arg);
}
// Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N>
typename detail::c_array<T,N>::type const& get_c_array(const boost::array<T,N>& arg)
{
return arg.elems;
}
#else
// Specific for boost::array: simply returns its elems data member.
template <typename T, std::size_t N>
T(&get_c_array(boost::array<T,N>& arg))[N]
{
return arg.elems;
}
// Const version.
template <typename T, std::size_t N>
const T(&get_c_array(const boost::array<T,N>& arg))[N]
{
return arg.elems;
}
#endif
#if 0
// Overload for std::array, assuming that std::array will have
// explicit conversion functions as discussed at the WG21 meeting
// in Summit, March 2009.
template <typename T, std::size_t N>
T(&get_c_array(std::array<T,N>& arg))[N]
{
return static_cast<T(&)[N]>(arg);
}
// Const version.
template <typename T, std::size_t N>
const T(&get_c_array(const std::array<T,N>& arg))[N]
{
return static_cast<T(&)[N]>(arg);
}
#endif
template <class It> std::size_t hash_range(It, It);
template<class T, std::size_t N>
std::size_t hash_value(const array<T,N>& arr)
{
return boost::hash_range(arr.begin(), arr.end());
}
template <size_t Idx, typename T, size_t N>
T &get(boost::array<T,N> &arr) BOOST_NOEXCEPT {
BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(boost::array &) index out of range" );
return arr[Idx];
}
template <size_t Idx, typename T, size_t N>
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" );
return arr[Idx];
}
} /* namespace boost */
#ifndef BOOST_NO_CXX11_HDR_ARRAY
// If we don't have std::array, I'm assuming that we don't have std::get
namespace std {
template <size_t Idx, typename T, size_t N>
T &get(boost::array<T,N> &arr) BOOST_NOEXCEPT {
BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(boost::array &) index out of range" );
return arr[Idx];
}
template <size_t Idx, typename T, size_t N>
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" );
return arr[Idx];
}
}
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(pop)

17
meta/libraries.json Normal file
View File

@ -0,0 +1,17 @@
{
"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>"
]
}

View File

@ -2,8 +2,6 @@
#~ 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)
import testing ;
test-suite array :
[ run array0.cpp ]
[ run array1.cpp ]
@ -11,4 +9,10 @@ test-suite array :
[ 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 ]
;

View File

@ -9,18 +9,14 @@
#include <iostream>
#include <boost/array.hpp>
namespace {
unsigned int failed_tests = 0;
#include <boost/core/lightweight_test_trait.hpp>
void fail_test( const char * reason ) {
++failed_tests;
std::cerr << "Test failure " << failed_tests << ": " << reason << std::endl;
}
namespace {
template< class T >
void BadValue( const T & )
{
fail_test( "Unexpected value" );
BOOST_TEST ( false );
}
template< class T >
@ -36,55 +32,41 @@ void RunTests()
// front/back and operator[] must compile, but calling them is undefined
// Likewise, all tests below should evaluate to false, avoiding undefined behaviour
if( !test_case.empty() ) {
BadValue( test_case.front() );
}
BOOST_TEST ( test_case.empty());
BOOST_TEST ( const_test_case.empty());
if( !const_test_case.empty() ) {
BadValue( const_test_case.back() );
}
if( test_case.size() > 0 ) {
BadValue( test_case[ 0 ] );
}
if( const_test_case.max_size() > 0 ) {
BadValue( const_test_case[ 0 ] );
}
BOOST_TEST ( test_case.size() == 0 );
BOOST_TEST ( const_test_case.size() == 0 );
// Assert requirements of TR1 6.2.2.4
if( test_case.begin() != test_case.end() ) {
fail_test( "Not an empty range" );
}
if( const_test_case.begin() != const_test_case.end() ) {
fail_test( "Not an empty range" );
}
if( test_case.begin() == const_test_case.begin() ) {
fail_test( "iterators for different containers are not distinct" );
}
BOOST_TEST ( test_case.begin() == test_case.end());
BOOST_TEST ( test_case.cbegin() == test_case.cend());
BOOST_TEST ( const_test_case.begin() == const_test_case.end());
BOOST_TEST ( const_test_case.cbegin() == const_test_case.cend());
BOOST_TEST ( test_case.begin() != const_test_case.begin() );
if( test_case.data() == const_test_case.data() ) {
// Value of data is unspecified in TR1, so no requirement this test pass or fail
// However, it must compile!
}
// Check can safely use all iterator types with std algorithms
std::for_each( test_case.begin(), test_case.end(), BadValue< T > );
std::for_each( test_case.rbegin(), test_case.rend(), BadValue< T > );
std::for_each( test_case.cbegin(), test_case.cend(), BadValue< T > );
std::for_each( const_test_case.begin(), const_test_case.end(), BadValue< T > );
std::for_each( const_test_case.rbegin(), const_test_case.rend(), BadValue< T > );
std::for_each( const_test_case.cbegin(), const_test_case.cend(), BadValue< T > );
// Check swap is well formed
std::swap( test_case, test_case );
// Check assigment operator and overloads are well formed
// Check assignment operator and overloads are well formed
test_case = const_test_case;
// Confirm at() throws the std lib defined exception
try {
BadValue( test_case.at( 0 ) );
BadValue( test_case.at( 0 ));
} catch ( const std::out_of_range & ) {
}
@ -102,6 +84,6 @@ int main()
RunTests< void * >();
RunTests< long double >();
RunTests< std::string >();
return failed_tests;
}
return boost::report_errors();
}

View File

@ -15,12 +15,11 @@
#include <boost/array.hpp>
#include "print.hpp"
using namespace std;
using namespace boost;
int main()
{
// create and initialize array
array<int,10> a = { { 1, 2, 3, 4, 5 } };
boost::array<int,10> a = { { 1, 2, 3, 4, 5 } };
print_elements(a);

View File

@ -39,6 +39,13 @@ int main()
=seasons.rbegin(); pos<seasons.rend(); ++pos) {
std::cout << " " << *pos;
}
// try constant reverse iterators
std::cout << "reverse: ";
for (boost::array<std::string,4>::const_reverse_iterator pos
=seasons.crbegin(); pos<seasons.crend(); ++pos) {
std::cout << " " << *pos;
}
std::cout << std::endl;
return 0; // makes Visual-C++ compiler happy

60
test/array6.cpp Normal file
View File

@ -0,0 +1,60 @@
/* tests for using class array<> specialization for size 0
* (C) Copyright Alisdair Meredith 2006.
* 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 <string>
#include <iostream>
#include <boost/array.hpp>
#include <algorithm>
#include <boost/core/lightweight_test_trait.hpp>
namespace {
template< class T >
void RunTests()
{
typedef boost::array< T, 5 > test_type;
typedef T arr[5];
test_type test_case; // = { 1, 1, 2, 3, 5 };
arr &aRef = get_c_array ( test_case );
BOOST_TEST ( &*test_case.begin () == &aRef[0] );
const arr &caRef = get_c_array ( test_case );
typename test_type::const_iterator iter = test_case.begin ();
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 & ) {}
}
}
int main ()
{
RunTests< bool >();
RunTests< void * >();
RunTests< long double >();
RunTests< std::string >();
return boost::report_errors();
}

66
test/array7.cpp Normal file
View File

@ -0,0 +1,66 @@
/* tests using std::get on boost:array
* (C) Copyright Marshall Clow 2012
* 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 <string>
#include <iostream>
#include <boost/array.hpp>
#include <algorithm>
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
#endif
#include <boost/core/lightweight_test_trait.hpp>
namespace {
#ifndef BOOST_NO_CXX11_HDR_ARRAY
template< class T >
void RunStdTests()
{
typedef boost::array< T, 5 > test_type;
test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = std::get<0> ( test_case );
BOOST_TEST ( &*test_case.begin () == &aRef );
const T &caRef = std::get<0> ( test_case );
BOOST_TEST ( &*test_case.cbegin () == &caRef );
}
#endif
template< class T >
void RunBoostTests()
{
typedef boost::array< T, 5 > test_type;
test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = boost::get<0> ( test_case );
BOOST_TEST ( &*test_case.begin () == &aRef );
const T &caRef = boost::get<0> ( test_case );
BOOST_TEST ( &*test_case.cbegin () == &caRef );
}
}
int main()
{
RunBoostTests< bool >();
RunBoostTests< void * >();
RunBoostTests< long double >();
RunBoostTests< std::string >();
#ifndef BOOST_NO_CXX11_HDR_ARRAY
RunStdTests< bool >();
RunStdTests< void * >();
RunStdTests< long double >();
RunStdTests< std::string >();
#endif
return boost::report_errors();
}

39
test/array_constexpr.cpp Normal file
View File

@ -0,0 +1,39 @@
/* tests using constexpr on boost:array
* (C) Copyright Marshall Clow 2012
* 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 <string>
#include <iostream>
#include <boost/array.hpp>
#include <algorithm>
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
#endif
#ifndef BOOST_NO_CXX11_CONSTEXPR
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 }};
template <typename T>
void sink ( T t ) {}
template <typename T, size_t N>
void sink ( boost::array<T,N> &arr ) {}
int main()
{
// constexpr int two = arr_std.at (2);
constexpr int three = arr.at (3);
int whatever [ arr.at(4) ];
(void)three;
(void) whatever;
}
#else // no constexpr means no constexpr tests!
int main()
{
}
#endif

50
test/array_getfail1.cpp Normal file
View File

@ -0,0 +1,50 @@
/* tests using std::get on boost:array
* (C) Copyright Marshall Clow 2012
* 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/array.hpp>
#include <boost/static_assert.hpp>
#include <string>
#include <iostream>
#include <algorithm>
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
#endif
#include <boost/core/lightweight_test_trait.hpp>
namespace {
#ifndef BOOST_NO_CXX11_HDR_ARRAY
template< class T >
void RunStdTests()
{
typedef boost::array< T, 5 > test_type;
typedef T arr[5];
test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = std::get<5> ( test_case ); // should fail to compile
BOOST_TEST ( &*test_case.begin () == &aRef );
}
#endif
}
int main()
{
#ifndef BOOST_NO_CXX11_HDR_ARRAY
RunStdTests< bool >();
RunStdTests< void * >();
RunStdTests< long double >();
RunStdTests< std::string >();
#else
BOOST_STATIC_ASSERT ( false ); // fail on C++03 systems.
#endif
return boost::report_errors();
}

65
test/array_getfail2.cpp Normal file
View File

@ -0,0 +1,65 @@
/* tests using std::get on boost:array
* (C) Copyright Marshall Clow 2012
* 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 <string>
#include <iostream>
#include <boost/array.hpp>
#include <algorithm>
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
#endif
#include <boost/core/lightweight_test_trait.hpp>
namespace {
#ifndef BOOST_NO_CXX11_HDR_ARRAY
template< class T >
void RunStdTests()
{
typedef boost::array< T, 5 > test_type;
typedef T arr[5];
test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = std::get<0> ( test_case );
BOOST_TEST ( &*test_case.begin () == &aRef );
const T &caRef = std::get<0> ( test_case );
BOOST_TEST ( &*test_case.cbegin () == &caRef );
}
#endif
template< class T >
void RunBoostTests()
{
typedef boost::array< T, 5 > test_type;
typedef T arr[5];
test_type test_case; // = { 1, 1, 2, 3, 5 };
T &aRef = boost::get<5> ( test_case );
BOOST_TEST ( &*test_case.begin () == &aRef );
}
}
int main()
{
RunBoostTests< bool >();
RunBoostTests< void * >();
RunBoostTests< long double >();
RunBoostTests< std::string >();
#ifndef BOOST_NO_CXX11_HDR_ARRAY
RunStdTests< bool >();
RunStdTests< void * >();
RunStdTests< long double >();
RunStdTests< std::string >();
#endif
return boost::report_errors();
}

44
test/array_hash.cpp Normal file
View File

@ -0,0 +1,44 @@
/* tests for using boost::hash with boost::array
* (C) Copyright Marshall Clow 2012
* 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 <string>
#include <iostream>
#include <boost/array.hpp>
#include <algorithm>
#include <boost/functional/hash.hpp>
#include <boost/core/lightweight_test_trait.hpp>
namespace {
template< class T >
void RunTests()
{
// std::size_t hash0 = boost::hash<boost::array<T,0> > () ( boost::array<T, 0> ());
// std::size_t hash1 = boost::hash<boost::array<T,1> > () ( boost::array<T, 1> ());
typedef boost::array< T, 5 > barr;
typedef T arr[5];
barr test_barr = {{ 1, 1, 2, 3, 5 }};
arr test_arr = { 1, 1, 2, 3, 5 };
std::size_t bhash = boost::hash<barr> () ( test_barr );
std::size_t ahash = boost::hash<arr> () ( test_arr );
BOOST_TEST ( ahash == bhash );
}
}
int main()
{
RunTests< int >();
RunTests< long >();
RunTests< long double >();
return boost::report_errors();
}

View File

@ -0,0 +1,22 @@
# Copyright 2018 Mike Dev
# 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
#
# NOTE: This does NOT run the unit tests for Boost.Array.
# It only tests, if the CMakeLists.txt file in it's root works as expected
cmake_minimum_required( VERSION 3.5 )
project( BoostBindCMakeSelfTest )
add_subdirectory( ../../../assert ${CMAKE_CURRENT_BINARY_DIR}/libs/assert )
add_subdirectory( ../../../config ${CMAKE_CURRENT_BINARY_DIR}/libs/config )
add_subdirectory( ../../../core ${CMAKE_CURRENT_BINARY_DIR}/libs/core )
add_subdirectory( ../../../static_assert ${CMAKE_CURRENT_BINARY_DIR}/libs/static_assert )
add_subdirectory( ../../../throw_exception ${CMAKE_CURRENT_BINARY_DIR}/libs/thorw_exception )
add_subdirectory( ../.. ${CMAKE_CURRENT_BINARY_DIR}/libs/boost_array )
add_executable( boost_array_cmake_self_test main.cpp )
target_link_libraries( boost_array_cmake_self_test Boost::array )

5
test/test_cmake/main.cpp Normal file
View File

@ -0,0 +1,5 @@
#include <boost/array.hpp>
int main() {
boost::array<int,5> a{};
}