forked from boostorg/core
Compare commits
120 Commits
boost-1.56
...
boost-1.64
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a49e7f2f87 | ||
|
|
064cfd3d73 | ||
|
|
6e7e44e334 | ||
|
|
0942b1a366 | ||
|
|
1343535926 | ||
|
|
3ef30643a4 | ||
|
|
4436576c68 | ||
|
|
1dff55872b | ||
|
|
a796c200e5 | ||
|
|
a3382dd5a8 | ||
|
|
6ecc56c289 | ||
|
|
306b792a5e | ||
|
|
d753d9a221 | ||
|
|
1bdb657b71 | ||
|
|
54e262ee13 | ||
|
|
c8b7acc8aa | ||
|
|
baed4103a0 | ||
|
|
d828e40f6d | ||
|
|
db8efb4ce9 | ||
|
|
fb09632580 | ||
|
|
c96ad4ccba | ||
|
|
265583bc78 | ||
|
|
6a5f540f08 | ||
|
|
3bc56800cd | ||
|
|
9dd5285dbb | ||
|
|
ef9bb78f19 | ||
|
|
b59a3df4c4 | ||
|
|
fe137b97c3 | ||
|
|
7038296c15 | ||
|
|
4570cced27 | ||
|
|
a44090aebe | ||
|
|
cc5472623f | ||
|
|
518549f7ff | ||
|
|
98ee47effd | ||
|
|
3942e9c097 | ||
|
|
7774d33e45 | ||
|
|
cdee8e76c5 | ||
|
|
e647763fb0 | ||
|
|
9587d6b845 | ||
|
|
b0a58a16e2 | ||
|
|
55b2786770 | ||
|
|
76110e56a0 | ||
|
|
4016f8e7cc | ||
|
|
686dbcb8eb | ||
|
|
3d98e6aed4 | ||
|
|
39515e5a78 | ||
|
|
2af0107c1f | ||
|
|
26f290d09f | ||
|
|
09dcc68ecd | ||
|
|
fa88cc32cf | ||
|
|
f7183714c1 | ||
|
|
b0239ba7be | ||
|
|
1abd68102d | ||
|
|
a1ba85e5f6 | ||
|
|
399ef5207e | ||
|
|
01d5850952 | ||
|
|
c0f277a7d8 | ||
|
|
5507006fc2 | ||
|
|
b7f49c9c78 | ||
|
|
ee8c2d3e46 | ||
|
|
9953994761 | ||
|
|
0a50557410 | ||
|
|
8156259043 | ||
|
|
5263c5d47f | ||
|
|
29810a490a | ||
|
|
aa17d6a5e2 | ||
|
|
9df5059786 | ||
|
|
df2f358766 | ||
|
|
2128428ca1 | ||
|
|
b0b16d6ddb | ||
|
|
d732412924 | ||
|
|
9823a4135b | ||
|
|
05f6c1d642 | ||
|
|
0ad01c60a0 | ||
|
|
a7607030a9 | ||
|
|
94d3d3540f | ||
|
|
45a63809bf | ||
|
|
f55d2a5cf9 | ||
|
|
fd022e2d86 | ||
|
|
f1c51cb19c | ||
|
|
f81653660b | ||
|
|
6345b93198 | ||
|
|
181965f303 | ||
|
|
3add966877 | ||
|
|
3eecdd27fe | ||
|
|
c29b43c80c | ||
|
|
482a6f9419 | ||
|
|
2e79e3b63d | ||
|
|
a30186cfa4 | ||
|
|
87d43ddffc | ||
|
|
ad513c1641 | ||
|
|
4268048ab8 | ||
|
|
5d9aeb3161 | ||
|
|
5e8b9152be | ||
|
|
c641e8e544 | ||
|
|
89630fc2bf | ||
|
|
d9b28783e8 | ||
|
|
de616f6d1b | ||
|
|
6bf1e7a681 | ||
|
|
7aec0e45bd | ||
|
|
d0ec03e28b | ||
|
|
dd17b055c6 | ||
|
|
dfa36aeb4c | ||
|
|
67970b9d94 | ||
|
|
d621fc8e25 | ||
|
|
85a9400ceb | ||
|
|
f6dcd3f891 | ||
|
|
37687b800e | ||
|
|
148c4840f3 | ||
|
|
7c79a7ca62 | ||
|
|
2beeb73e70 | ||
|
|
f47430a1c2 | ||
|
|
d2535c1da9 | ||
|
|
76443159e3 | ||
|
|
3378fd7b47 | ||
|
|
e4e1a1fda5 | ||
|
|
8be6df26ac | ||
|
|
5d251ae769 | ||
|
|
4b43a0f9c8 | ||
|
|
1a956992bd |
265
.travis.yml
Normal file
265
.travis.yml
Normal file
@@ -0,0 +1,265 @@
|
||||
# Copyright 2016 Peter Dimov
|
||||
# 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
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- BOGUS_JOB=true
|
||||
|
||||
matrix:
|
||||
|
||||
exclude:
|
||||
- env: BOGUS_JOB=true
|
||||
|
||||
include:
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++ CXXSTD=c++03
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++14
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++14
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.6
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.7
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++03
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++14
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: linux
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++03
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++11
|
||||
|
||||
- os: osx
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++14
|
||||
|
||||
install:
|
||||
- cd ..
|
||||
- git clone -b $TRAVIS_BRANCH https://github.com/boostorg/boost.git boost-root
|
||||
- cd boost-root
|
||||
- git submodule init libs/assert
|
||||
- git submodule init libs/config
|
||||
- git submodule init libs/predef
|
||||
- git submodule init libs/static_assert
|
||||
- git submodule init libs/type_traits
|
||||
- git submodule init tools/build
|
||||
- git submodule update
|
||||
- cp -r $TRAVIS_BUILD_DIR/* libs/core
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
|
||||
script:
|
||||
- |-
|
||||
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD ;" > ~/user-config.jam
|
||||
- ./b2 libs/core/test toolset=$TOOLSET
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: always
|
||||
11
README.md
11
README.md
@@ -8,6 +8,13 @@ The criteria for inclusion is that the utility component be:
|
||||
* used by other Boost libraries, and
|
||||
* not dependent on any other Boost modules except Core itself, Config, Assert, Static Assert, or Predef.
|
||||
|
||||
### CI Status
|
||||
|
||||
Branch | Travis | Appveyor
|
||||
---------|--------|---------
|
||||
Develop | [](https://travis-ci.org/boostorg/core) | [](https://ci.appveyor.com/project/pdimov/core)
|
||||
Master | [](https://travis-ci.org/boostorg/core) | [](https://ci.appveyor.com/project/pdimov/core)
|
||||
|
||||
### Directories
|
||||
|
||||
* **doc** - Documentation of the components
|
||||
@@ -16,7 +23,9 @@ The criteria for inclusion is that the utility component be:
|
||||
|
||||
### More information
|
||||
|
||||
* [Documentation](http://boostorg.github.io/core)
|
||||
* [Documentation](http://boost.org/libs/core)
|
||||
* [Report bugs](https://svn.boost.org/trac/boost/newticket?component=core;version=Boost%20Release%20Branch). Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
|
||||
* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
### License
|
||||
|
||||
|
||||
32
appveyor.yml
Normal file
32
appveyor.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright 2016 Peter Dimov
|
||||
# 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)
|
||||
|
||||
version: 1.0.{build}-{branch}
|
||||
|
||||
shallow_clone: true
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
|
||||
install:
|
||||
- cd ..
|
||||
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
|
||||
- cd boost-root
|
||||
- git submodule init libs/assert
|
||||
- git submodule init libs/config
|
||||
- git submodule init libs/predef
|
||||
- git submodule init libs/static_assert
|
||||
- git submodule init libs/type_traits
|
||||
- git submodule init tools/build
|
||||
- git submodule update
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\core
|
||||
- bootstrap
|
||||
- b2 headers
|
||||
|
||||
build: off
|
||||
|
||||
test_script:
|
||||
- b2 libs/core/test toolset=msvc-9.0,msvc-10.0,msvc-11.0,msvc-14.0
|
||||
@@ -51,3 +51,9 @@ boostbook standalone
|
||||
<xsl:param>toc.max.depth=1
|
||||
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/core/doc/html
|
||||
;
|
||||
|
||||
###############################################################################
|
||||
alias boostdoc ;
|
||||
explicit boostdoc ;
|
||||
alias boostrelease : standalone ;
|
||||
explicit boostrelease ;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* Brad King
|
||||
* Douglas Gregor
|
||||
* Peter Dimov
|
||||
* Glen Fernandes
|
||||
|
||||
[endsimplesect]
|
||||
|
||||
@@ -59,6 +60,19 @@ void f() {
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Notes]
|
||||
|
||||
In C++11 and above, `boost::addressof` is conditionally
|
||||
`constexpr` when possible. This is indicated by
|
||||
`BOOST_CORE_NO_CONSTEXPR_ADDRESSOF` not being defined.
|
||||
|
||||
With supported compilers, `boost::addressof` is always
|
||||
`constexpr` by leveraging compiler intrinsics. This is
|
||||
indicated by `BOOST_CORE_HAS_BUILTIN_ADDRESSOF` being
|
||||
defined.
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -304,6 +304,26 @@ depends on the template arguments of the class. Note that
|
||||
again, the second argument to `enable_if` is not needed; the
|
||||
default (`void`) is the correct value.
|
||||
|
||||
The `enable_if_has_type` template is usable this scenario but instead of
|
||||
using a type traits to enable or disable a specialization, it use a
|
||||
SFINAE context to check for the existence of a dependent type inside
|
||||
its parameter. For example, the following structure extracts a dependent
|
||||
`value_type` from T if and only if `T::value_type` exists.
|
||||
|
||||
``
|
||||
template <class T, class Enable = void>
|
||||
class value_type_from
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class value_type_from<T, typename enable_if_has_type<typename T::value_type>::type>
|
||||
{
|
||||
typedef typename T::value_type type;
|
||||
};
|
||||
``
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Overlapping enabler conditions]
|
||||
|
||||
@@ -32,9 +32,14 @@ When using `lightweight_test.hpp`, *do not forget* to
|
||||
|
||||
``
|
||||
#define BOOST_TEST(expression) /*unspecified*/
|
||||
#define BOOST_TEST_NOT(expression) /*unspecified*/
|
||||
#define BOOST_ERROR(message) /*unspecified*/
|
||||
#define BOOST_TEST_EQ(expr1, expr2) /*unspecified*/
|
||||
#define BOOST_TEST_NE(expr1, expr2) /*unspecified*/
|
||||
#define BOOST_TEST_CSTR_EQ(expr1, expr2) /*unspecified*/
|
||||
#define BOOST_TEST_CSTR_NE(expr1, expr2) /*unspecified*/
|
||||
#define BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2) /* unspecified */
|
||||
#define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) /* unspecified */
|
||||
#define BOOST_TEST_THROWS(expr, excep) /*unspecified*/
|
||||
|
||||
namespace boost
|
||||
@@ -56,6 +61,17 @@ message containing `expression`.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_TEST_NOT]
|
||||
|
||||
``
|
||||
BOOST_TEST_NOT(expression)
|
||||
``
|
||||
|
||||
If expression is true increases the error count and outputs a
|
||||
message containing `!(expression)`.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_ERROR]
|
||||
|
||||
``
|
||||
@@ -89,6 +105,46 @@ message containing both expressions.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_TEST_CSTR_EQ]
|
||||
|
||||
``
|
||||
BOOST_TEST_CSTR_EQ(expr1, expr2)
|
||||
``
|
||||
|
||||
Specialization of BOOST_TEST_EQ which interprets expr1 and expr2 as pointers to null-terminated byte strings (C strings). If `std::strcmp(expr1, expr2) != 0`, increase the error count and output a message containing both expressions.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_TEST_CSTR_NE]
|
||||
|
||||
``
|
||||
BOOST_TEST_CSTR_NE(expr1, expr2)
|
||||
``
|
||||
|
||||
Specialization of BOOST_TEST_NE which interprets expr1 and expr2 as pointers to null-terminated byte strings (C strings). If `std::strcmp(expr1, expr2) == 0`, increase the error count and output a message containing both expressions.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_TEST_ALL_EQ]
|
||||
|
||||
``
|
||||
BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2)
|
||||
``
|
||||
|
||||
Compares the content of two sequences. If they have different sizes, or if any pairwise element differs, increases the error count and outputs a message containing at most 8 differing elements.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_TEST_ALL_WITH]
|
||||
|
||||
``
|
||||
BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate)
|
||||
``
|
||||
|
||||
Compares the content of two sequences. If they have different sizes, or if any pairwise element do not fulfill the binary predicate, increases the error count and outputs a message containing at most 8 differing elements.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section BOOST_TEST_THROWS]
|
||||
|
||||
``
|
||||
|
||||
@@ -1,162 +1,265 @@
|
||||
// Copyright (C) 2002 Brad King (brad.king@kitware.com)
|
||||
// Douglas Gregor (gregod@cs.rpi.edu)
|
||||
//
|
||||
// Copyright (C) 2002, 2008, 2013 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)
|
||||
/*
|
||||
Copyright (C) 2002 Brad King (brad.king@kitware.com)
|
||||
Douglas Gregor (gregod@cs.rpi.edu)
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
Copyright (C) 2002, 2008, 2013 Peter Dimov
|
||||
|
||||
Copyright (C) 2017 Glen Joseph Fernandes (glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef BOOST_CORE_ADDRESSOF_HPP
|
||||
#define BOOST_CORE_ADDRESSOF_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
# include <cstddef>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost
|
||||
#if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215
|
||||
#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF
|
||||
#elif defined(BOOST_GCC) && BOOST_GCC >= 70000
|
||||
#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF
|
||||
#elif defined(__has_builtin)
|
||||
#if __has_builtin(__builtin_addressof)
|
||||
#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_CORE_HAS_BUILTIN_ADDRESSOF)
|
||||
#if defined(BOOST_NO_CXX11_CONSTEXPR)
|
||||
#define BOOST_CORE_NO_CONSTEXPR_ADDRESSOF
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
BOOST_CONSTEXPR inline T*
|
||||
addressof(T& o) BOOST_NOEXCEPT
|
||||
{
|
||||
return __builtin_addressof(o);
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class T> struct addr_impl_ref
|
||||
{
|
||||
T & v_;
|
||||
|
||||
BOOST_FORCEINLINE addr_impl_ref( T & v ): v_( v ) {}
|
||||
BOOST_FORCEINLINE operator T& () const { return v_; }
|
||||
|
||||
private:
|
||||
addr_impl_ref & operator=(const addr_impl_ref &);
|
||||
};
|
||||
|
||||
template<class T> struct addressof_impl
|
||||
{
|
||||
static BOOST_FORCEINLINE T * f( T & v, long )
|
||||
{
|
||||
return reinterpret_cast<T*>(
|
||||
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
|
||||
}
|
||||
|
||||
static BOOST_FORCEINLINE T * f( T * v, int )
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||
|
||||
#if defined( __clang__ ) && !defined( _LIBCPP_VERSION ) && !defined( BOOST_NO_CXX11_DECLTYPE )
|
||||
|
||||
typedef decltype(nullptr) addr_nullptr_t;
|
||||
|
||||
} /* boost */
|
||||
#else
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
typedef std::nullptr_t addr_nullptr_t;
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
class addressof_ref {
|
||||
public:
|
||||
BOOST_FORCEINLINE addressof_ref(T& o) BOOST_NOEXCEPT
|
||||
: o_(o) { }
|
||||
BOOST_FORCEINLINE operator T&() const BOOST_NOEXCEPT {
|
||||
return o_;
|
||||
}
|
||||
private:
|
||||
addressof_ref& operator=(const addressof_ref&);
|
||||
T& o_;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct address_of {
|
||||
static BOOST_FORCEINLINE T* get(T& o, long) BOOST_NOEXCEPT {
|
||||
return reinterpret_cast<T*>(&
|
||||
const_cast<char&>(reinterpret_cast<const volatile char&>(o)));
|
||||
}
|
||||
static BOOST_FORCEINLINE T* get(T* p, int) BOOST_NOEXCEPT {
|
||||
return p;
|
||||
}
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && \
|
||||
(defined(__INTEL_COMPILER) || \
|
||||
(defined(__clang__) && !defined(_LIBCPP_VERSION)))
|
||||
typedef decltype(nullptr) addressof_null_t;
|
||||
#else
|
||||
typedef std::nullptr_t addressof_null_t;
|
||||
#endif
|
||||
|
||||
template<> struct addressof_impl< addr_nullptr_t >
|
||||
{
|
||||
typedef addr_nullptr_t T;
|
||||
|
||||
static BOOST_FORCEINLINE T * f( T & v, int )
|
||||
{
|
||||
return &v;
|
||||
template<>
|
||||
struct address_of<addressof_null_t> {
|
||||
typedef addressof_null_t type;
|
||||
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||
return &o;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct addressof_impl< addr_nullptr_t const >
|
||||
{
|
||||
typedef addr_nullptr_t const T;
|
||||
|
||||
static BOOST_FORCEINLINE T * f( T & v, int )
|
||||
{
|
||||
return &v;
|
||||
template<>
|
||||
struct address_of<const addressof_null_t> {
|
||||
typedef const addressof_null_t type;
|
||||
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||
return &o;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct addressof_impl< addr_nullptr_t volatile >
|
||||
{
|
||||
typedef addr_nullptr_t volatile T;
|
||||
|
||||
static BOOST_FORCEINLINE T * f( T & v, int )
|
||||
{
|
||||
return &v;
|
||||
template<>
|
||||
struct address_of<volatile addressof_null_t> {
|
||||
typedef volatile addressof_null_t type;
|
||||
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||
return &o;
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct addressof_impl< addr_nullptr_t const volatile >
|
||||
{
|
||||
typedef addr_nullptr_t const volatile T;
|
||||
|
||||
static BOOST_FORCEINLINE T * f( T & v, int )
|
||||
{
|
||||
return &v;
|
||||
template<>
|
||||
struct address_of<const volatile addressof_null_t> {
|
||||
typedef const volatile addressof_null_t type;
|
||||
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||
return &o;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
} /* detail */
|
||||
|
||||
#if defined(BOOST_NO_CXX11_SFINAE_EXPR) || \
|
||||
defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
|
||||
defined(BOOST_NO_CXX11_CONSTEXPR) || \
|
||||
defined(BOOST_NO_CXX11_DECLTYPE)
|
||||
#define BOOST_CORE_NO_CONSTEXPR_ADDRESSOF
|
||||
|
||||
template<class T>
|
||||
BOOST_FORCEINLINE T*
|
||||
addressof(T& o) BOOST_NOEXCEPT
|
||||
{
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) || \
|
||||
BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5120)
|
||||
return detail::address_of<T>::get(o, 0);
|
||||
#else
|
||||
return detail::address_of<T>::get(detail::addressof_ref<T>(o), 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct addressof_result {
|
||||
typedef T* type;
|
||||
};
|
||||
|
||||
} /* detail */
|
||||
|
||||
template<class T, std::size_t N>
|
||||
BOOST_FORCEINLINE typename detail::addressof_result<T[N]>::type
|
||||
addressof(T (&o)[N]) BOOST_NOEXCEPT
|
||||
{
|
||||
return &o;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template<class T, std::size_t N>
|
||||
BOOST_FORCEINLINE
|
||||
T (*addressof(T (&o)[N]) BOOST_NOEXCEPT)[N]
|
||||
{
|
||||
return reinterpret_cast<T(*)[N]>(&o);
|
||||
}
|
||||
|
||||
template<class T, std::size_t N>
|
||||
BOOST_FORCEINLINE
|
||||
const T (*addressof(const T (&o)[N]) BOOST_NOEXCEPT)[N]
|
||||
{
|
||||
return reinterpret_cast<const T(*)[N]>(&o);
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
T&& addressof_declval() BOOST_NOEXCEPT;
|
||||
|
||||
template<class>
|
||||
struct addressof_void {
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template<class T, class E = void>
|
||||
struct addressof_member_operator {
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct addressof_member_operator<T, typename
|
||||
addressof_void<decltype(addressof_declval<T&>().operator&())>::type> {
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_INTEL, < 1600)
|
||||
struct addressof_addressable { };
|
||||
|
||||
addressof_addressable*
|
||||
operator&(addressof_addressable&) BOOST_NOEXCEPT;
|
||||
#endif
|
||||
|
||||
template<class T, class E = void>
|
||||
struct addressof_non_member_operator {
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct addressof_non_member_operator<T, typename
|
||||
addressof_void<decltype(operator&(addressof_declval<T&>()))>::type> {
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
template<class T, class E = void>
|
||||
struct addressof_expression {
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct addressof_expression<T,
|
||||
typename addressof_void<decltype(&addressof_declval<T&>())>::type> {
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct addressof_is_constexpr {
|
||||
static constexpr bool value = addressof_expression<T>::value &&
|
||||
!addressof_member_operator<T>::value &&
|
||||
!addressof_non_member_operator<T>::value;
|
||||
};
|
||||
|
||||
template<bool E, class T>
|
||||
struct addressof_if { };
|
||||
|
||||
template<class T>
|
||||
struct addressof_if<true, T> {
|
||||
typedef T* type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
BOOST_FORCEINLINE
|
||||
T * addressof( T & v )
|
||||
typename addressof_if<!addressof_is_constexpr<T>::value, T>::type
|
||||
addressof(T& o) BOOST_NOEXCEPT
|
||||
{
|
||||
#if (defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) ) || defined( __SUNPRO_CC )
|
||||
|
||||
return boost::detail::addressof_impl<T>::f( v, 0 );
|
||||
|
||||
#else
|
||||
|
||||
return boost::detail::addressof_impl<T>::f( boost::detail::addr_impl_ref<T>( v ), 0 );
|
||||
|
||||
#endif
|
||||
return address_of<T>::get(addressof_ref<T>(o), 0);
|
||||
}
|
||||
|
||||
#if defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, BOOST_TESTED_AT( 0x590 ) )
|
||||
|
||||
namespace detail
|
||||
template<class T>
|
||||
constexpr BOOST_FORCEINLINE
|
||||
typename addressof_if<addressof_is_constexpr<T>::value, T>::type
|
||||
addressof(T& o) BOOST_NOEXCEPT
|
||||
{
|
||||
|
||||
template<class T> struct addressof_addp
|
||||
{
|
||||
typedef T * type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template< class T, std::size_t N >
|
||||
BOOST_FORCEINLINE
|
||||
typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] )
|
||||
{
|
||||
return &t;
|
||||
return &o;
|
||||
}
|
||||
|
||||
#endif
|
||||
} /* detail */
|
||||
|
||||
// Borland doesn't like casting an array reference to a char reference
|
||||
// but these overloads work around the problem.
|
||||
#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template<typename T,std::size_t N>
|
||||
BOOST_FORCEINLINE
|
||||
T (*addressof(T (&t)[N]))[N]
|
||||
template<class T>
|
||||
constexpr BOOST_FORCEINLINE T*
|
||||
addressof(T& o) BOOST_NOEXCEPT
|
||||
{
|
||||
return reinterpret_cast<T(*)[N]>(&t);
|
||||
}
|
||||
|
||||
template<typename T,std::size_t N>
|
||||
BOOST_FORCEINLINE
|
||||
const T (*addressof(const T (&t)[N]))[N]
|
||||
{
|
||||
return reinterpret_cast<const T(*)[N]>(&t);
|
||||
return detail::addressof(o);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
} /* boost */
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CORE_ADDRESSOF_HPP
|
||||
#endif
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined( __clang__ ) && defined( __has_include )
|
||||
// __has_include is currently supported by GCC and Clang. However GCC 4.9 may have issues and
|
||||
// returns 1 for 'defined( __has_include )', while '__has_include' is actually not supported:
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63662
|
||||
#if defined( __has_include ) && (!defined( BOOST_GCC ) || (__GNUC__ + 0) >= 5)
|
||||
# if __has_include(<cxxabi.h>)
|
||||
# define BOOST_CORE_HAS_CXXABI_H
|
||||
# endif
|
||||
@@ -27,8 +30,15 @@
|
||||
|
||||
#if defined( BOOST_CORE_HAS_CXXABI_H )
|
||||
# include <cxxabi.h>
|
||||
# include <cstdlib>
|
||||
# include <cstddef>
|
||||
// For some archtectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library
|
||||
// (https://android.googlesource.com/platform/ndk/+/master/sources/cxx-stl/gabi++/), which does not implement
|
||||
// abi::__cxa_demangle(). We detect this implementation by checking the include guard here.
|
||||
# if defined( __GABIXX_CXXABI_H__ )
|
||||
# undef BOOST_CORE_HAS_CXXABI_H
|
||||
# else
|
||||
# include <cstdlib>
|
||||
# include <cstddef>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
@@ -83,15 +93,10 @@ inline void demangle_free( char const * name ) BOOST_NOEXCEPT
|
||||
inline std::string demangle( char const * name )
|
||||
{
|
||||
scoped_demangled_name demangled_name( name );
|
||||
char const * const p = demangled_name.get();
|
||||
if( p )
|
||||
{
|
||||
return p;
|
||||
}
|
||||
else
|
||||
{
|
||||
return name;
|
||||
}
|
||||
char const * p = demangled_name.get();
|
||||
if( !p )
|
||||
p = name;
|
||||
return p;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<typename T, typename R=void>
|
||||
struct enable_if_has_type
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
template <bool B, class T = void>
|
||||
struct enable_if_c {
|
||||
@@ -80,6 +85,10 @@ namespace boost {
|
||||
template <typename T>
|
||||
struct enable_if_does_not_work_on_this_compiler;
|
||||
|
||||
template<typename T, typename R=void>
|
||||
struct enable_if_has_type : enable_if_does_not_work_on_this_compiler<T>
|
||||
{ };
|
||||
|
||||
template <bool B, class T = detail::enable_if_default_T>
|
||||
struct enable_if_c : enable_if_does_not_work_on_this_compiler<T>
|
||||
{ };
|
||||
|
||||
@@ -14,53 +14,53 @@ namespace boost {
|
||||
#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
|
||||
template <typename... Ts>
|
||||
inline void ignore_unused(Ts const& ...)
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(Ts const& ...)
|
||||
{}
|
||||
|
||||
template <typename... Ts>
|
||||
inline void ignore_unused()
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
|
||||
{}
|
||||
|
||||
#else
|
||||
|
||||
template <typename T1>
|
||||
inline void ignore_unused(T1 const&)
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&)
|
||||
{}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
inline void ignore_unused(T1 const&, T2 const&)
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&)
|
||||
{}
|
||||
|
||||
template <typename T1, typename T2, typename T3>
|
||||
inline void ignore_unused(T1 const&, T2 const&, T3 const&)
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&)
|
||||
{}
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4>
|
||||
inline void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&)
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&)
|
||||
{}
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
inline void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&, T5 const&)
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&, T5 const&)
|
||||
{}
|
||||
|
||||
template <typename T1>
|
||||
inline void ignore_unused()
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
|
||||
{}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
inline void ignore_unused()
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
|
||||
{}
|
||||
|
||||
template <typename T1, typename T2, typename T3>
|
||||
inline void ignore_unused()
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
|
||||
{}
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4>
|
||||
inline void ignore_unused()
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
|
||||
{}
|
||||
|
||||
template <typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
inline void ignore_unused()
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
|
||||
{}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
// IDE's like Visual Studio perform better if output goes to std::cout or
|
||||
// some other stream, so allow user to configure output stream:
|
||||
@@ -85,6 +87,32 @@ inline void throw_failed_impl(char const * excep, char const * file, int line, c
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
// In the comparisons below, it is possible that T and U are signed and unsigned integer types, which generates warnings in some compilers.
|
||||
// A cleaner fix would require common_type trait or some meta-programming, which would introduce a dependency on Boost.TypeTraits. To avoid
|
||||
// the dependency we just disable the warnings.
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4389)
|
||||
#elif defined(__clang__) && defined(__has_warning)
|
||||
# if __has_warning("-Wsign-compare")
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wsign-compare"
|
||||
# endif
|
||||
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#endif
|
||||
|
||||
// specialize test output for char pointers to avoid printing as cstring
|
||||
template <class T> inline const T& test_output_impl(const T& v) { return v; }
|
||||
inline const void* test_output_impl(const char* v) { return v; }
|
||||
inline const void* test_output_impl(const unsigned char* v) { return v; }
|
||||
inline const void* test_output_impl(const signed char* v) { return v; }
|
||||
inline const void* test_output_impl(char* v) { return v; }
|
||||
inline const void* test_output_impl(unsigned char* v) { return v; }
|
||||
inline const void* test_output_impl(signed char* v) { return v; }
|
||||
template<class T> inline const void* test_output_impl(T volatile* v) { return const_cast<T*>(v); }
|
||||
|
||||
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, T const & t, U const & u )
|
||||
{
|
||||
@@ -97,7 +125,7 @@ template<class T, class U> inline void test_eq_impl( char const * expr1, char co
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << t << "' != '" << u << "'" << std::endl;
|
||||
<< "'" << test_output_impl(t) << "' != '" << test_output_impl(u) << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
@@ -114,18 +142,199 @@ template<class T, class U> inline void test_ne_impl( char const * expr1, char co
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " != " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << test_output_impl(t) << "' == '" << test_output_impl(u) << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
inline void test_cstr_eq_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, char const * const t, char const * const u )
|
||||
{
|
||||
if( std::strcmp(t, u) == 0 )
|
||||
{
|
||||
report_errors_remind();
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << t << "' != '" << u << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
inline void test_cstr_ne_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, char const * const t, char const * const u )
|
||||
{
|
||||
if( std::strcmp(t, u) != 0 )
|
||||
{
|
||||
report_errors_remind();
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << t << "' == '" << u << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
template<class FormattedOutputFunction, class InputIterator1, class InputIterator2>
|
||||
void test_all_eq_impl(FormattedOutputFunction& output,
|
||||
char const * file, int line, char const * function,
|
||||
InputIterator1 first_begin, InputIterator1 first_end,
|
||||
InputIterator2 second_begin, InputIterator2 second_end)
|
||||
{
|
||||
InputIterator1 first_it = first_begin;
|
||||
InputIterator2 second_it = second_begin;
|
||||
typename std::iterator_traits<InputIterator1>::difference_type first_index = 0;
|
||||
typename std::iterator_traits<InputIterator2>::difference_type second_index = 0;
|
||||
std::size_t error_count = 0;
|
||||
const std::size_t max_count = 8;
|
||||
do
|
||||
{
|
||||
while ((first_it != first_end) && (second_it != second_end) && (*first_it == *second_it))
|
||||
{
|
||||
++first_it;
|
||||
++second_it;
|
||||
++first_index;
|
||||
++second_index;
|
||||
}
|
||||
if ((first_it == first_end) || (second_it == second_end))
|
||||
{
|
||||
break; // do-while
|
||||
}
|
||||
if (error_count == 0)
|
||||
{
|
||||
output << file << "(" << line << "): Container contents differ in function '" << function << "':";
|
||||
}
|
||||
else if (error_count >= max_count)
|
||||
{
|
||||
output << " ...";
|
||||
break;
|
||||
}
|
||||
output << " [" << first_index << "] '" << test_output_impl(*first_it) << "' != '" << test_output_impl(*second_it) << "'";
|
||||
++first_it;
|
||||
++second_it;
|
||||
++first_index;
|
||||
++second_index;
|
||||
++error_count;
|
||||
} while (first_it != first_end);
|
||||
|
||||
first_index += std::distance(first_it, first_end);
|
||||
second_index += std::distance(second_it, second_end);
|
||||
if (first_index != second_index)
|
||||
{
|
||||
if (error_count == 0)
|
||||
{
|
||||
output << file << "(" << line << "): Container sizes differ in function '" << function << "': size(" << first_index << ") != size(" << second_index << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
output << " [*] size(" << first_index << ") != size(" << second_index << ")";
|
||||
}
|
||||
++error_count;
|
||||
}
|
||||
|
||||
if (error_count == 0)
|
||||
{
|
||||
boost::detail::report_errors_remind();
|
||||
}
|
||||
else
|
||||
{
|
||||
output << std::endl;
|
||||
++boost::detail::test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
template<class FormattedOutputFunction, class InputIterator1, class InputIterator2, typename BinaryPredicate>
|
||||
void test_all_with_impl(FormattedOutputFunction& output,
|
||||
char const * file, int line, char const * function,
|
||||
InputIterator1 first_begin, InputIterator1 first_end,
|
||||
InputIterator2 second_begin, InputIterator2 second_end,
|
||||
BinaryPredicate predicate)
|
||||
{
|
||||
InputIterator1 first_it = first_begin;
|
||||
InputIterator2 second_it = second_begin;
|
||||
typename std::iterator_traits<InputIterator1>::difference_type first_index = 0;
|
||||
typename std::iterator_traits<InputIterator2>::difference_type second_index = 0;
|
||||
std::size_t error_count = 0;
|
||||
const std::size_t max_count = 8;
|
||||
do
|
||||
{
|
||||
while ((first_it != first_end) && (second_it != second_end) && predicate(*first_it, *second_it))
|
||||
{
|
||||
++first_it;
|
||||
++second_it;
|
||||
++first_index;
|
||||
++second_index;
|
||||
}
|
||||
if ((first_it == first_end) || (second_it == second_end))
|
||||
{
|
||||
break; // do-while
|
||||
}
|
||||
if (error_count == 0)
|
||||
{
|
||||
output << file << "(" << line << "): Container contents differ in function '" << function << "':";
|
||||
}
|
||||
else if (error_count >= max_count)
|
||||
{
|
||||
output << " ...";
|
||||
break;
|
||||
}
|
||||
output << " [" << first_index << "]";
|
||||
++first_it;
|
||||
++second_it;
|
||||
++first_index;
|
||||
++second_index;
|
||||
++error_count;
|
||||
} while (first_it != first_end);
|
||||
|
||||
first_index += std::distance(first_it, first_end);
|
||||
second_index += std::distance(second_it, second_end);
|
||||
if (first_index != second_index)
|
||||
{
|
||||
if (error_count == 0)
|
||||
{
|
||||
output << file << "(" << line << "): Container sizes differ in function '" << function << "': size(" << first_index << ") != size(" << second_index << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
output << " [*] size(" << first_index << ") != size(" << second_index << ")";
|
||||
}
|
||||
++error_count;
|
||||
}
|
||||
|
||||
if (error_count == 0)
|
||||
{
|
||||
report_errors_remind();
|
||||
}
|
||||
else
|
||||
{
|
||||
output << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#elif defined(__clang__) && defined(__has_warning)
|
||||
# if __has_warning("-Wsign-compare")
|
||||
# pragma clang diagnostic pop
|
||||
# endif
|
||||
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
inline int report_errors()
|
||||
{
|
||||
detail::report_errors_remind().called_report_errors_function = true;
|
||||
boost::detail::report_errors_remind().called_report_errors_function = true;
|
||||
|
||||
int errors = detail::test_errors();
|
||||
int errors = boost::detail::test_errors();
|
||||
|
||||
if( errors == 0 )
|
||||
{
|
||||
@@ -144,12 +353,19 @@ inline int report_errors()
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
|
||||
#define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr))
|
||||
|
||||
#define BOOST_ERROR(msg) ( ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
|
||||
|
||||
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
|
||||
#define BOOST_TEST_CSTR_EQ(expr1,expr2) ( ::boost::detail::test_cstr_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
#define BOOST_TEST_CSTR_NE(expr1,expr2) ( ::boost::detail::test_cstr_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
|
||||
#define BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2) ( ::boost::detail::test_all_eq_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2) )
|
||||
#define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) ( ::boost::detail::test_all_with_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2, predicate) )
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#define BOOST_TEST_THROWS( EXPR, EXCEP ) \
|
||||
try { \
|
||||
|
||||
@@ -43,7 +43,8 @@ namespace boost
|
||||
* @throws No-throws.
|
||||
*/
|
||||
template <typename UnderlyingType, typename EnumType>
|
||||
UnderlyingType underlying_cast(EnumType v)
|
||||
inline
|
||||
BOOST_CONSTEXPR UnderlyingType underlying_cast(EnumType v) BOOST_NOEXCEPT
|
||||
{
|
||||
return v.get_underlying_value_();
|
||||
}
|
||||
@@ -61,7 +62,7 @@ namespace boost
|
||||
*/
|
||||
template <typename EnumType>
|
||||
inline
|
||||
typename EnumType::enum_type native_value(EnumType e)
|
||||
BOOST_CONSTEXPR typename EnumType::enum_type native_value(EnumType e) BOOST_NOEXCEPT
|
||||
{
|
||||
return e.get_native_value_();
|
||||
}
|
||||
@@ -75,14 +76,15 @@ namespace boost
|
||||
};
|
||||
|
||||
template <typename UnderlyingType, typename EnumType>
|
||||
UnderlyingType underlying_cast(EnumType v)
|
||||
inline
|
||||
BOOST_CONSTEXPR UnderlyingType underlying_cast(EnumType v) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast<UnderlyingType>(v);
|
||||
}
|
||||
|
||||
template <typename EnumType>
|
||||
inline
|
||||
EnumType native_value(EnumType e)
|
||||
BOOST_CONSTEXPR EnumType native_value(EnumType e) BOOST_NOEXCEPT
|
||||
{
|
||||
return e;
|
||||
}
|
||||
@@ -96,7 +98,7 @@ namespace boost
|
||||
#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
|
||||
#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
|
||||
explicit operator underlying_type() const BOOST_NOEXCEPT { return get_underlying_value_(); }
|
||||
explicit BOOST_CONSTEXPR operator underlying_type() const BOOST_NOEXCEPT { return get_underlying_value_(); }
|
||||
|
||||
#else
|
||||
|
||||
@@ -115,8 +117,8 @@ namespace boost
|
||||
typedef void is_boost_scoped_enum_tag; \
|
||||
typedef UnderlyingType underlying_type; \
|
||||
EnumType() BOOST_NOEXCEPT {} \
|
||||
explicit EnumType(underlying_type v) BOOST_NOEXCEPT : v_(v) {} \
|
||||
underlying_type get_underlying_value_() const BOOST_NOEXCEPT { return v_; } \
|
||||
explicit BOOST_CONSTEXPR EnumType(underlying_type v) BOOST_NOEXCEPT : v_(v) {} \
|
||||
BOOST_CONSTEXPR underlying_type get_underlying_value_() const BOOST_NOEXCEPT { return v_; } \
|
||||
BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
|
||||
private: \
|
||||
underlying_type v_; \
|
||||
@@ -125,30 +127,30 @@ namespace boost
|
||||
enum enum_type
|
||||
|
||||
#define BOOST_SCOPED_ENUM_DECLARE_END2() \
|
||||
enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \
|
||||
friend bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \
|
||||
friend bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \
|
||||
friend bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \
|
||||
friend bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \
|
||||
friend bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \
|
||||
friend bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \
|
||||
friend bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<enum_type(rhs.v_); } \
|
||||
friend bool operator <(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<rhs; } \
|
||||
friend bool operator <(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<enum_type(rhs.v_); } \
|
||||
friend bool operator <=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=enum_type(rhs.v_); } \
|
||||
friend bool operator <=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=rhs; } \
|
||||
friend bool operator <=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<=enum_type(rhs.v_); } \
|
||||
friend bool operator >(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \
|
||||
friend bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \
|
||||
friend bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \
|
||||
friend bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \
|
||||
friend bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \
|
||||
friend bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \
|
||||
BOOST_CONSTEXPR enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \
|
||||
friend BOOST_CONSTEXPR bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \
|
||||
friend BOOST_CONSTEXPR bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator <(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<rhs; } \
|
||||
friend BOOST_CONSTEXPR bool operator <(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator <=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator <=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=rhs; } \
|
||||
friend BOOST_CONSTEXPR bool operator <=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<=enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator >(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \
|
||||
friend BOOST_CONSTEXPR bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \
|
||||
friend BOOST_CONSTEXPR bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \
|
||||
friend BOOST_CONSTEXPR bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \
|
||||
};
|
||||
|
||||
#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) \
|
||||
; \
|
||||
EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {} \
|
||||
BOOST_CONSTEXPR EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {} \
|
||||
BOOST_SCOPED_ENUM_DECLARE_END2()
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,8 +65,8 @@ struct underlying_type_impl
|
||||
*
|
||||
* Requires EnumType must be an enum type or the emulation of a scoped enum.
|
||||
* If BOOST_NO_UNDERLYING_TYPE is defined, the implementation will not be able
|
||||
* to deduce the underlying type of enums. The used is expected to specialize
|
||||
* this trait.
|
||||
* to deduce the underlying type of enums. The user is expected to specialize
|
||||
* this trait in this case.
|
||||
*/
|
||||
template< typename EnumType >
|
||||
struct underlying_type :
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
// This header is obsolete and will be deprecated.
|
||||
|
||||
#include <iterator>
|
||||
#if defined(__SUNPRO_CC) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
#include <cstddef>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -19,6 +22,16 @@ namespace detail
|
||||
using std::iterator_traits;
|
||||
using std::distance;
|
||||
|
||||
#if defined(__SUNPRO_CC) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
// std::distance from stlport with Oracle compiler 12.4 and 12.5 fails to deduce template parameters
|
||||
// when one of the arguments is an array and the other one is a pointer.
|
||||
template< typename T, std::size_t N >
|
||||
inline typename std::iterator_traits< T* >::difference_type distance(T (&left)[N], T* right)
|
||||
{
|
||||
return std::distance(static_cast< T* >(left), right);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
@@ -24,11 +24,39 @@ template<class T> T * get_pointer(T * p)
|
||||
|
||||
// get_pointer(shared_ptr<T> const & p) has been moved to shared_ptr.hpp
|
||||
|
||||
#if !defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
#if defined( __GNUC__ ) && (defined( __GXX_EXPERIMENTAL_CXX0X__ ) || (__cplusplus >= 201103L))
|
||||
#if defined( BOOST_GCC )
|
||||
#if BOOST_GCC >= 40600
|
||||
#define BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS
|
||||
#endif // BOOST_GCC >= 40600
|
||||
#elif defined( __clang__ ) && defined( __has_warning )
|
||||
#if __has_warning("-Wdeprecated-declarations")
|
||||
#define BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS
|
||||
#endif // __has_warning("-Wdeprecated-declarations")
|
||||
#endif
|
||||
#endif // defined( __GNUC__ ) && (defined( __GXX_EXPERIMENTAL_CXX0X__ ) || (__cplusplus >= 201103L))
|
||||
|
||||
#if defined( BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS )
|
||||
// Disable libstdc++ warnings about std::auto_ptr being deprecated in C++11 mode
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#define BOOST_CORE_DETAIL_DISABLED_DEPRECATED_WARNINGS
|
||||
#endif
|
||||
|
||||
template<class T> T * get_pointer(std::auto_ptr<T> const& p)
|
||||
{
|
||||
return p.get();
|
||||
}
|
||||
|
||||
#if defined( BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS )
|
||||
#pragma GCC diagnostic pop
|
||||
#undef BOOST_CORE_DETAIL_DISABLE_LIBSTDCXX_DEPRECATED_WARNINGS
|
||||
#endif
|
||||
|
||||
#endif // !defined( BOOST_NO_AUTO_PTR )
|
||||
|
||||
#if !defined( BOOST_NO_CXX11_SMART_PTR )
|
||||
|
||||
template<class T> T * get_pointer( std::unique_ptr<T> const& p )
|
||||
|
||||
@@ -17,6 +17,24 @@
|
||||
"Miscellaneous"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "utility/enable_if",
|
||||
"name": "Enable If",
|
||||
"authors": [
|
||||
"Jaakko J\u00e4rvi",
|
||||
"Jeremiah Willcock",
|
||||
"Andrew Lumsdaine"
|
||||
],
|
||||
"description": "Selective inclusion of function template overloads.",
|
||||
"documentation": "doc/html/core/enable_if.html",
|
||||
"category": [
|
||||
"Generic"
|
||||
],
|
||||
"maintainers": [
|
||||
"Jaakko Jarvi <jarvi -at- cs.tamu.edu>",
|
||||
"Jeremiah Willcock <jewillco -at- osl.iu.edu>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "utility/swap",
|
||||
"boost-version": "1.38.0",
|
||||
@@ -32,5 +50,23 @@
|
||||
"maintainers": [
|
||||
"Joseph Gauterin <joseph.gauterin -at- googlemail.com>"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "bind/ref",
|
||||
"name": "Ref",
|
||||
"authors": [
|
||||
"Jaako Järvi",
|
||||
"Peter Dimov",
|
||||
"Doug Gregor",
|
||||
"Dave Abrahams"
|
||||
],
|
||||
"description": "A utility library for passing references to generic functions.",
|
||||
"documentation": "ref.html",
|
||||
"std": [
|
||||
"tr1"
|
||||
],
|
||||
"category": [
|
||||
"Function-objects"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
29
ref.html
Normal file
29
ref.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Boost.Core</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0; url=doc/html/core/ref.html">
|
||||
<style>
|
||||
body {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
}
|
||||
a {
|
||||
color: #00f;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
Automatic redirection failed, please go to
|
||||
<a href="doc/html/core/ref.html">doc/html/core/ref.html</a>
|
||||
</p>
|
||||
<p>
|
||||
© 2014 Peter Dimov<br>
|
||||
© 2014 Glen Fernandes<br>
|
||||
© 2014 Andrey Semashev
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -6,12 +6,14 @@
|
||||
# See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
import modules ;
|
||||
import testing ;
|
||||
|
||||
run addressof_test.cpp ;
|
||||
run addressof_test2.cpp ;
|
||||
run addressof_np_test.cpp ;
|
||||
run addressof_fn_test.cpp ;
|
||||
compile addressof_constexpr_test.cpp ;
|
||||
|
||||
run checked_delete_test.cpp ;
|
||||
compile-fail checked_delete_fail.cpp ;
|
||||
@@ -28,6 +30,7 @@ compile-fail ref_rv_fail4.cpp ;
|
||||
compile-fail ref_rv_fail5.cpp ;
|
||||
compile-fail ref_implicit_fail.cpp ;
|
||||
compile-fail ref_implicit_fail2.cpp ;
|
||||
run ref_cv_test.cpp ;
|
||||
|
||||
run eif_constructors.cpp ;
|
||||
run eif_dummy_arg_disambiguation.cpp ;
|
||||
@@ -62,6 +65,9 @@ run lightweight_test_test.cpp ;
|
||||
run lightweight_test_test.cpp : : : <exception-handling>off : lightweight_test_test_no_except ;
|
||||
|
||||
run lightweight_test_test2.cpp ;
|
||||
run lightweight_test_all_eq_test.cpp ;
|
||||
run lightweight_test_all_with_test.cpp ;
|
||||
run lightweight_test_all_with_fail.cpp ;
|
||||
|
||||
run-fail lightweight_test_fail.cpp ;
|
||||
run-fail lightweight_test_fail2.cpp ;
|
||||
@@ -73,6 +79,8 @@ run-fail lightweight_test_fail7.cpp ;
|
||||
run-fail lightweight_test_fail7.cpp : : : <rtti>off : lightweight_test_fail7_no_rtti ;
|
||||
run-fail lightweight_test_fail8.cpp ;
|
||||
run-fail lightweight_test_fail8.cpp : : : <rtti>off : lightweight_test_fail8_no_rtti ;
|
||||
run-fail lightweight_test_fail9.cpp ;
|
||||
run-fail lightweight_test_fail10.cpp ;
|
||||
|
||||
run is_same_test.cpp ;
|
||||
|
||||
@@ -92,3 +100,6 @@ compile-fail scoped_enum_compile_fail_conv_from_int.cpp ;
|
||||
compile-fail scoped_enum_compile_fail_conv_to_int.cpp ;
|
||||
|
||||
run underlying_type.cpp ;
|
||||
|
||||
use-project /boost/core/swap : ./swap ;
|
||||
build-project ./swap ;
|
||||
|
||||
21
test/addressof_constexpr_test.cpp
Normal file
21
test/addressof_constexpr_test.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
Copyright 2017 Glen Joseph Fernandes
|
||||
<glenjofe -at- gmail.com>
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
*/
|
||||
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#if !defined(BOOST_CORE_NO_CONSTEXPR_ADDRESSOF)
|
||||
struct Type { };
|
||||
|
||||
static int v1 = 0;
|
||||
static Type v2 = { };
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::addressof(v1) == &v1);
|
||||
BOOST_STATIC_ASSERT(boost::addressof(v2) == &v2);
|
||||
#endif
|
||||
@@ -10,6 +10,7 @@
|
||||
//
|
||||
|
||||
#include <boost/core/demangle.hpp>
|
||||
#include <typeinfo>
|
||||
#include <iostream>
|
||||
|
||||
template<class T1, class T2> struct Y1
|
||||
|
||||
@@ -10,16 +10,19 @@
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using boost::enable_if;
|
||||
using boost::mpl::not_;
|
||||
using boost::is_arithmetic;
|
||||
|
||||
template<class T> struct not_
|
||||
{
|
||||
BOOST_STATIC_CONSTANT( bool, value = !T::value );
|
||||
};
|
||||
|
||||
namespace A {
|
||||
template<class T>
|
||||
typename enable_if<is_arithmetic<T>, bool>::type
|
||||
|
||||
@@ -10,16 +10,19 @@
|
||||
// Jeremiah Willcock (jewillco at osl.iu.edu)
|
||||
// Andrew Lumsdaine (lums at osl.iu.edu)
|
||||
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using boost::mpl::not_;
|
||||
using boost::enable_if;
|
||||
using boost::is_arithmetic;
|
||||
|
||||
template<class T> struct not_
|
||||
{
|
||||
BOOST_STATIC_CONSTANT( bool, value = !T::value );
|
||||
};
|
||||
|
||||
template<class T>
|
||||
typename enable_if<is_arithmetic<T>, bool>::type
|
||||
arithmetic_object(T t) { return true; }
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
using boost::enable_if_has_type;
|
||||
using boost::enable_if_c;
|
||||
using boost::disable_if_c;
|
||||
using boost::enable_if;
|
||||
@@ -46,9 +47,28 @@ struct tester2<T, typename disable_if<is_arithmetic<T> >::type> {
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template <class T, class Enable = void>
|
||||
struct tester3
|
||||
{
|
||||
typedef T type;
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct tester3<T, typename enable_if_has_type<typename T::value_type>::type>
|
||||
{
|
||||
typedef typename T::value_type type;
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
};
|
||||
|
||||
struct sample_value_type
|
||||
{
|
||||
typedef float***& value_type;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
|
||||
BOOST_TEST(tester<int>::value);
|
||||
BOOST_TEST(tester<double>::value);
|
||||
|
||||
@@ -61,6 +81,9 @@ int main()
|
||||
BOOST_TEST(!tester2<char*>::value);
|
||||
BOOST_TEST(!tester2<void*>::value);
|
||||
|
||||
BOOST_TEST(!tester3<char*>::value);
|
||||
BOOST_TEST(tester3<sample_value_type>::value);
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ int main(int, char*[])
|
||||
{
|
||||
checkable val;
|
||||
int n = val;
|
||||
(void)n;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ int main(int, char*[])
|
||||
{
|
||||
checkable val;
|
||||
void* p = val;
|
||||
(void)p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -27,10 +27,12 @@ int main()
|
||||
delete p;
|
||||
}
|
||||
|
||||
#if !defined( BOOST_NO_AUTO_PTR )
|
||||
{
|
||||
std::auto_ptr< X > p( new X );
|
||||
BOOST_TEST( get_pointer( p ) == p.get() );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_NO_CXX11_SMART_PTR )
|
||||
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
BOOST_CXX14_CONSTEXPR int test_fun(int a)
|
||||
{
|
||||
boost::ignore_unused(a);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@@ -60,5 +66,10 @@ int main()
|
||||
boost::ignore_unused<a, b, c, d, e>();
|
||||
}
|
||||
|
||||
{
|
||||
BOOST_CXX14_CONSTEXPR const int a = test_fun(0);
|
||||
boost::ignore_unused(a);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
126
test/lightweight_test_all_eq_test.cpp
Normal file
126
test/lightweight_test_all_eq_test.cpp
Normal file
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// Negative test for BOOST_TEST_ALL_EQ
|
||||
//
|
||||
// Copyright (c) 2017 Bjorn Reese
|
||||
//
|
||||
// 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 <vector>
|
||||
#include <set>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int test_cases = 0;
|
||||
|
||||
// Array
|
||||
|
||||
{
|
||||
int x[] = { 1 };
|
||||
int y[] = { 1, 2 };
|
||||
BOOST_TEST_ALL_EQ( x, x + sizeof(x)/sizeof(x[0]), y, y + sizeof(y)/sizeof(y[0]) );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
int x[] = { 1, 2 };
|
||||
int y[] = { 1 };
|
||||
BOOST_TEST_ALL_EQ( x, x + sizeof(x)/sizeof(x[0]), y, y + sizeof(y)/sizeof(y[0]) );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
int x[] = { 2 };
|
||||
int y[] = { 1, 2 };
|
||||
BOOST_TEST_ALL_EQ( x, x + sizeof(x)/sizeof(x[0]), y, y + sizeof(y)/sizeof(y[0]) );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
int x[] = { 1, 2, 3, 4 };
|
||||
int y[] = { 1, 3, 2, 4 };
|
||||
BOOST_TEST_ALL_EQ( x, x + sizeof(x)/sizeof(x[0]), y, y + sizeof(y)/sizeof(y[0]) );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
// Vector
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 );
|
||||
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
y.push_back( 1 );
|
||||
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 ); x.push_back( 4 );
|
||||
y.push_back( 1 ); y.push_back( 3 ); y.push_back( 2 ); y.push_back( 4 );
|
||||
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<float> x, y;
|
||||
x.push_back( 1.0f ); x.push_back( 2.0f ); x.push_back( 3.0f ); x.push_back( 4.0f );
|
||||
y.push_back( 4.0f ); y.push_back( 2.0f ); y.push_back( 3.0f ); y.push_back( 1.0f );
|
||||
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 );
|
||||
y.push_back( 1 ); y.push_back( 3 ); y.push_back( 2 ); y.push_back( 4 );
|
||||
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 ); x.push_back( 4 );
|
||||
y.push_back( 1 ); y.push_back( 3 ); y.push_back( 2 );;
|
||||
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
// Set
|
||||
|
||||
{
|
||||
std::set<int> x, y;
|
||||
x.insert(1);
|
||||
y.insert(1); y.insert(3);
|
||||
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::set<int> x, y;
|
||||
x.insert(1); x.insert(2);
|
||||
y.insert(1);
|
||||
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::set<int> x, y;
|
||||
x.insert(1); x.insert(2);
|
||||
y.insert(1); y.insert(3);
|
||||
BOOST_TEST_ALL_EQ( x.begin(), x.end(), y.begin(), y.end() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
boost::report_errors();
|
||||
|
||||
return boost::detail::test_errors() != test_cases;
|
||||
}
|
||||
107
test/lightweight_test_all_with_fail.cpp
Normal file
107
test/lightweight_test_all_with_fail.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// Negative est for BOOST_TEST_ALL_WITH
|
||||
//
|
||||
// Copyright (c) 2017 Bjorn Reese
|
||||
//
|
||||
// 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 <cmath>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int fail_vector()
|
||||
{
|
||||
int test_cases = 0;
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), std::equal_to<int>() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
y.push_back( 1 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), std::equal_to<int>() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 ); x.push_back( 4 );
|
||||
y.push_back( 1 ); y.push_back( 2 ); y.push_back( 3 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), std::equal_to<int>() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 );
|
||||
y.push_back( 1 ); y.push_back( 2 ); y.push_back( 3 ); y.push_back( 4 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), std::equal_to<int>() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 ); x.push_back( 4 );
|
||||
y.push_back( 1 ); y.push_back( 3 ); y.push_back( 2 ); y.push_back( 4 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), std::equal_to<int>() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 ); x.push_back( 4 );
|
||||
y.push_back( 1 ); y.push_back( 3 ); y.push_back( 2 ); y.push_back( 4 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), std::less<int>() );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
return test_cases;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct with_tolerance
|
||||
{
|
||||
with_tolerance(T tolerance) : tolerance(tolerance) {}
|
||||
bool operator()(T lhs, T rhs)
|
||||
{
|
||||
return (std::abs(lhs - rhs) <= tolerance);
|
||||
}
|
||||
|
||||
private:
|
||||
T tolerance;
|
||||
};
|
||||
|
||||
int fail_tolerance_predicate()
|
||||
{
|
||||
int test_cases = 0;
|
||||
|
||||
{
|
||||
std::vector<double> x, y;
|
||||
x.push_back( 1.0 ); x.push_back( 1.0 );
|
||||
y.push_back( 1.0 - 1e-4 ); y.push_back( 1.0 + 1e-4 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), with_tolerance<double>(1e-5) );
|
||||
++test_cases;
|
||||
}
|
||||
|
||||
return test_cases;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int test_cases = 0;
|
||||
|
||||
test_cases += fail_vector();
|
||||
test_cases += fail_tolerance_predicate();
|
||||
|
||||
boost::report_errors();
|
||||
|
||||
return boost::detail::test_errors() != test_cases;
|
||||
}
|
||||
76
test/lightweight_test_all_with_test.cpp
Normal file
76
test/lightweight_test_all_with_test.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// Test for BOOST_TEST_ALL_WITH
|
||||
//
|
||||
// Copyright (c) 2017 Bjorn Reese
|
||||
//
|
||||
// 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 <cmath>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
void test_vector()
|
||||
{
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 ); x.push_back( 4 );
|
||||
y.push_back( 1 ); y.push_back( 2 ); y.push_back( 3 ); y.push_back( 4 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), std::equal_to<int>() );
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 ); x.push_back( 4 );
|
||||
y.push_back( 2 ); y.push_back( 3 ); y.push_back( 4 ); y.push_back( 5 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), std::not_equal_to<int>() );
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> x, y;
|
||||
x.push_back( 1 ); x.push_back( 2 ); x.push_back( 3 ); x.push_back( 4 );
|
||||
y.push_back( 2 ); y.push_back( 3 ); y.push_back( 4 ); y.push_back( 5 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), std::less<int>() );
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct with_tolerance
|
||||
{
|
||||
with_tolerance(T tolerance) : tolerance(tolerance) {}
|
||||
bool operator()(T lhs, T rhs)
|
||||
{
|
||||
return (std::abs(lhs - rhs) <= tolerance);
|
||||
}
|
||||
|
||||
private:
|
||||
T tolerance;
|
||||
};
|
||||
|
||||
void test_tolerance_predicate()
|
||||
{
|
||||
{
|
||||
std::vector<double> x, y;
|
||||
x.push_back( 1.0 ); x.push_back( 2.0 ); x.push_back( 3.0 ); x.push_back( 4.0 );
|
||||
y.push_back( 1.0 ); y.push_back( 2.0 ); y.push_back( 3.0 ); y.push_back( 4.0 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), with_tolerance<double>(1e-5) );
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<double> x, y;
|
||||
x.push_back( 1.0 ); x.push_back( 1.0 );
|
||||
y.push_back( 1.0 - 1e-6 ); y.push_back( 1.0 + 1e-6 );
|
||||
BOOST_TEST_ALL_WITH( x.begin(), x.end(), y.begin(), y.end(), with_tolerance<double>(1e-5) );
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_vector();
|
||||
test_tolerance_predicate();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
18
test/lightweight_test_fail10.cpp
Normal file
18
test/lightweight_test_fail10.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Negative test for BOOST_TEST_EQ on const char*
|
||||
//
|
||||
// Copyright (c) 2017 Hans Dembinski
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_EQ("xab"+1 , "yab"+1); // compares addresses, not cstrings
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
18
test/lightweight_test_fail9.cpp
Normal file
18
test/lightweight_test_fail9.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Negative test for BOOST_TEST_CSTR_EQ
|
||||
//
|
||||
// Copyright (c) 2017 Hans Dembinski
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_CSTR_EQ("x" , "y");
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <vector>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
struct X
|
||||
@@ -43,6 +44,16 @@ int main()
|
||||
BOOST_TEST( x++ == 1 );
|
||||
BOOST_TEST( x == 2? true: false );
|
||||
BOOST_TEST( x == 2? &x: 0 );
|
||||
|
||||
// BOOST_TEST_NOT
|
||||
|
||||
BOOST_TEST_NOT( x == 1 );
|
||||
BOOST_TEST_NOT( ++x == 2 );
|
||||
BOOST_TEST_NOT( x++ == 2 );
|
||||
BOOST_TEST_NOT( --x == 2 );
|
||||
BOOST_TEST_NOT( x-- == 2 );
|
||||
BOOST_TEST_NOT( x == 2? false: true );
|
||||
BOOST_TEST_NOT( x == 2? 0: &x );
|
||||
|
||||
// BOOST_TEST_EQ
|
||||
|
||||
@@ -54,11 +65,24 @@ int main()
|
||||
|
||||
BOOST_TEST_EQ( ++x, ++y );
|
||||
BOOST_TEST_EQ( x++, y++ );
|
||||
BOOST_TEST_CSTR_EQ("xabc"+1, "yabc"+1); // equal cstrings, different addresses
|
||||
BOOST_TEST_EQ( &y, &y );
|
||||
|
||||
// BOOST_TEST_NE
|
||||
|
||||
BOOST_TEST_NE( ++x, y );
|
||||
BOOST_TEST_NE( &x, &y );
|
||||
BOOST_TEST_NE("xabc"+1, "yabc"+1); // equal cstrings, different addresses
|
||||
BOOST_TEST_CSTR_NE("x", "y");
|
||||
|
||||
// BOOST_TEST_ALL_EQ
|
||||
{
|
||||
std::vector<int> xarray;
|
||||
xarray.push_back(1);
|
||||
xarray.push_back(2);
|
||||
std::vector<int> yarray(xarray);
|
||||
BOOST_TEST_ALL_EQ(xarray.begin(), xarray.end(), yarray.begin(), yarray.end());
|
||||
}
|
||||
|
||||
// BOOST_TEST_THROWS
|
||||
|
||||
|
||||
35
test/ref_cv_test.cpp
Normal file
35
test/ref_cv_test.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// ref_cv_test.cpp: ref( x ) where x is of a cv-qualified type
|
||||
//
|
||||
// Copyright (c) 2017 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 <boost/ref.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
#define BOOST_TEST_REF( x ) BOOST_TEST( &boost::ref( x ).get() == &x )
|
||||
#define BOOST_TEST_CREF( x ) BOOST_TEST( &boost::cref( x ).get() == &x )
|
||||
|
||||
int main()
|
||||
{
|
||||
int x1 = 1;
|
||||
int const x2 = 2;
|
||||
int volatile x3 = 3;
|
||||
int const volatile x4 = 4;
|
||||
|
||||
BOOST_TEST_REF( x1 );
|
||||
BOOST_TEST_CREF( x1 );
|
||||
|
||||
BOOST_TEST_REF( x2 );
|
||||
BOOST_TEST_CREF( x2 );
|
||||
|
||||
BOOST_TEST_REF( x3 );
|
||||
BOOST_TEST_CREF( x3 );
|
||||
|
||||
BOOST_TEST_REF( x4 );
|
||||
BOOST_TEST_CREF( x4 );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
int main()
|
||||
{
|
||||
boost::reference_wrapper<int const> r( 1 ); // this should produce an ERROR
|
||||
(void)r;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -13,4 +13,5 @@
|
||||
int main()
|
||||
{
|
||||
boost::reference_wrapper<int> r = boost::ref( 2 ); // this should produce an ERROR
|
||||
(void)r;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ X const crv() { return X(); }
|
||||
int main()
|
||||
{
|
||||
boost::reference_wrapper<X const> r = boost::ref( crv() ); // this should produce an ERROR
|
||||
(void)r;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
int main()
|
||||
{
|
||||
boost::reference_wrapper<int const> r = boost::cref( 2 ); // should fail
|
||||
(void)r;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -20,6 +20,7 @@ X const crv() { return X(); }
|
||||
int main()
|
||||
{
|
||||
boost::reference_wrapper<X const> r = boost::cref( crv() ); // must fail
|
||||
(void)r;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
@@ -52,7 +52,7 @@ rule test_all
|
||||
for file in $(run_tests)
|
||||
{
|
||||
local test_name = [ MATCH "([^.]*).cpp$" : $(file) ] ;
|
||||
all_rules += [ run $(file) ../../../test/build//boost_test_exec_monitor/<link>static : : : : "swap-$(test_name)" ] ;
|
||||
all_rules += [ run $(file) : : : : "swap-$(test_name)" ] ;
|
||||
}
|
||||
|
||||
#ECHO All rules: $(all_rules) ;
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@@ -36,7 +37,7 @@ namespace std
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t first_dimension = 3;
|
||||
const std::size_t second_dimension = 4;
|
||||
@@ -65,5 +66,5 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(), number_of_elements);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -7,13 +7,14 @@
|
||||
// Tests swapping an array of arrays of integers by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <algorithm> //for std::copy and std::equal
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t first_dimension = 3;
|
||||
const std::size_t second_dimension = 4;
|
||||
@@ -38,5 +39,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(ptr1[i], static_cast<int>(i + number_of_elements) );
|
||||
BOOST_CHECK_EQUAL(ptr2[i], static_cast<int>(i) );
|
||||
}
|
||||
return 0;
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@@ -36,7 +37,7 @@ namespace std
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t array_size = 2;
|
||||
const swap_test_class initial_array1[array_size] = { swap_test_class(1), swap_test_class(2) };
|
||||
@@ -57,5 +58,5 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(), array_size);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
// Tests swapping an array of integers by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <algorithm> //for std::copy and std::equal
|
||||
#include <cstddef> //for std::size_t
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t array_size = 3;
|
||||
const int initial_array1[array_size] = { 1, 2, 3 };
|
||||
@@ -31,5 +32,5 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK(std::equal(array1, array1 + array_size, initial_array2));
|
||||
BOOST_CHECK(std::equal(array2, array2 + array_size, initial_array1));
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
// Tests swapping an array of swap_test_template<int> objects by means of boost::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@@ -46,7 +47,7 @@ void swap(swap_test_template<T>& left, swap_test_template<T>& right)
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::size_t array_size = 2;
|
||||
const swap_test_template<int> initial_array1[array_size] = { swap_test_class(1), swap_test_class(2) };
|
||||
@@ -67,5 +68,5 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(), array_size);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(), 0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
// than std::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in namespace boost
|
||||
namespace boost
|
||||
@@ -23,7 +24,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const boost::swap_test_class initial_value1(1);
|
||||
const boost::swap_test_class initial_value2(2);
|
||||
@@ -39,6 +40,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::copy_count(),3);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
int object1 = 1;
|
||||
int object2 = 2;
|
||||
@@ -18,6 +19,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(object1,2);
|
||||
BOOST_CHECK_EQUAL(object2,1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in namespace boost
|
||||
namespace boost
|
||||
@@ -23,7 +24,7 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const boost::swap_test_class initial_value1(1);
|
||||
const boost::swap_test_class initial_value2(2);
|
||||
@@ -40,6 +41,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(boost::swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
// to the boost namespace.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in namespace other
|
||||
namespace other
|
||||
@@ -42,7 +43,7 @@ namespace other
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const other::swap_test_class initial_value1(1);
|
||||
const other::swap_test_class initial_value2(2);
|
||||
@@ -59,6 +60,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@@ -17,7 +18,7 @@ void swap(swap_test_class& left, swap_test_class& right)
|
||||
left.swap(right);
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const swap_test_class initial_value1(1);
|
||||
const swap_test_class initial_value2(2);
|
||||
@@ -34,6 +35,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in namespace other
|
||||
namespace other
|
||||
@@ -23,7 +24,7 @@ namespace other
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const other::swap_test_class initial_value1(1);
|
||||
const other::swap_test_class initial_value2(2);
|
||||
@@ -40,6 +41,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(other::swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
@@ -22,7 +23,7 @@ namespace std
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const swap_test_class initial_value1(1);
|
||||
const swap_test_class initial_value2(2);
|
||||
@@ -39,6 +40,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),1);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
// std::bitset<T> does not have its own std::swap overload.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <bitset>
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
typedef std::bitset<8> bitset_type;
|
||||
const bitset_type initial_value1 = 1;
|
||||
@@ -28,6 +29,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
// std::swap overload or template specialization.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <locale>
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::time_base::dateorder initial_value1 = std::time_base::dmy;
|
||||
const std::time_base::dateorder initial_value2 = std::time_base::mdy;
|
||||
@@ -27,6 +28,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,12 +8,13 @@
|
||||
// std::string has its own std::swap overload.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <string>
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::string initial_value1 = "one";
|
||||
const std::string initial_value2 = "two";
|
||||
@@ -26,6 +27,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
// for std::type_info pointers.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
const std::type_info * const initial_value1 = 0;
|
||||
const std::type_info * const initial_value2 = &typeid(double);
|
||||
@@ -27,6 +28,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(ptr1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(ptr2,initial_value1);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
// having boost::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -28,7 +29,7 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
typedef boost::swap_test_class swap_test_class_type;
|
||||
typedef std::vector<swap_test_class_type> vector_type;
|
||||
@@ -55,6 +56,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
// having ::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -22,7 +23,7 @@ void swap(swap_test_class& left, swap_test_class& right)
|
||||
left.swap(right);
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
typedef std::vector<swap_test_class> vector_type;
|
||||
|
||||
@@ -48,6 +49,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(swap_test_class::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
// having other::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#define BOOST_INCLUDE_MAIN
|
||||
#include <boost/test/test_tools.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -28,7 +29,7 @@ namespace other
|
||||
}
|
||||
}
|
||||
|
||||
int test_main(int, char*[])
|
||||
int main()
|
||||
{
|
||||
typedef other::swap_test_class swap_test_class_type;
|
||||
typedef std::vector<swap_test_class_type> vector_type;
|
||||
@@ -55,6 +56,6 @@ int test_main(int, char*[])
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::swap_count(),0);
|
||||
BOOST_CHECK_EQUAL(swap_test_class_type::copy_count(),0);
|
||||
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user