forked from boostorg/core
Compare commits
98 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bb800a05e3 | |||
| 2d7f98c844 | |||
| 8914603fcf | |||
| 3792047e09 | |||
| 6de3da8360 | |||
| e55d6279d5 | |||
| a87fd099e7 | |||
| 09f4823baa | |||
| 526e0b2f53 | |||
| ac6044769f | |||
| 2876914d02 | |||
| 36f60e47ad | |||
| a88bbcc8ba | |||
| c4f3e1acc0 | |||
| 69696c0cba | |||
| 283460b991 | |||
| 3a2c94df8c | |||
| 226ef58027 | |||
| 0f8b499bca | |||
| a3f6d12b57 | |||
| cccac1d631 | |||
| 6153eebc42 | |||
| ab05c190be | |||
| 637b2ffaff | |||
| 43426067df | |||
| f76116405d | |||
| 89b1792724 | |||
| 87dd2883b8 | |||
| cba69f5e4c | |||
| 5eaa31e366 | |||
| 2d56d6f55b | |||
| 6fd649d7fd | |||
| 335aa4f396 | |||
| 26cab26e52 | |||
| b805efd4fe | |||
| 80875a19b6 | |||
| 6ba388125e | |||
| 889502504d | |||
| 16c5503648 | |||
| dc6003e26f | |||
| 46545326d8 | |||
| 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 | |||
| c0f277a7d8 | |||
| 5507006fc2 | |||
| b7f49c9c78 | |||
| 9953994761 |
+376
-4
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2016 Peter Dimov
|
# Copyright 2016, 2017 Peter Dimov
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
@@ -15,6 +15,379 @@ branches:
|
|||||||
- master
|
- master
|
||||||
- develop
|
- 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++-5 CXXSTD=c++1z
|
||||||
|
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
|
||||||
|
dist: trusty
|
||||||
|
compiler: g++-7
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++03
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: g++-7
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: g++-7
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++14
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: g++-7
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=c++17
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-7
|
||||||
|
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
|
||||||
|
- libstdc++-4.9-dev
|
||||||
|
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
|
||||||
|
- libstdc++-4.9-dev
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.8
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.9
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++03
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.9
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.9
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.9
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.9
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.9
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.9
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++14
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.9
|
||||||
|
- libstdc++-4.9-dev
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.9
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.9
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=c++1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.9
|
||||||
|
- libstdc++-4.9-dev
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-precise-3.9
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-4.0
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++03
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-4.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-4.0
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-4.0
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-4.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-4.0
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-4.0
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++14
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-4.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-4.0
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-4.0
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=c++1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-4.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-trusty-4.0
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
|
- os: osx
|
||||||
|
env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++1z
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- cd ..
|
- cd ..
|
||||||
- git clone -b $TRAVIS_BRANCH https://github.com/boostorg/boost.git boost-root
|
- git clone -b $TRAVIS_BRANCH https://github.com/boostorg/boost.git boost-root
|
||||||
@@ -25,15 +398,14 @@ install:
|
|||||||
- git submodule init libs/static_assert
|
- git submodule init libs/static_assert
|
||||||
- git submodule init libs/type_traits
|
- git submodule init libs/type_traits
|
||||||
- git submodule init tools/build
|
- git submodule init tools/build
|
||||||
- git submodule init tools/inspect
|
|
||||||
- git submodule update
|
- git submodule update
|
||||||
- cp -r $TRAVIS_BUILD_DIR/* libs/core
|
- cp -r $TRAVIS_BUILD_DIR/* libs/core
|
||||||
- ./bootstrap.sh
|
- ./bootstrap.sh
|
||||||
- ./b2 headers
|
- ./b2 headers
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- TOOLSET=gcc,clang
|
- |-
|
||||||
- if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
|
echo "using $TOOLSET : : $COMPILER : <cxxflags>-std=$CXXSTD ;" > ~/user-config.jam
|
||||||
- ./b2 libs/core/test toolset=$TOOLSET
|
- ./b2 libs/core/test toolset=$TOOLSET
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
|
|||||||
+43
-4
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2016 Peter Dimov
|
# Copyright 2016, 2017 Peter Dimov
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
@@ -11,6 +11,45 @@ branches:
|
|||||||
- master
|
- master
|
||||||
- develop
|
- develop
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
TOOLSET: msvc-9.0
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
TOOLSET: msvc-10.0
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
TOOLSET: msvc-11.0
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
TOOLSET: msvc-12.0
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
ADDPATH: C:\cygwin\bin;
|
||||||
|
TOOLSET: gcc
|
||||||
|
CXXFLAGS: cxxflags=-std=c++03
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
ADDPATH: C:\cygwin\bin;
|
||||||
|
TOOLSET: gcc
|
||||||
|
CXXFLAGS: cxxflags=-std=c++11
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
ADDPATH: C:\mingw\bin;
|
||||||
|
TOOLSET: gcc
|
||||||
|
CXXFLAGS: cxxflags=-std=c++03
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
ADDPATH: C:\mingw\bin;
|
||||||
|
TOOLSET: gcc
|
||||||
|
CXXFLAGS: cxxflags=-std=c++11
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
|
||||||
|
TOOLSET: gcc
|
||||||
|
CXXFLAGS: cxxflags=-std=c++03
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||||
|
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
|
||||||
|
TOOLSET: gcc
|
||||||
|
CXXFLAGS: cxxflags=-std=c++11
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
TOOLSET: msvc-14.0
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
TOOLSET: msvc-14.1
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- cd ..
|
- cd ..
|
||||||
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
|
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
|
||||||
@@ -21,13 +60,13 @@ install:
|
|||||||
- git submodule init libs/static_assert
|
- git submodule init libs/static_assert
|
||||||
- git submodule init libs/type_traits
|
- git submodule init libs/type_traits
|
||||||
- git submodule init tools/build
|
- git submodule init tools/build
|
||||||
- git submodule init tools/inspect
|
|
||||||
- git submodule update
|
- git submodule update
|
||||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\core
|
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\core
|
||||||
- bootstrap
|
- cmd /c bootstrap
|
||||||
- b2 headers
|
- b2 headers
|
||||||
|
|
||||||
build: off
|
build: off
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- b2 libs/core/test toolset=msvc-9.0,msvc-10.0,msvc-11.0,msvc-14.0
|
- PATH=%ADDPATH%%PATH%
|
||||||
|
- b2 libs/core/test toolset=%TOOLSET% %CXXFLAGS%
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* Brad King
|
* Brad King
|
||||||
* Douglas Gregor
|
* Douglas Gregor
|
||||||
* Peter Dimov
|
* Peter Dimov
|
||||||
|
* Glen Fernandes
|
||||||
|
|
||||||
[endsimplesect]
|
[endsimplesect]
|
||||||
|
|
||||||
@@ -59,6 +60,19 @@ void f() {
|
|||||||
|
|
||||||
[endsect]
|
[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]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ criteria for inclusion is that the utility component be:
|
|||||||
[include no_exceptions_support.qbk]
|
[include no_exceptions_support.qbk]
|
||||||
[include noncopyable.qbk]
|
[include noncopyable.qbk]
|
||||||
[include null_deleter.qbk]
|
[include null_deleter.qbk]
|
||||||
|
[include pointer_traits.qbk]
|
||||||
[include ref.qbk]
|
[include ref.qbk]
|
||||||
[include scoped_enum.qbk]
|
[include scoped_enum.qbk]
|
||||||
[include swap.qbk]
|
[include swap.qbk]
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
[/
|
[/
|
||||||
Copyright 2010, 2011 Beman Dawes
|
Copyright 2010, 2011 Beman Dawes
|
||||||
Copyright 2013 Ion Gaztanaga
|
Copyright 2013 Ion Gaztanaga
|
||||||
Copyright 2014 Peter Dimov
|
Copyright 2014, 2017 Peter Dimov
|
||||||
|
Copyright 2017 Kohei Takahashi
|
||||||
|
|
||||||
Distributed under the Boost Software License, Version 1.0.
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
|
||||||
@@ -36,6 +37,14 @@ When using `lightweight_test.hpp`, *do not forget* to
|
|||||||
#define BOOST_ERROR(message) /*unspecified*/
|
#define BOOST_ERROR(message) /*unspecified*/
|
||||||
#define BOOST_TEST_EQ(expr1, expr2) /*unspecified*/
|
#define BOOST_TEST_EQ(expr1, expr2) /*unspecified*/
|
||||||
#define BOOST_TEST_NE(expr1, expr2) /*unspecified*/
|
#define BOOST_TEST_NE(expr1, expr2) /*unspecified*/
|
||||||
|
#define BOOST_TEST_LT(expr1, expr2) /*unspecified*/
|
||||||
|
#define BOOST_TEST_LE(expr1, expr2) /*unspecified*/
|
||||||
|
#define BOOST_TEST_GT(expr1, expr2) /*unspecified*/
|
||||||
|
#define BOOST_TEST_GE(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*/
|
#define BOOST_TEST_THROWS(expr, excep) /*unspecified*/
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@@ -85,7 +94,7 @@ Increases error count and outputs a message containing
|
|||||||
BOOST_TEST_EQ(expr1, expr2)
|
BOOST_TEST_EQ(expr1, expr2)
|
||||||
``
|
``
|
||||||
|
|
||||||
If `expr1 != expr2` increases the error count and outputs a
|
If `expr1 == expr2` is not true increases the error count and outputs a
|
||||||
message containing both expressions.
|
message containing both expressions.
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
@@ -96,11 +105,95 @@ message containing both expressions.
|
|||||||
BOOST_TEST_NE(expr1, expr2)
|
BOOST_TEST_NE(expr1, expr2)
|
||||||
``
|
``
|
||||||
|
|
||||||
If `expr1 == expr2` increases the error count and outputs a
|
If `expr1 != expr2` is not true increases the error count and outputs a
|
||||||
message containing both expressions.
|
message containing both expressions.
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
[section BOOST_TEST_LT]
|
||||||
|
|
||||||
|
``
|
||||||
|
BOOST_TEST_LT(expr1, expr2)
|
||||||
|
``
|
||||||
|
|
||||||
|
If `expr1 < expr2` is not true increases the error count and outputs a
|
||||||
|
message containing both expressions.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section BOOST_TEST_LE]
|
||||||
|
|
||||||
|
``
|
||||||
|
BOOST_TEST_LE(expr1, expr2)
|
||||||
|
``
|
||||||
|
|
||||||
|
If `expr1 <= expr2` is not true increases the error count and outputs a
|
||||||
|
message containing both expressions.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section BOOST_TEST_GT]
|
||||||
|
|
||||||
|
``
|
||||||
|
BOOST_TEST_GT(expr1, expr2)
|
||||||
|
``
|
||||||
|
|
||||||
|
If `expr1 > expr2` is not true increases the error count and outputs a
|
||||||
|
message containing both expressions.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section BOOST_TEST_GE]
|
||||||
|
|
||||||
|
``
|
||||||
|
BOOST_TEST_GE(expr1, expr2)
|
||||||
|
``
|
||||||
|
|
||||||
|
If `expr1 >= expr2` is not true increases the error count and outputs a
|
||||||
|
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]
|
[section BOOST_TEST_THROWS]
|
||||||
|
|
||||||
``
|
``
|
||||||
|
|||||||
+2
-2
@@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
[section Header <boost/core/noncopyable.hpp>]
|
[section Header <boost/core/noncopyable.hpp>]
|
||||||
|
|
||||||
The header `<boost/noncopyable.hpp>` defines the class
|
The header `<boost/core/noncopyable.hpp>` defines the class
|
||||||
`boost::noncopyable`. It is intended to be used as a private
|
`boost::noncopyable`. It is intended to be used as a private
|
||||||
base. `boost::noncopyable` has private (under C++03) or
|
base class. `boost::noncopyable` has private (under C++03) or
|
||||||
deleted (under C++11) copy constructor and a copy assignment
|
deleted (under C++11) copy constructor and a copy assignment
|
||||||
operator and can't be copied or assigned; a class that derives
|
operator and can't be copied or assigned; a class that derives
|
||||||
from it inherits these properties.
|
from it inherits these properties.
|
||||||
|
|||||||
@@ -0,0 +1,141 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:pointer_traits pointer_traits]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Glen Fernandes
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Overview]
|
||||||
|
|
||||||
|
The header <boost/core/pointer_traits.hpp> provides the class template
|
||||||
|
`boost::pointer_traits` to facilitate use of pointer-like types. The C++11
|
||||||
|
standard library introduced `std::pointer_traits` along with an allocator
|
||||||
|
model which supported pointer-like types in addition to plain raw pointers.
|
||||||
|
This implementation also supports C++98, and adds additional functionality
|
||||||
|
for obtaining raw pointers from pointers.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Examples]
|
||||||
|
|
||||||
|
The following example allocates storage and constructs an object in that
|
||||||
|
storage using an allocator.
|
||||||
|
|
||||||
|
```
|
||||||
|
template<class Allocator>
|
||||||
|
void function(Allocator& a)
|
||||||
|
{
|
||||||
|
auto p = a.allocate(1);
|
||||||
|
std::allocator_traits<Allocator>::construct(a, boost::to_address(p));
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Reference]
|
||||||
|
|
||||||
|
```
|
||||||
|
namespace boost {
|
||||||
|
template<class T> struct pointer_traits {
|
||||||
|
typedef T pointer;
|
||||||
|
typedef ``['see below]`` element_type;
|
||||||
|
typedef ``['see below]`` difference_type;
|
||||||
|
|
||||||
|
template<class U> struct rebind_to { typedef ``['see below]`` type; };
|
||||||
|
template<class U> using rebind = typename rebind_to<U>::type;
|
||||||
|
|
||||||
|
static pointer pointer_to(``['see below]`` v);
|
||||||
|
static element_type* to_address(const pointer& v) noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T> struct pointer_traits<T*> {
|
||||||
|
typedef T* pointer;
|
||||||
|
typedef T element_type;
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
|
||||||
|
template<class U> struct rebind_to { typedef U* type; };
|
||||||
|
template<class U> using rebind = typename rebind_to<U>::type;
|
||||||
|
|
||||||
|
static pointer pointer_to(``['see below]`` v) noexcept;
|
||||||
|
static element_type* to_address(pointer v) noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
typename pointer_traits<T>::element_type* to_address(const T& v) noexcept;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
[section Member types]
|
||||||
|
|
||||||
|
[variablelist
|
||||||
|
[[`typedef` ['see below] `element_type;`]
|
||||||
|
[`T::element_type` if such a type exists; otherwise `U` if `T` is a class
|
||||||
|
template instantiation of the form `Pointer<U, Args>`, where `Args` is zero
|
||||||
|
or more type arguments; otherwise the specialization is ill-formed.]]
|
||||||
|
[[`typedef` ['see below] `difference_type;`]
|
||||||
|
[`T::difference_type` if such a type exists; otherwise `std::ptrdiff_t`.]]
|
||||||
|
[[`template<class U> struct rebind_to { typedef` ['see below] `type; };`]
|
||||||
|
[`type` is `T::rebind<U>` if such a type exists; otherwise, `Pointer<V, Args>`
|
||||||
|
if `T` is a class template instantiation of the form `Pointer<T, Args>`,
|
||||||
|
where `Args` is zero or more type arguments; otherwise, the instantiation of
|
||||||
|
`rebind_to` is ill-formed.]]]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Member functions]
|
||||||
|
|
||||||
|
[variablelist pointer_traits
|
||||||
|
[[`static pointer pointer_to(`['see below] `v);`]
|
||||||
|
[[variablelist
|
||||||
|
[[Remark]
|
||||||
|
[If `element_type` is a void type, the type of `v` is unspecified; otherwise,
|
||||||
|
it is `element_type&`.]]
|
||||||
|
[[Returns]
|
||||||
|
[A pointer to `v` obtained by calling `T::pointer_to(v)`.]]]]]
|
||||||
|
[[`static element_type* to_address(const pointer& v) noexcept;`]
|
||||||
|
[[variablelist
|
||||||
|
[[Requires] [`v` is not a null pointer.]]
|
||||||
|
[[Returns]
|
||||||
|
[A pointer of type `element_type*` that references the same location
|
||||||
|
as the argument.]]]]]]
|
||||||
|
|
||||||
|
[variablelist pointer_traits<T*>
|
||||||
|
[[`static pointer pointer_to(`['see below] `v) noexcept;`]
|
||||||
|
[[variablelist
|
||||||
|
[[Remark]
|
||||||
|
[If `element_type` is a void type, the type of `v` is unspecified; otherwise,
|
||||||
|
it is `element_type&`.]]
|
||||||
|
[[Returns] [The result of `boost::addressof(v)`.]]]]]
|
||||||
|
[[`static element_type* to_address(pointer v) noexcept;`]
|
||||||
|
[[variablelist [[Returns] [The value of `v`.]]]]]]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Free functions]
|
||||||
|
|
||||||
|
[variablelist
|
||||||
|
[[`template<class T> typename pointer_traits<T>::element_type*
|
||||||
|
to_address(const T& v) noexcept;`]
|
||||||
|
[[variablelist [[Returns] [`boost::pointer_traits<T>::to_address(v)`.]]]]]]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Acknowledgments]
|
||||||
|
|
||||||
|
Glen Fernandes implemented `pointer_traits` with reviews and guidance from
|
||||||
|
Peter Dimov.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
+233
-121
@@ -1,162 +1,274 @@
|
|||||||
// Copyright (C) 2002 Brad King (brad.king@kitware.com)
|
/*
|
||||||
// Douglas Gregor (gregod@cs.rpi.edu)
|
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)
|
|
||||||
|
|
||||||
// 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
|
#ifndef BOOST_CORE_ADDRESSOF_HPP
|
||||||
#define BOOST_CORE_ADDRESSOF_HPP
|
#define BOOST_CORE_ADDRESSOF_HPP
|
||||||
|
|
||||||
# include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
# include <boost/detail/workaround.hpp>
|
|
||||||
# include <cstddef>
|
|
||||||
|
|
||||||
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
|
} /* boost */
|
||||||
{
|
|
||||||
|
|
||||||
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( BOOST_NO_CXX11_DECLTYPE ) && ( ( defined( __clang__ ) && !defined( _LIBCPP_VERSION ) ) || defined( __INTEL_COMPILER ) )
|
|
||||||
|
|
||||||
typedef decltype(nullptr) addr_nullptr_t;
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
#include <boost/config/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
|
#endif
|
||||||
|
|
||||||
template<> struct addressof_impl< addr_nullptr_t >
|
template<>
|
||||||
{
|
struct address_of<addressof_null_t> {
|
||||||
typedef addr_nullptr_t T;
|
typedef addressof_null_t type;
|
||||||
|
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||||
static BOOST_FORCEINLINE T * f( T & v, int )
|
return &o;
|
||||||
{
|
|
||||||
return &v;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct addressof_impl< addr_nullptr_t const >
|
template<>
|
||||||
{
|
struct address_of<const addressof_null_t> {
|
||||||
typedef addr_nullptr_t const T;
|
typedef const addressof_null_t type;
|
||||||
|
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||||
static BOOST_FORCEINLINE T * f( T & v, int )
|
return &o;
|
||||||
{
|
|
||||||
return &v;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct addressof_impl< addr_nullptr_t volatile >
|
template<>
|
||||||
{
|
struct address_of<volatile addressof_null_t> {
|
||||||
typedef addr_nullptr_t volatile T;
|
typedef volatile addressof_null_t type;
|
||||||
|
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||||
static BOOST_FORCEINLINE T * f( T & v, int )
|
return &o;
|
||||||
{
|
|
||||||
return &v;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct addressof_impl< addr_nullptr_t const volatile >
|
template<>
|
||||||
{
|
struct address_of<const volatile addressof_null_t> {
|
||||||
typedef addr_nullptr_t const volatile T;
|
typedef const volatile addressof_null_t type;
|
||||||
|
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
|
||||||
static BOOST_FORCEINLINE T * f( T & v, int )
|
return &o;
|
||||||
{
|
|
||||||
return &v;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace detail
|
} /* detail */
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_CXX11_SFINAE_EXPR) || \
|
||||||
|
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>
|
template<class T>
|
||||||
BOOST_FORCEINLINE
|
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) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5120))
|
return address_of<T>::get(addressof_ref<T>(o), 0);
|
||||||
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, BOOST_TESTED_AT( 0x590 ) )
|
template<class T>
|
||||||
|
constexpr BOOST_FORCEINLINE
|
||||||
namespace detail
|
typename addressof_if<addressof_is_constexpr<T>::value, T>::type
|
||||||
|
addressof(T& o) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
return &o;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
} /* detail */
|
||||||
|
|
||||||
// Borland doesn't like casting an array reference to a char reference
|
template<class T>
|
||||||
// but these overloads work around the problem.
|
constexpr BOOST_FORCEINLINE T*
|
||||||
#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
addressof(T& o) BOOST_NOEXCEPT
|
||||||
template<typename T,std::size_t N>
|
|
||||||
BOOST_FORCEINLINE
|
|
||||||
T (*addressof(T (&t)[N]))[N]
|
|
||||||
{
|
{
|
||||||
return reinterpret_cast<T(*)[N]>(&t);
|
return detail::addressof(o);
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T,std::size_t N>
|
|
||||||
BOOST_FORCEINLINE
|
|
||||||
const T (*addressof(const T (&t)[N]))[N]
|
|
||||||
{
|
|
||||||
return reinterpret_cast<const T(*)[N]>(&t);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace boost
|
} /* boost */
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // BOOST_CORE_ADDRESSOF_HPP
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
|
||||||
|
!defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
const T* addressof(const T&&) = delete;
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -93,15 +93,10 @@ inline void demangle_free( char const * name ) BOOST_NOEXCEPT
|
|||||||
inline std::string demangle( char const * name )
|
inline std::string demangle( char const * name )
|
||||||
{
|
{
|
||||||
scoped_demangled_name demangled_name( name );
|
scoped_demangled_name demangled_name( name );
|
||||||
char const * const p = demangled_name.get();
|
char const * p = demangled_name.get();
|
||||||
if( p )
|
if( !p )
|
||||||
{
|
p = name;
|
||||||
return p;
|
return p;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -19,10 +19,13 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <boost/core/no_exceptions_support.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/current_function.hpp>
|
#include <boost/current_function.hpp>
|
||||||
#include <boost/core/no_exceptions_support.hpp>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <iterator>
|
||||||
|
#include <cstring>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
// IDE's like Visual Studio perform better if output goes to std::cout or
|
// IDE's like Visual Studio perform better if output goes to std::cout or
|
||||||
// some other stream, so allow user to configure output stream:
|
// some other stream, so allow user to configure output stream:
|
||||||
@@ -101,6 +104,20 @@ inline void throw_failed_impl(char const * excep, char const * file, int line, c
|
|||||||
# pragma GCC diagnostic ignored "-Wsign-compare"
|
# pragma GCC diagnostic ignored "-Wsign-compare"
|
||||||
#endif
|
#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); }
|
||||||
|
|
||||||
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
inline const void* test_output_impl(std::nullptr_t v) { return v; }
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
|
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 )
|
char const * file, int line, char const * function, T const & t, U const & u )
|
||||||
{
|
{
|
||||||
@@ -113,7 +130,7 @@ template<class T, class U> inline void test_eq_impl( char const * expr1, char co
|
|||||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||||
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
|
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||||
<< "' failed in function '" << function << "': "
|
<< "' failed in function '" << function << "': "
|
||||||
<< "'" << t << "' != '" << u << "'" << std::endl;
|
<< "'" << test_output_impl(t) << "' != '" << test_output_impl(u) << "'" << std::endl;
|
||||||
++test_errors();
|
++test_errors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,11 +147,250 @@ template<class T, class U> inline void test_ne_impl( char const * expr1, char co
|
|||||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||||
<< file << "(" << line << "): test '" << expr1 << " != " << expr2
|
<< file << "(" << line << "): test '" << expr1 << " != " << expr2
|
||||||
<< "' failed in function '" << function << "': "
|
<< "' failed in function '" << function << "': "
|
||||||
|
<< "'" << test_output_impl(t) << "' == '" << test_output_impl(u) << "'" << std::endl;
|
||||||
|
++test_errors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, class U> inline void test_lt_impl( char const * expr1, char const * expr2,
|
||||||
|
char const * file, int line, char const * function, T const & t, U const & u )
|
||||||
|
{
|
||||||
|
if( t < u )
|
||||||
|
{
|
||||||
|
report_errors_remind();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, class U> inline void test_le_impl( char const * expr1, char const * expr2,
|
||||||
|
char const * file, int line, char const * function, T const & t, U const & u )
|
||||||
|
{
|
||||||
|
if( t <= u )
|
||||||
|
{
|
||||||
|
report_errors_remind();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, class U> inline void test_gt_impl( char const * expr1, char const * expr2,
|
||||||
|
char const * file, int line, char const * function, T const & t, U const & u )
|
||||||
|
{
|
||||||
|
if( t > u )
|
||||||
|
{
|
||||||
|
report_errors_remind();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, class U> inline void test_ge_impl( char const * expr1, char const * expr2,
|
||||||
|
char const * file, int line, char const * function, T const & t, U const & u )
|
||||||
|
{
|
||||||
|
if( t >= u )
|
||||||
|
{
|
||||||
|
report_errors_remind();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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;
|
<< "'" << t << "' == '" << u << "'" << std::endl;
|
||||||
++test_errors();
|
++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)
|
#if defined(_MSC_VER)
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#elif defined(__clang__) && defined(__has_warning)
|
#elif defined(__clang__) && defined(__has_warning)
|
||||||
@@ -177,6 +433,17 @@ inline int report_errors()
|
|||||||
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
#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_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||||
|
|
||||||
|
#define BOOST_TEST_LT(expr1,expr2) ( ::boost::detail::test_lt_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||||
|
#define BOOST_TEST_LE(expr1,expr2) ( ::boost::detail::test_le_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||||
|
#define BOOST_TEST_GT(expr1,expr2) ( ::boost::detail::test_gt_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||||
|
#define BOOST_TEST_GE(expr1,expr2) ( ::boost::detail::test_ge_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
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
#define BOOST_TEST_THROWS( EXPR, EXCEP ) \
|
#define BOOST_TEST_THROWS( EXPR, EXCEP ) \
|
||||||
try { \
|
try { \
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/config/workaround.hpp>
|
||||||
|
|
||||||
#if !(defined BOOST_NO_EXCEPTIONS)
|
#if !(defined BOOST_NO_EXCEPTIONS)
|
||||||
# define BOOST_TRY { try
|
# define BOOST_TRY { try
|
||||||
|
|||||||
@@ -0,0 +1,258 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#ifndef BOOST_CORE_POINTER_TRAITS_HPP
|
||||||
|
#define BOOST_CORE_POINTER_TRAITS_HPP
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_POINTER_TRAITS)
|
||||||
|
#include <memory>
|
||||||
|
#else
|
||||||
|
#include <boost/core/addressof.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct pointer_traits;
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
template<class U>
|
||||||
|
inline typename boost::pointer_traits<U>::element_type*
|
||||||
|
ptr_traits_address(const U& v) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return boost::pointer_traits<U>::to_address(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* detail */
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_POINTER_TRAITS)
|
||||||
|
template<class T>
|
||||||
|
struct pointer_traits
|
||||||
|
: std::pointer_traits<T> {
|
||||||
|
template<class U>
|
||||||
|
struct rebind_to {
|
||||||
|
typedef typename std::pointer_traits<T>::template rebind<U> type;
|
||||||
|
};
|
||||||
|
static typename std::pointer_traits<T>::element_type*
|
||||||
|
to_address(const T& v) BOOST_NOEXCEPT {
|
||||||
|
return detail::ptr_traits_address(v.operator->());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct pointer_traits<T*>
|
||||||
|
: std::pointer_traits<T*> {
|
||||||
|
template<class U>
|
||||||
|
struct rebind_to {
|
||||||
|
typedef U* type;
|
||||||
|
};
|
||||||
|
static T* to_address(T* v) BOOST_NOEXCEPT {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
struct ptr_traits_none { char first, second; };
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct ptr_traits_has_element {
|
||||||
|
private:
|
||||||
|
template<class U>
|
||||||
|
static ptr_traits_none call(...);
|
||||||
|
template<class U>
|
||||||
|
static char call(typename U::element_type* = 0);
|
||||||
|
public:
|
||||||
|
static const bool value = sizeof(call<T>(0)) == 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct ptr_traits_first;
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
template<template<class, class...> class T, class U, class... Args>
|
||||||
|
struct ptr_traits_first<T<U, Args...> > {
|
||||||
|
typedef U type;
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
template<template<class> class T, class U>
|
||||||
|
struct ptr_traits_first<T<U> > {
|
||||||
|
typedef U type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<template<class, class> class T, class U1, class U2>
|
||||||
|
struct ptr_traits_first<T<U1, U2> > {
|
||||||
|
typedef U1 type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<template<class, class, class> class T, class U1, class U2, class U3>
|
||||||
|
struct ptr_traits_first<T<U1, U2, U3> > {
|
||||||
|
typedef U1 type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<class T, bool = ptr_traits_has_element<T>::value>
|
||||||
|
struct ptr_traits_element {
|
||||||
|
typedef typename T::element_type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct ptr_traits_element<T, false> {
|
||||||
|
typedef typename ptr_traits_first<T>::type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct ptr_traits_has_difference {
|
||||||
|
private:
|
||||||
|
template<class U>
|
||||||
|
static ptr_traits_none call(...);
|
||||||
|
template<class U>
|
||||||
|
static char call(typename U::difference_type* = 0);
|
||||||
|
public:
|
||||||
|
static const bool value = sizeof(call<T>(0)) == 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T, bool = ptr_traits_has_difference<T>::value>
|
||||||
|
struct ptr_traits_difference {
|
||||||
|
typedef typename T::difference_type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct ptr_traits_difference<T, false> {
|
||||||
|
typedef std::ptrdiff_t type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T, class V>
|
||||||
|
struct ptr_traits_has_rebind {
|
||||||
|
private:
|
||||||
|
template<class U>
|
||||||
|
static ptr_traits_none call(...);
|
||||||
|
template<class U>
|
||||||
|
static char call(typename U::template rebind<V>* = 0);
|
||||||
|
public:
|
||||||
|
static const bool value = sizeof(call<T>(0)) == 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T, class V>
|
||||||
|
struct ptr_traits_rebind_to;
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
template<template<class, class...> class T, class U, class... Args, class V>
|
||||||
|
struct ptr_traits_rebind_to<T<U, Args...>, V> {
|
||||||
|
typedef T<V, Args...> type;
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
template<template<class> class T, class U, class V>
|
||||||
|
struct ptr_traits_rebind_to<T<U>, V> {
|
||||||
|
typedef T<V> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<template<class, class> class T, class U1, class U2, class V>
|
||||||
|
struct ptr_traits_rebind_to<T<U1, U2>, V> {
|
||||||
|
typedef T<V, U2> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<template<class, class, class> class T,
|
||||||
|
class U1, class U2, class U3, class V>
|
||||||
|
struct ptr_traits_rebind_to<T<U1, U2, U3>, V> {
|
||||||
|
typedef T<V, U2, U3> type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
|
template<class T, class U, bool = ptr_traits_has_rebind<T, U>::value>
|
||||||
|
struct ptr_traits_rebind {
|
||||||
|
typedef typename T::template rebind<U> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T, class U>
|
||||||
|
struct ptr_traits_rebind<T, U, false> {
|
||||||
|
typedef typename ptr_traits_rebind_to<T, U>::type type;
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
template<class T, class U>
|
||||||
|
struct ptr_traits_rebind {
|
||||||
|
typedef typename ptr_traits_rebind_to<T, U>::type type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct ptr_traits_value {
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct ptr_traits_value<void> {
|
||||||
|
typedef struct { } type;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* detail */
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct pointer_traits {
|
||||||
|
typedef T pointer;
|
||||||
|
typedef typename detail::ptr_traits_element<T>::type element_type;
|
||||||
|
typedef typename detail::ptr_traits_difference<T>::type difference_type;
|
||||||
|
template<class U>
|
||||||
|
struct rebind_to {
|
||||||
|
typedef typename detail::ptr_traits_rebind<T, U>::type type;
|
||||||
|
};
|
||||||
|
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
|
template<class U>
|
||||||
|
using rebind = typename detail::ptr_traits_rebind<T, U>::type;
|
||||||
|
#endif
|
||||||
|
static pointer
|
||||||
|
pointer_to(typename detail::ptr_traits_value<element_type>::type& v) {
|
||||||
|
return pointer::pointer_to(v);
|
||||||
|
}
|
||||||
|
static element_type* to_address(const pointer& v) BOOST_NOEXCEPT {
|
||||||
|
return detail::ptr_traits_address(v.operator->());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct pointer_traits<T*> {
|
||||||
|
typedef T* pointer;
|
||||||
|
typedef T element_type;
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
template<class U>
|
||||||
|
struct rebind_to {
|
||||||
|
typedef U* type;
|
||||||
|
};
|
||||||
|
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
|
template<class U>
|
||||||
|
using rebind = U*;
|
||||||
|
#endif
|
||||||
|
static T*
|
||||||
|
pointer_to(typename detail::ptr_traits_value<T>::type& v) BOOST_NOEXCEPT {
|
||||||
|
return addressof(v);
|
||||||
|
}
|
||||||
|
static T* to_address(T* v) BOOST_NOEXCEPT {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline typename pointer_traits<T>::element_type*
|
||||||
|
to_address(const T& v) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return pointer_traits<T>::to_address(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline T*
|
||||||
|
to_address(T* v) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -8,8 +8,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/utility/addressof.hpp>
|
#include <boost/config/workaround.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/core/addressof.hpp>
|
||||||
|
|
||||||
//
|
//
|
||||||
// ref.hpp - ref/cref, useful helper functions
|
// ref.hpp - ref/cref, useful helper functions
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ run addressof_test.cpp ;
|
|||||||
run addressof_test2.cpp ;
|
run addressof_test2.cpp ;
|
||||||
run addressof_np_test.cpp ;
|
run addressof_np_test.cpp ;
|
||||||
run addressof_fn_test.cpp ;
|
run addressof_fn_test.cpp ;
|
||||||
|
compile addressof_constexpr_test.cpp ;
|
||||||
|
compile-fail addressof_fail_rvalue.cpp ;
|
||||||
|
|
||||||
run checked_delete_test.cpp ;
|
run checked_delete_test.cpp ;
|
||||||
compile-fail checked_delete_fail.cpp ;
|
compile-fail checked_delete_fail.cpp ;
|
||||||
@@ -29,6 +31,7 @@ compile-fail ref_rv_fail4.cpp ;
|
|||||||
compile-fail ref_rv_fail5.cpp ;
|
compile-fail ref_rv_fail5.cpp ;
|
||||||
compile-fail ref_implicit_fail.cpp ;
|
compile-fail ref_implicit_fail.cpp ;
|
||||||
compile-fail ref_implicit_fail2.cpp ;
|
compile-fail ref_implicit_fail2.cpp ;
|
||||||
|
run ref_cv_test.cpp ;
|
||||||
|
|
||||||
run eif_constructors.cpp ;
|
run eif_constructors.cpp ;
|
||||||
run eif_dummy_arg_disambiguation.cpp ;
|
run eif_dummy_arg_disambiguation.cpp ;
|
||||||
@@ -63,6 +66,13 @@ run lightweight_test_test.cpp ;
|
|||||||
run lightweight_test_test.cpp : : : <exception-handling>off : lightweight_test_test_no_except ;
|
run lightweight_test_test.cpp : : : <exception-handling>off : lightweight_test_test_no_except ;
|
||||||
|
|
||||||
run lightweight_test_test2.cpp ;
|
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 lightweight_test_lt_le_test.cpp ;
|
||||||
|
run lightweight_test_gt_ge_test.cpp ;
|
||||||
|
|
||||||
|
run lightweight_test_eq_nullptr.cpp ;
|
||||||
|
|
||||||
run-fail lightweight_test_fail.cpp ;
|
run-fail lightweight_test_fail.cpp ;
|
||||||
run-fail lightweight_test_fail2.cpp ;
|
run-fail lightweight_test_fail2.cpp ;
|
||||||
@@ -74,6 +84,12 @@ run-fail lightweight_test_fail7.cpp ;
|
|||||||
run-fail lightweight_test_fail7.cpp : : : <rtti>off : lightweight_test_fail7_no_rtti ;
|
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 ;
|
||||||
run-fail lightweight_test_fail8.cpp : : : <rtti>off : lightweight_test_fail8_no_rtti ;
|
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-fail lightweight_test_lt_fail.cpp ;
|
||||||
|
run-fail lightweight_test_le_fail.cpp ;
|
||||||
|
run-fail lightweight_test_gt_fail.cpp ;
|
||||||
|
run-fail lightweight_test_ge_fail.cpp ;
|
||||||
|
|
||||||
run is_same_test.cpp ;
|
run is_same_test.cpp ;
|
||||||
|
|
||||||
@@ -94,5 +110,13 @@ compile-fail scoped_enum_compile_fail_conv_to_int.cpp ;
|
|||||||
|
|
||||||
run underlying_type.cpp ;
|
run underlying_type.cpp ;
|
||||||
|
|
||||||
|
run pointer_traits_to_address_test.cpp ;
|
||||||
|
run pointer_traits_pointer_test.cpp ;
|
||||||
|
run pointer_traits_element_type_test.cpp ;
|
||||||
|
run pointer_traits_difference_type_test.cpp ;
|
||||||
|
run pointer_traits_rebind_test.cpp ;
|
||||||
|
run pointer_traits_pointer_to_test.cpp ;
|
||||||
|
run to_address_test.cpp ;
|
||||||
|
|
||||||
use-project /boost/core/swap : ./swap ;
|
use-project /boost/core/swap : ./swap ;
|
||||||
build-project ./swap ;
|
build-project ./swap ;
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.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
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <boost/core/addressof.hpp>
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
|
||||||
|
!defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||||
|
struct type { };
|
||||||
|
|
||||||
|
inline const type function()
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
(void)boost::addressof(function());
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#error Requires rvalue references and deleted functions
|
||||||
|
#endif
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// get_pointer_test.cpp
|
// get_pointer_test.cpp
|
||||||
//
|
//
|
||||||
// Copyright 2014 Peter Dimov
|
// Copyright 2014, 2017 Peter Dimov
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// See accompanying file LICENSE_1_0.txt or copy at
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@@ -27,11 +27,23 @@ int main()
|
|||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
X * p = 0;
|
||||||
|
BOOST_TEST( get_pointer( p ) == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
#if !defined( BOOST_NO_AUTO_PTR )
|
#if !defined( BOOST_NO_AUTO_PTR )
|
||||||
|
|
||||||
{
|
{
|
||||||
std::auto_ptr< X > p( new X );
|
std::auto_ptr< X > p( new X );
|
||||||
BOOST_TEST( get_pointer( p ) == p.get() );
|
BOOST_TEST( get_pointer( p ) == p.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::auto_ptr< X > p;
|
||||||
|
BOOST_TEST( get_pointer( p ) == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_SMART_PTR )
|
#if !defined( BOOST_NO_CXX11_SMART_PTR )
|
||||||
@@ -41,11 +53,21 @@ int main()
|
|||||||
BOOST_TEST( get_pointer( p ) == p.get() );
|
BOOST_TEST( get_pointer( p ) == p.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::unique_ptr< X > p;
|
||||||
|
BOOST_TEST( get_pointer( p ) == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::shared_ptr< X > p( new X );
|
std::shared_ptr< X > p( new X );
|
||||||
BOOST_TEST( get_pointer( p ) == p.get() );
|
BOOST_TEST( get_pointer( p ) == p.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::shared_ptr< X > p;
|
||||||
|
BOOST_TEST( get_pointer( p ) == 0 );
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// Test BOOST_TEST_EQ( p, nullptr )
|
||||||
|
//
|
||||||
|
// Copyright 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/config.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
#if !defined( BOOST_NO_CXX11_NULLPTR )
|
||||||
|
|
||||||
|
int x = 0;
|
||||||
|
int* p1 = 0;
|
||||||
|
int* p2 = &x;
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( p1, nullptr );
|
||||||
|
BOOST_TEST_NE( p2, nullptr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// Negative test for BOOST_TEST_GE
|
||||||
|
//
|
||||||
|
// Copyright 2017 Kohei Takahashi
|
||||||
|
//
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
BOOST_TEST_GE( x, 1 );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// Negative test for BOOST_TEST_GT
|
||||||
|
//
|
||||||
|
// Copyright 2017 Kohei Takahashi
|
||||||
|
//
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
BOOST_TEST_GT( x, 0 );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// Test for BOOST_TEST_GT, BOOST_TEST_GE
|
||||||
|
//
|
||||||
|
// Copyright 2017 Kohei Takahashi
|
||||||
|
//
|
||||||
|
// 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()
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
BOOST_TEST_GT( x, -1 );
|
||||||
|
BOOST_TEST_GT( ++x, 0 );
|
||||||
|
BOOST_TEST_GT( x++, 0 );
|
||||||
|
|
||||||
|
BOOST_TEST_GE( x, 2 );
|
||||||
|
BOOST_TEST_GE( ++x, 3 );
|
||||||
|
BOOST_TEST_GE( x++, 3 );
|
||||||
|
|
||||||
|
int y = 5;
|
||||||
|
|
||||||
|
BOOST_TEST_GT( ++y, ++x );
|
||||||
|
BOOST_TEST_GT( y++, x++ );
|
||||||
|
|
||||||
|
BOOST_TEST_GE( ++y, x );
|
||||||
|
BOOST_TEST_GE( y++, x++ );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// Negative test for BOOST_TEST_LE
|
||||||
|
//
|
||||||
|
// Copyright 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/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int x = 1;
|
||||||
|
|
||||||
|
BOOST_TEST_LE( x, 0 );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// Negative test for BOOST_TEST_LT
|
||||||
|
//
|
||||||
|
// Copyright 2014, 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/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
BOOST_TEST_LT( x, 0 );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// Test for BOOST_TEST_LT, BOOST_TEST_LE
|
||||||
|
//
|
||||||
|
// Copyright 2014, 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/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int x = 0;
|
||||||
|
|
||||||
|
BOOST_TEST_LT( x, 1 );
|
||||||
|
BOOST_TEST_LT( ++x, 2 );
|
||||||
|
BOOST_TEST_LT( x++, 3 );
|
||||||
|
|
||||||
|
BOOST_TEST_LE( x, 2 );
|
||||||
|
BOOST_TEST_LE( ++x, 3 );
|
||||||
|
BOOST_TEST_LE( x++, 4 );
|
||||||
|
|
||||||
|
int y = 3;
|
||||||
|
|
||||||
|
BOOST_TEST_LT( ++y, ++x );
|
||||||
|
BOOST_TEST_LT( y++, x++ );
|
||||||
|
|
||||||
|
BOOST_TEST_LE( ++y, x );
|
||||||
|
BOOST_TEST_LE( y++, x++ );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
struct X
|
struct X
|
||||||
@@ -64,11 +65,24 @@ int main()
|
|||||||
|
|
||||||
BOOST_TEST_EQ( ++x, ++y );
|
BOOST_TEST_EQ( ++x, ++y );
|
||||||
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
|
||||||
|
|
||||||
BOOST_TEST_NE( ++x, y );
|
BOOST_TEST_NE( ++x, y );
|
||||||
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
|
// BOOST_TEST_THROWS
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#include <boost/core/pointer_traits.hpp>
|
||||||
|
#include <boost/core/is_same.hpp>
|
||||||
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct P { };
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct E {
|
||||||
|
typedef long difference_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<std::ptrdiff_t,
|
||||||
|
boost::pointer_traits<int*>::difference_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<std::ptrdiff_t,
|
||||||
|
boost::pointer_traits<P<int> >::difference_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<long,
|
||||||
|
boost::pointer_traits<E<int> >::difference_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<std::ptrdiff_t,
|
||||||
|
boost::pointer_traits<void*>::difference_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<std::ptrdiff_t,
|
||||||
|
boost::pointer_traits<P<void> >::difference_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<long,
|
||||||
|
boost::pointer_traits<E<void> >::difference_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<std::ptrdiff_t,
|
||||||
|
boost::pointer_traits<const int*>::difference_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<std::ptrdiff_t,
|
||||||
|
boost::pointer_traits<P<const int> >::difference_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<long,
|
||||||
|
boost::pointer_traits<E<const int> >::difference_type>));
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#include <boost/core/pointer_traits.hpp>
|
||||||
|
#include <boost/core/is_same.hpp>
|
||||||
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct P1 { };
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct P2 { };
|
||||||
|
|
||||||
|
template<class T1, class T2, class T3>
|
||||||
|
struct P3 { };
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct E1 {
|
||||||
|
typedef bool element_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct E2 {
|
||||||
|
typedef bool element_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T1, class T2, class T3>
|
||||||
|
struct E3 {
|
||||||
|
typedef bool element_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
template<class T, class... U>
|
||||||
|
struct P { };
|
||||||
|
|
||||||
|
template<class T, class... U>
|
||||||
|
struct E {
|
||||||
|
typedef bool element_type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int,
|
||||||
|
boost::pointer_traits<int*>::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int,
|
||||||
|
boost::pointer_traits<P1<int> >::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int,
|
||||||
|
boost::pointer_traits<P2<int, char> >::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int,
|
||||||
|
boost::pointer_traits<P3<int, char, char> >::element_type>));
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int,
|
||||||
|
boost::pointer_traits<P<int, char, char, char> >::element_type>));
|
||||||
|
#endif
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<bool,
|
||||||
|
boost::pointer_traits<E1<int> >::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<bool,
|
||||||
|
boost::pointer_traits<E2<int, int> >::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<bool,
|
||||||
|
boost::pointer_traits<E3<int, int, int> >::element_type>));
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<bool,
|
||||||
|
boost::pointer_traits<E<int, int, int, int> >::element_type>));
|
||||||
|
#endif
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<void,
|
||||||
|
boost::pointer_traits<void*>::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<void,
|
||||||
|
boost::pointer_traits<P1<void> >::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<bool,
|
||||||
|
boost::pointer_traits<E1<void> >::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<const int,
|
||||||
|
boost::pointer_traits<const int*>::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<const int,
|
||||||
|
boost::pointer_traits<P1<const int> >::element_type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<bool,
|
||||||
|
boost::pointer_traits<E1<const int> >::element_type>));
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#include <boost/core/pointer_traits.hpp>
|
||||||
|
#include <boost/core/is_same.hpp>
|
||||||
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct P { };
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
|
||||||
|
boost::pointer_traits<int*>::pointer>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P<int>,
|
||||||
|
boost::pointer_traits<P<int> >::pointer>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<void*,
|
||||||
|
boost::pointer_traits<void*>::pointer>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P<void>,
|
||||||
|
boost::pointer_traits<P<void> >::pointer>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<const int*,
|
||||||
|
boost::pointer_traits<const int*>::pointer>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P<const int>,
|
||||||
|
boost::pointer_traits<P<const int> >::pointer>));
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#include <boost/core/pointer_traits.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class pointer {
|
||||||
|
public:
|
||||||
|
typedef typename boost::pointer_traits<T>::element_type element_type;
|
||||||
|
pointer(T value)
|
||||||
|
: value_(value) { }
|
||||||
|
T get() const BOOST_NOEXCEPT {
|
||||||
|
return value_;
|
||||||
|
}
|
||||||
|
static pointer<T> pointer_to(element_type& value) {
|
||||||
|
return pointer<T>(&value);
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
T value_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline bool
|
||||||
|
operator==(const pointer<T>& lhs, const pointer<T>& rhs) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return lhs.get() == rhs.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
{
|
||||||
|
typedef int* type;
|
||||||
|
type p = &i;
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::pointer_to(i) == p);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<int*> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::pointer_to(i) == p);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<pointer<int*> > type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::pointer_to(i) == p);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef const int* type;
|
||||||
|
type p = &i;
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::pointer_to(i) == p);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<const int*> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::pointer_to(i) == p);
|
||||||
|
}
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#include <boost/core/pointer_traits.hpp>
|
||||||
|
#include <boost/core/is_same.hpp>
|
||||||
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct P1 { };
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct P2 { };
|
||||||
|
|
||||||
|
template<class T1, class T2, class T3>
|
||||||
|
struct P3 { };
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
|
template<class T>
|
||||||
|
struct E1 {
|
||||||
|
template<class U>
|
||||||
|
using rebind = E1<bool>;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T1, class T2>
|
||||||
|
struct E2 {
|
||||||
|
template<class U>
|
||||||
|
using rebind = E2<bool, T2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T1, class T2, class T3>
|
||||||
|
struct E3 {
|
||||||
|
template<class U>
|
||||||
|
using rebind = E3<bool, T2, T3>;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
template<class T, class... U>
|
||||||
|
struct P { };
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
|
template<class T, class... U>
|
||||||
|
struct E {
|
||||||
|
template<class V>
|
||||||
|
using rebind = E<bool, U...>;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct R { };
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<char*,
|
||||||
|
boost::pointer_traits<R*>::rebind_to<char>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<char>,
|
||||||
|
boost::pointer_traits<P1<R> >::rebind_to<char>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P2<char, R>,
|
||||||
|
boost::pointer_traits<P2<R, R> >::rebind_to<char>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P3<char, R, R>,
|
||||||
|
boost::pointer_traits<P3<R, R, R> >::rebind_to<char>::type>));
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P<char, R, R, R>,
|
||||||
|
boost::pointer_traits<P<R, R, R, R> >::rebind_to<char>::type>));
|
||||||
|
#endif
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<void*,
|
||||||
|
boost::pointer_traits<R*>::rebind_to<void>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<void>,
|
||||||
|
boost::pointer_traits<P1<R> >::rebind_to<void>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<R*,
|
||||||
|
boost::pointer_traits<void*>::rebind_to<R>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<R>,
|
||||||
|
boost::pointer_traits<P1<void> >::rebind_to<R>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<const int*,
|
||||||
|
boost::pointer_traits<R*>::rebind_to<const int>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<const int>,
|
||||||
|
boost::pointer_traits<P1<R> >::rebind_to<const int>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
|
||||||
|
boost::pointer_traits<const R*>::rebind_to<int>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P1<int>,
|
||||||
|
boost::pointer_traits<P1<const R> >::rebind_to<int>::type>));
|
||||||
|
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
|
||||||
|
boost::pointer_traits<E1<R> >::rebind_to<char>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E2<bool, R>,
|
||||||
|
boost::pointer_traits<E2<R, R> >::rebind_to<char>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E3<bool, R, R>,
|
||||||
|
boost::pointer_traits<E3<R, R, R> >::rebind_to<char>::type>));
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E<bool, R, R, R>,
|
||||||
|
boost::pointer_traits<E<R, R, R, R> >::rebind_to<char>::type>));
|
||||||
|
#endif
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
|
||||||
|
boost::pointer_traits<E1<R> >::rebind_to<void>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
|
||||||
|
boost::pointer_traits<E1<void> >::rebind_to<R>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
|
||||||
|
boost::pointer_traits<E1<R> >::rebind_to<const int>::type>));
|
||||||
|
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<E1<bool>,
|
||||||
|
boost::pointer_traits<E1<const R> >::rebind_to<int>::type>));
|
||||||
|
#endif
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#include <boost/core/pointer_traits.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class pointer {
|
||||||
|
public:
|
||||||
|
typedef typename boost::pointer_traits<T>::element_type element_type;
|
||||||
|
pointer(T value)
|
||||||
|
: value_(value) { }
|
||||||
|
T operator->() const BOOST_NOEXCEPT {
|
||||||
|
return value_;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
T value_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class special {
|
||||||
|
public:
|
||||||
|
special(T* value)
|
||||||
|
: value_(value) { }
|
||||||
|
T* get() const BOOST_NOEXCEPT {
|
||||||
|
return value_;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
T* value_;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct pointer_traits<special<T> > {
|
||||||
|
typedef special<T> pointer;
|
||||||
|
typedef T element_type;
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
template<class U>
|
||||||
|
struct rebind_to {
|
||||||
|
typedef special<U> type;
|
||||||
|
};
|
||||||
|
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
|
template<class U>
|
||||||
|
using rebind = typename rebind_to<U>::type;
|
||||||
|
#endif
|
||||||
|
template<class U>
|
||||||
|
static pointer pointer_to(U& v) BOOST_NOEXCEPT {
|
||||||
|
return pointer(&v);
|
||||||
|
}
|
||||||
|
static element_type* to_address(const pointer& v) BOOST_NOEXCEPT {
|
||||||
|
return v.get();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
{
|
||||||
|
typedef int* type;
|
||||||
|
type p = &i;
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<int*> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<pointer<int*> > type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef void* type;
|
||||||
|
type p = &i;
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<void*> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef const int* type;
|
||||||
|
type p = &i;
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<const int*> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef special<int> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef special<void> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef special<const int> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<special<int> > type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<special<void> > type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<special<const int> > type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::pointer_traits<type>::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2017 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
*/
|
||||||
|
#include <boost/core/pointer_traits.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class pointer {
|
||||||
|
public:
|
||||||
|
typedef typename boost::pointer_traits<T>::element_type element_type;
|
||||||
|
pointer(T value)
|
||||||
|
: value_(value) { }
|
||||||
|
T operator->() const BOOST_NOEXCEPT {
|
||||||
|
return value_;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
T value_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class special {
|
||||||
|
public:
|
||||||
|
special(T* value)
|
||||||
|
: value_(value) { }
|
||||||
|
T* get() const BOOST_NOEXCEPT {
|
||||||
|
return value_;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
T* value_;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct pointer_traits<special<T> > {
|
||||||
|
typedef special<T> pointer;
|
||||||
|
typedef T element_type;
|
||||||
|
typedef std::ptrdiff_t difference_type;
|
||||||
|
template<class U>
|
||||||
|
struct rebind_to {
|
||||||
|
typedef special<U> type;
|
||||||
|
};
|
||||||
|
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
|
template<class U>
|
||||||
|
using rebind = typename rebind_to<U>::type;
|
||||||
|
#endif
|
||||||
|
template<class U>
|
||||||
|
static pointer pointer_to(U& v) BOOST_NOEXCEPT {
|
||||||
|
return pointer(&v);
|
||||||
|
}
|
||||||
|
static element_type* to_address(const pointer& v) BOOST_NOEXCEPT {
|
||||||
|
return v.get();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
{
|
||||||
|
typedef int* type;
|
||||||
|
type p = &i;
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<int*> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<pointer<int*> > type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef void* type;
|
||||||
|
type p = &i;
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<void*> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef const int* type;
|
||||||
|
type p = &i;
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<const int*> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef special<int> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef special<void> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef special<const int> type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<special<int> > type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<special<void> > type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef pointer<special<const int> > type;
|
||||||
|
type p(&i);
|
||||||
|
BOOST_TEST(boost::to_address(p) == &i);
|
||||||
|
}
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user