Compare commits

...

43 Commits

Author SHA1 Message Date
f03b681d01 Increased the number of git fetch jobs to 8 in CI. 2019-01-15 18:34:38 +03:00
e120a83d1e Revert "Use depinst to install dependencies in CI. Increase the number of git fetch jobs to 8."
This reverts commit 424fea5881.

By request from Peter Dimov in 424fea5881 (commitcomment-31945411).

The manual enumeration of Boost.Utility dependencies server as a detection
mechanism for unwanted dependencies creep in.
2019-01-15 18:28:28 +03:00
424fea5881 Use depinst to install dependencies in CI. Increase the number of git fetch jobs to 8. 2019-01-15 14:06:11 +03:00
53d9aa9d2f Use the actual number of logical CPUs for the number of CI build/test jobs. 2019-01-03 23:23:55 +03:00
ce64b13846 Added tools/boost_install and libs/headers manual checkout to CI jobs. 2018-12-18 22:14:06 +03:00
32c50e0814 Added an experimental partial CMakeLists.txt for dependency tracking in CMake projects. 2018-12-18 19:51:11 +03:00
05dda09fd3 Added libstdc++5 installation in the clang 7 job.
Apparently, a more recent libstdc++ is needed by Boost.StringView in C++14
and later mode.
2018-11-02 12:12:15 +03:00
a4cafcc75d Added gcc 8 and clang 7 CI jobs. 2018-11-01 20:36:52 +03:00
796fb965be Merge branch 'develop' 2018-11-01 17:17:11 +03:00
08da98a551 Added a readme file.
For Boost.Utility logo thanks to Adam Wulkiewicz. The logo was taken from:

https://github.com/awulkiew/boost-logos
2018-11-01 17:09:34 +03:00
57b027f1cd Merge branch 'develop' 2018-09-23 08:47:11 -04:00
db05c11f50 Fix string_ref::find/rfind's handling of empty strings. Thanks to 'reluctantbugreporter' for the bug report 2018-09-14 09:48:13 -07:00
3d2a7f0c17 Merge pull request #49 from boostorg/final
Avoid inheritance for final types in compressed_pair
2018-09-12 22:29:26 -04:00
8858bad352 Merge pull request #38 from danieljames/feature/fix-links
Fix some links
2018-09-11 08:35:08 -04:00
fc135e0d72 Avoid inheritance for final types in compressed_pair 2018-09-09 17:34:22 -04:00
ebe44296ca Add boilerplate reference to LICENSE_1_0.txt 2018-07-31 01:46:53 +03:00
bdf55e0b6f Add boilerplate reference to LICENSE_1_0.txt 2018-07-31 00:22:42 +03:00
d4170ccdb5 Merge pull request #45 from dimztimz/develop
Implement boost hash for string_view
2018-05-01 07:51:36 -07:00
e2d115db97 Use hash_fwd.hpp in string_view for more lightweight dependencies. 2018-04-20 23:18:31 +02:00
15cfa44937 Boost detail is dependency of boost hash. 2018-04-20 14:07:33 +02:00
473be2e4c1 Boost integer is dependency of boost hash. 2018-04-20 13:58:12 +02:00
6ad6bc005c Implement boost hash for string_view 2018-04-20 13:42:07 +02:00
7709f0e430 Merge pull request #42 from dimztimz/develop
Faster find functions in string_view by using traits::find()
2018-04-09 16:34:23 -07:00
eacea4664d implement string_view.find(string) in terms of traits.compare and find.
This should be faster that it's previous implementations
in terms of std::search()
2018-04-02 00:52:57 +02:00
1fe5af5264 Faster find functions in string_view by using traits::find() 2018-04-01 20:00:03 +02:00
d2fb06e6a0 Fix another link 2018-01-12 10:48:52 +00:00
73baeb7a63 Fix some links 2018-01-11 18:01:50 +00:00
56f13625b1 Fix link to declval 2017-12-24 00:33:12 +02:00
ac4e8da91d Only install the necessary submodules in Travis and Appveyor 2017-12-24 00:28:06 +02:00
426836d860 Remove shared_iterator files (they're in Iterator now) 2017-12-24 00:05:50 +02:00
82df2b82fc Merge pull request #37 from glenfe/develop
Utility tests should use lightweight_test instead of test
2017-12-23 21:52:07 +02:00
f8a243bcff Utility tests should use lightweight_test instead of test 2017-12-23 13:00:33 -05:00
51f7f7f53e Add -d0 to b2 headers on Appveyor 2017-12-23 12:01:03 +02:00
5f535a151c Add -j3 to Travis 2017-12-23 11:56:09 +02:00
c88936800d Remove dependency on Random in operators_test.cpp 2017-12-23 06:19:43 +02:00
96fbce5759 Remove use of shared_ptr in test/value_init_test.cpp 2017-12-23 04:44:29 +02:00
9d46de1578 Replace use of mpl/has_xxx.hpp with handwritten traits 2017-12-21 06:30:03 +02:00
976a4d2fc1 Merge branch 'develop' into feature/result_of-no-mpl 2017-12-20 23:16:08 +02:00
ea81279b35 Add appveyor.yml 2017-12-20 23:14:36 +02:00
7d101d420c Replace mpl primitives with type_traits 2017-12-20 21:55:07 +02:00
d8acfef27b Update includes in utility.hpp; add deprecation comment 2017-12-02 04:35:22 +02:00
d7ae336915 Merge branch 'master' into develop 2017-12-02 03:47:03 +02:00
b74f49f1e5 Remove dependency on iterator in <boost/utility.hpp> 2017-12-02 03:38:29 +02:00
44 changed files with 1462 additions and 1141 deletions

View File

@ -88,6 +88,17 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-8
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
@ -175,27 +186,64 @@ matrix:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
- os: linux
compiler: clang++-6.0
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17
addons:
apt:
packages:
- clang-6.0
- libstdc++-5-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- os: linux
compiler: clang++-7
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17
addons:
apt:
packages:
- clang-7
- libstdc++-5-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-7
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- GIT_FETCH_JOBS=8
- BOOST_BRANCH=develop
- if [ "$TRAVIS_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi
- cd ..
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- git submodule init tools/build
- git submodule init tools/boost_install
- git submodule init libs/headers
- git submodule init libs/assert
- git submodule init libs/config
- git submodule init libs/core
- git submodule init libs/preprocessor
- git submodule init libs/static_assert
- git submodule init libs/throw_exception
- git submodule init libs/type_traits
- git submodule init libs/container_hash
- git submodule init libs/integer
- git submodule init libs/detail
- git submodule update --jobs $GIT_FETCH_JOBS
- cp -r $TRAVIS_BUILD_DIR/* libs/utility
- python tools/boostdep/depinst/depinst.py utility
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 libs/utility/test toolset=$TOOLSET cxxstd=$CXXSTD
- BUILD_JOBS=`(nproc || sysctl -n hw.ncpu) 2> /dev/null`
- ./b2 -j $BUILD_JOBS libs/utility/test toolset=$TOOLSET cxxstd=$CXXSTD
notifications:
email:

27
CMakeLists.txt Normal file
View File

@ -0,0 +1,27 @@
# Copyright 2018 Peter Dimov
# Copyright 2018 Andrey Semashev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
# Partial (add_subdirectory only) and experimental CMake support
# Subject to change; please do not rely on the contents of this file yet.
cmake_minimum_required(VERSION 3.5)
project(BoostUtility LANGUAGES CXX)
add_library(boost_utility INTERFACE)
add_library(Boost::utility ALIAS boost_utility)
target_include_directories(boost_utility INTERFACE include)
target_link_libraries(boost_utility
INTERFACE
Boost::config
Boost::container_hash
Boost::core
Boost::preprocessor
Boost::static_assert
Boost::throw_exception
Boost::type_traits
)

24
README.md Normal file
View File

@ -0,0 +1,24 @@
# ![Boost.Utility](doc/logo.png)
Boost.Utility, part of collection of the [Boost C++ Libraries](https://github.com/boostorg), provides a number of smaller components, too small to be called libraries in their own right. See the documentation for the list of components.
### Directories
* **doc** - Documentation sources
* **include** - Interface headers of Boost.Utility
* **test** - Boost.Utility unit tests
### More information
* [Documentation](https://boost.org/libs/utility)
* [Report bugs](https://github.com/boostorg/utility/issues/new). Be sure to mention Boost version, Boost.Utility component, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well.
* Submit your patches as pull requests against **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt).
### Build status
Master: [![Travis CI](https://travis-ci.org/boostorg/utility.svg?branch=master)](https://travis-ci.org/boostorg/utility)
Develop: [![Travis CI](https://travis-ci.org/boostorg/utility.svg?branch=develop)](https://travis-ci.org/boostorg/utility)
### License
Distributed under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt).

55
appveyor.yml Normal file
View File

@ -0,0 +1,55 @@
# Copyright 2016, 2017 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- master
- develop
- /feature\/.*/
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
CXXSTD: 14,17
install:
- set GIT_FETCH_JOBS=8
- set BOOST_BRANCH=develop
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
- cd ..
- git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule init tools/build
- git submodule init tools/boost_install
- git submodule init libs/headers
- git submodule init libs/assert
- git submodule init libs/config
- git submodule init libs/core
- git submodule init libs/preprocessor
- git submodule init libs/static_assert
- git submodule init libs/throw_exception
- git submodule init libs/type_traits
- git submodule init libs/container_hash
- git submodule init libs/integer
- git submodule init libs/detail
- git submodule update --jobs %GIT_FETCH_JOBS%
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\utility
- cmd /c bootstrap
- b2 -d0 headers
build: off
test_script:
- PATH=%ADDPATH%%PATH%
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- b2 -j %NUMBER_OF_PROCESSORS% libs/utility/test toolset=%TOOLSET% %CXXSTD%

View File

@ -493,7 +493,7 @@ call_traits can not be used with reference or array types.</p>
<h4>Example 1:</h4>
<p>The following class is a trivial class that stores some type T
by value (see the <a href="call_traits_test.cpp">call_traits_test.cpp</a>
by value (see the <a href="test/call_traits_test.cpp">call_traits_test.cpp</a>
file), the aim is to illustrate how each of the available
call_traits typedefs may be used:</p>

View File

@ -356,7 +356,7 @@ templates that can be controlled and automated with macros. The
implementation uses the [@../../../preprocessor/index.html Preprocessor library].
* [@http://www.boost.org/people/daryle_walker.html">Daryle Walker] started the
library. Contributed the test file [@../../base_from_member_test.cpp
library. Contributed the test file [@../../test/base_from_member_test.cpp
base_from_member_test.cpp].
[endsect]

BIN
doc/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

539
doc/logo.svg Normal file
View File

@ -0,0 +1,539 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="744.09448819"
height="1052.3622047"
id="svg6858"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="utility.svg">
<defs
id="defs6860">
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4453-7-8-6-7-3-5"
id="linearGradient10687-2-5"
gradientUnits="userSpaceOnUse"
x1="753.02301"
y1="3132.0801"
x2="1146.25"
y2="3132.0801" />
<linearGradient
id="linearGradient4453-7-8-6-7-3-5">
<stop
style="stop-color:#aac4dd;stop-opacity:1;"
offset="0"
id="stop4455-61-8-7-1-2-8" />
<stop
style="stop-color:#c2dbe9;stop-opacity:1;"
offset="1"
id="stop4457-4-1-9-1-12-1" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4453-7-8-6-7-3-5"
id="linearGradient10685-2-2"
gradientUnits="userSpaceOnUse"
x1="753.02301"
y1="3132.0801"
x2="1146.25"
y2="3132.0801" />
<linearGradient
id="linearGradient6749">
<stop
style="stop-color:#aac4dd;stop-opacity:1;"
offset="0"
id="stop6751" />
<stop
style="stop-color:#c2dbe9;stop-opacity:1;"
offset="1"
id="stop6753" />
</linearGradient>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath3387-3-6-4-2-8-4">
<path
inkscape:connector-curvature="0"
d="m 862.109,3289.75 -109.086,-190.45 69.122,-124.42 164.511,-0.47 c 0,0 111.044,188.28 116.564,197.63 7.66,0 43.03,0 43.03,0 l -67.03,117.71 -217.111,0 z"
id="path3389-2-0-7-7-8-9" />
</clipPath>
<linearGradient
y2="3132.0801"
x2="1146.25"
y1="3132.0801"
x1="753.02301"
gradientUnits="userSpaceOnUse"
id="linearGradient4492-8-8"
xlink:href="#linearGradient4453-7-8-6-7-3-5"
inkscape:collect="always" />
<linearGradient
id="linearGradient6758">
<stop
style="stop-color:#aac4dd;stop-opacity:1;"
offset="0"
id="stop6760" />
<stop
style="stop-color:#c2dbe9;stop-opacity:1;"
offset="1"
id="stop6762" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4453-7-8-6-7-3-5"
id="linearGradient10691-7-8"
gradientUnits="userSpaceOnUse"
x1="1026.6899"
y1="2937.73"
x2="1463.14"
y2="2937.73" />
<linearGradient
id="linearGradient6765">
<stop
style="stop-color:#aac4dd;stop-opacity:1;"
offset="0"
id="stop6767" />
<stop
style="stop-color:#c2dbe9;stop-opacity:1;"
offset="1"
id="stop6769" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4453-7-8-6-7-3-5"
id="linearGradient10689-4-2"
gradientUnits="userSpaceOnUse"
x1="1026.6899"
y1="2937.73"
x2="1463.14"
y2="2937.73" />
<linearGradient
id="linearGradient6772">
<stop
style="stop-color:#aac4dd;stop-opacity:1;"
offset="0"
id="stop6774" />
<stop
style="stop-color:#c2dbe9;stop-opacity:1;"
offset="1"
id="stop6776" />
</linearGradient>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath3369-1-5-6-1-0-7">
<path
inkscape:connector-curvature="0"
d="m 1131.64,3128.5 -104.95,-181.12 116.38,-200.42 208.05,0.94 112.02,191.63 -112.08,188.97 -219.42,0 z"
id="path3371-89-4-1-6-0-1" />
</clipPath>
<linearGradient
y2="2937.73"
x2="1463.14"
y1="2937.73"
x1="1026.6899"
gradientUnits="userSpaceOnUse"
id="linearGradient4498-5-7"
xlink:href="#linearGradient4453-7-8-6-7-3-5"
inkscape:collect="always" />
<linearGradient
id="linearGradient6781">
<stop
style="stop-color:#aac4dd;stop-opacity:1;"
offset="0"
id="stop6783" />
<stop
style="stop-color:#c2dbe9;stop-opacity:1;"
offset="1"
id="stop6785" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4459-1-2-8-9-9-5"
id="linearGradient10695-9-9"
gradientUnits="userSpaceOnUse"
x1="646.55499"
y1="2736.25"
x2="1088.27"
y2="2736.25" />
<linearGradient
id="linearGradient4459-1-2-8-9-9-5">
<stop
id="stop4461-2-1-5-2-5-0"
offset="0"
style="stop-color:#839bc2;stop-opacity:1;" />
<stop
id="stop4463-3-2-8-7-30-3"
offset="1"
style="stop-color:#9fb6d4;stop-opacity:1;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4459-1-2-8-9-9-5"
id="linearGradient10693-9-4"
gradientUnits="userSpaceOnUse"
x1="646.55499"
y1="2736.25"
x2="1088.27"
y2="2736.25" />
<linearGradient
id="linearGradient6792">
<stop
id="stop6794"
offset="0"
style="stop-color:#839bc2;stop-opacity:1;" />
<stop
id="stop6796"
offset="1"
style="stop-color:#9fb6d4;stop-opacity:1;" />
</linearGradient>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath3351-4-7-3-5-95-0">
<path
inkscape:connector-curvature="0"
d="m 757.242,2926.25 -110.687,-189.11 110.656,-190.89 219.437,0 111.622,189.1 -111.59,190.9 -219.438,0 z"
id="path3353-1-9-3-4-1-1" />
</clipPath>
<linearGradient
y2="2736.25"
x2="1088.27"
y1="2736.25"
x1="646.55499"
gradientUnits="userSpaceOnUse"
id="linearGradient4510-1-5"
xlink:href="#linearGradient4459-1-2-8-9-9-5"
inkscape:collect="always" />
<linearGradient
id="linearGradient6801">
<stop
id="stop6803"
offset="0"
style="stop-color:#839bc2;stop-opacity:1;" />
<stop
id="stop6805"
offset="1"
style="stop-color:#9fb6d4;stop-opacity:1;" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#radialGradient3327-8-4-8-0-2-4"
id="radialGradient10699-1-3"
gradientUnits="userSpaceOnUse"
cx="997.46997"
cy="2896.25"
fx="997.46997"
fy="2896.25"
r="583.73999" />
<radialGradient
fx="0"
fy="0"
cx="0"
cy="0"
r="1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(58.375,0,0,-58.375,99.75,289.625)"
spreadMethod="pad"
id="radialGradient3327-8-4-8-0-2-4">
<stop
style="stop-opacity:1;stop-color:#aeaeb3"
offset="0"
id="stop3329-7-0-1-0-33-2" />
<stop
style="stop-opacity:1;stop-color:#ffffff"
offset="0.949438"
id="stop3331-4-3-0-0-97-3" />
<stop
style="stop-opacity:1;stop-color:#ffffff"
offset="1"
id="stop3333-2-4-9-7-2-2" />
</radialGradient>
<radialGradient
r="583.73999"
fy="2896.25"
fx="997.46997"
cy="2896.25"
cx="997.46997"
gradientUnits="userSpaceOnUse"
id="radialGradient13050"
xlink:href="#radialGradient3327-8-4-8-0-2-4"
inkscape:collect="always" />
<radialGradient
fx="0"
fy="0"
cx="0"
cy="0"
r="1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(58.375,0,0,-58.375,99.75,289.625)"
spreadMethod="pad"
id="radialGradient6813">
<stop
style="stop-opacity:1;stop-color:#aeaeb3"
offset="0"
id="stop6815" />
<stop
style="stop-opacity:1;stop-color:#ffffff"
offset="0.949438"
id="stop6817" />
<stop
style="stop-opacity:1;stop-color:#ffffff"
offset="1"
id="stop6819" />
</radialGradient>
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath3323-7-2-4-5-3-4">
<path
inkscape:connector-curvature="0"
d="m 997.469,2312.51 c -322.379,0 -583.739,261.36 -583.739,583.74 0,322.38 261.36,583.74 583.739,583.74 322.381,0 583.741,-261.36 583.741,-583.74 0,-322.38 -261.36,-583.74 -583.741,-583.74"
id="path3325-9-2-9-5-04-9" />
</clipPath>
<radialGradient
r="583.73999"
fy="2896.25"
fx="997.46997"
cy="2896.25"
cx="997.46997"
gradientUnits="userSpaceOnUse"
id="radialGradient4516-8-2"
xlink:href="#radialGradient3327-8-4-8-0-2-4"
inkscape:collect="always" />
<radialGradient
fx="0"
fy="0"
cx="0"
cy="0"
r="1"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(58.375,0,0,-58.375,99.75,289.625)"
spreadMethod="pad"
id="radialGradient6824">
<stop
style="stop-opacity:1;stop-color:#aeaeb3"
offset="0"
id="stop6826" />
<stop
style="stop-opacity:1;stop-color:#ffffff"
offset="0.949438"
id="stop6828" />
<stop
style="stop-opacity:1;stop-color:#ffffff"
offset="1"
id="stop6830" />
</radialGradient>
<radialGradient
r="583.73999"
fy="2896.25"
fx="997.46997"
cy="2896.25"
cx="997.46997"
gradientUnits="userSpaceOnUse"
id="radialGradient6856"
xlink:href="#radialGradient3327-8-4-8-0-2-4"
inkscape:collect="always" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="234.05635"
inkscape:cy="581.46313"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1680"
inkscape:window-height="982"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid3066" />
</sodipodi:namedview>
<metadata
id="metadata6863">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g3319-1-2-5-1-4-4"
transform="matrix(0.10419818,0,0,-0.10419818,137.10955,897.00327)"
style="fill:url(#radialGradient10699-1-3);fill-opacity:1"
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
inkscape:export-xdpi="63.625523"
inkscape:export-ydpi="63.625523">
<g
clip-path="url(#clipPath3323-7-2-4-5-3-4)"
id="g3321-9-2-7-4-3-9"
style="fill:url(#radialGradient6856);fill-opacity:1">
<path
id="path3335-8-7-3-8-92-0"
style="fill:url(#radialGradient4516-8-2);fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 997.469,2312.51 c -322.379,0 -583.739,261.36 -583.739,583.74 0,322.38 261.36,583.74 583.739,583.74 322.381,0 583.741,-261.36 583.741,-583.74 0,-322.38 -261.36,-583.74 -583.741,-583.74"
inkscape:connector-curvature="0" />
</g>
</g>
<g
id="g3347-6-8-3-7-4-4"
transform="matrix(0.125,0,0,-0.125,112.08304,959.82207)"
style="fill:url(#linearGradient10695-9-9);fill-opacity:1"
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
inkscape:export-xdpi="63.625523"
inkscape:export-ydpi="63.625523">
<g
clip-path="url(#clipPath3351-4-7-3-5-95-0)"
id="g3349-5-5-4-7-9-4"
style="fill:url(#linearGradient10693-9-4);fill-opacity:1">
<path
id="path3361-0-8-2-9-0-9"
style="fill:url(#linearGradient4510-1-5);fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 757.242,2926.25 -110.687,-189.11 110.656,-190.89 219.437,0 111.622,189.1 -111.59,190.9 -219.438,0"
inkscape:connector-curvature="0" />
</g>
</g>
<path
id="path3363-6-9-0-1-5-8"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 194.34816,617.68335 13.106,-22.3925 25.99649,0 13.21487,22.60874 -13.21487,22.39125 -25.99649,0 -13.106,-22.60749 z m 40.53761,-24.8925 -28.86524,0 -0.72412,1.23749 -13.106,22.39251 -0.73575,1.25625 0.73087,1.26 13.106,22.60744 0.72263,1.24634 28.86374,0 0.72512,-1.22884 13.215,-22.39119 0.74625,-1.265 -0.74,-1.26751 -13.21537,-22.60875 -0.72313,-1.23874"
inkscape:connector-curvature="0"
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
inkscape:export-xdpi="63.625523"
inkscape:export-ydpi="63.625523" />
<g
id="g3365-0-4-1-9-7-5"
transform="matrix(0.125,0,0,-0.125,112.08304,959.82207)"
style="fill:url(#linearGradient10691-7-8);fill-opacity:1"
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
inkscape:export-xdpi="63.625523"
inkscape:export-ydpi="63.625523">
<g
clip-path="url(#clipPath3369-1-5-6-1-0-7)"
id="g3367-2-4-2-8-4-3"
style="fill:url(#linearGradient10689-4-2);fill-opacity:1">
<path
id="path3379-4-6-7-6-7-2"
style="fill:url(#linearGradient4498-5-7);fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 1131.64,3128.5 -104.95,-181.12 116.38,-200.42 208.05,0.94 112.02,191.63 -112.08,188.97 -219.42,0"
inkscape:connector-curvature="0" />
</g>
</g>
<path
id="path3381-6-8-0-0-66-3"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 241.86427,591.39959 12.3925,-21.38999 25.99625,0 13.27125,22.37625 -13.27125,22.7025 -24.56875,0.11 -13.82,-23.79876 z m 39.8125,-23.88999 -28.86125,0 -0.7225,1.24625 -12.3925,21.39 -0.72625,1.255 0.7275,1.25374 13.82,23.79876 0.7275,1.25125 1.44625,-0.006 24.56875,-0.11 1.4275,-0.006 0.72,-1.2325 13.27125,-22.7025 0.7425,-1.27 -0.75125,-1.26625 -13.27125,-22.37625 -0.72625,-1.225"
inkscape:connector-curvature="0"
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
inkscape:export-xdpi="63.625523"
inkscape:export-ydpi="63.625523" />
<g
id="g3383-5-5-2-2-3-0"
transform="matrix(0.125,0,0,-0.125,112.08304,959.82207)"
style="fill:url(#linearGradient10687-2-5);fill-opacity:1"
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
inkscape:export-xdpi="63.625523"
inkscape:export-ydpi="63.625523">
<g
clip-path="url(#clipPath3387-3-6-4-2-8-4)"
id="g3385-0-6-4-8-0-1"
style="fill:url(#linearGradient10685-2-2);fill-opacity:1">
<path
id="path3397-9-6-1-6-9-7"
style="fill:url(#linearGradient4492-8-8);fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 862.109,3289.75 -109.086,-190.45 69.122,-124.42 164.511,-0.47 c 0,0 111.044,188.28 116.564,197.63 7.66,0 43.03,0 43.03,0 l -67.03,117.71 -217.111,0"
inkscape:connector-curvature="0" />
</g>
</g>
<path
id="path3399-6-7-3-2-0-1"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="m 207.64603,572.41959 12.92424,-22.56624 25.68775,0 6.95625,12.21375 -3.94375,0 -14.56837,24.7025 -19.11525,-0.055 -7.94087,-14.295 z m 40.06574,-25.06624 -28.59012,0 -0.71975,1.2575 -12.92537,22.56625 -0.70112,1.22375 0.68512,1.23249 7.94137,14.295 0.71087,1.2825 1.46638,0.004 19.11525,0.055 1.43212,0.004 0.729,-1.23375 13.84375,-23.47249 6.81625,0 -2.12875,-3.7375 -6.95625,-12.21375 -0.71875,-1.2625"
inkscape:connector-curvature="0"
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
inkscape:export-xdpi="63.625523"
inkscape:export-ydpi="63.625523" />
<g
transform="matrix(1.25,0,0,-1.25,105.02062,972.84257)"
id="g3465-0-8-9"
inkscape:export-filename="C:\Users\Adam\Desktop\bg_logo1.png"
inkscape:export-xdpi="63.625523"
inkscape:export-ydpi="63.625523">
<text
id="text3467-9-0-8"
transform="matrix(1,0,-0.17627963,-1,0,0)"
x="116.98372"
y="-267.77499"
style="font-size:11.81779194px">
<tspan
sodipodi:role="line"
style="font-size:46.39999771px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#49608a;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Denmark;-inkscape-font-specification:Denmark"
x="116.98372"
y="-267.77499"
id="tspan13239">UTILITY</tspan>
<tspan
sodipodi:role="line"
style="font-size:46.39999771px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#49608a;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Denmark;-inkscape-font-specification:Denmark"
x="116.98372"
y="-209.77499"
id="tspan11278-3" />
</text>
<text
id="text3471-0-51-2"
transform="matrix(0.99235617,0,-0.17763746,-1.0077027,0,0)"
style="font-size:38.40000153px"
x="112.74373"
y="-306.75479">
<tspan
id="tspan3473-6-0-9"
sodipodi:role="line"
style="font-size:38.40000153px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#49608a;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Denmark;-inkscape-font-specification:Denmark"
x="112.74373"
y="-306.75479">boost</tspan>
</text>
</g>
<path
style="fill:#ffffff;fill-opacity:1;stroke:none"
d="m 201.43967,613.81579 4.64114,4.2175 3.3738,-3.71306 -0.92817,-0.84354 1.68708,-1.85636 20.53445,20.81026 4.2175,-4.64111 -22.22144,-18.95384 c 0,0 1.69594,-1.83698 2.53062,-2.78454 2.53905,-2.76559 5.98925,-4.72587 5.98925,-4.72587 0,0 -6.03647,0.58224 -8.76507,2.21476 -0.84428,0.92751 -6.75676,7.40649 -6.75676,7.40649 l -0.92819,-0.84355 -3.37382,3.71308"
id="path13283"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccccc" />
<g
id="g3086"
transform="matrix(0.99872217,-0.05053738,0.05053738,0.99872217,-31.539183,11.181538)">
<path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="path13243"
d="m 227.74101,611.16418 -15.09943,12.783 2.55659,3.01989 15.09944,-12.78302 c 3.56324,2.16769 7.58975,-1.2411 7.0464,-5.96538 l -4.02652,3.40879 -2.55659,-3.01989 4.02652,-3.40879 c -3.56324,-2.16769 -8.59639,2.0933 -7.04641,5.9654 z"
style="fill:#ffffff;fill-opacity:1;stroke:none" />
<path
sodipodi:nodetypes="ccccccccc"
inkscape:connector-curvature="0"
id="path13243-1"
d="m 215.25729,626.9851 15.08951,-12.7947 -2.55893,-3.01791 -15.08952,12.79471 c -3.56492,-2.16491 -7.58878,1.24699 -7.04177,5.97085 l 4.02388,-3.41192 2.55892,3.01791 -4.02387,3.41192 c 3.56491,2.16492 8.59476,-2.09997 7.04178,-5.97086 z"
style="fill:#ffffff;fill-opacity:1;stroke:none" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -24,6 +24,7 @@
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/is_empty.hpp>
#include <boost/type_traits/is_final.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/call_traits.hpp>
@ -42,6 +43,14 @@ class compressed_pair;
namespace details
{
template<class T, bool E = boost::is_final<T>::value>
struct compressed_pair_empty
: ::boost::false_type { };
template<class T>
struct compressed_pair_empty<T, false>
: ::boost::is_empty<T> { };
// JM altered 26 Jan 2000:
template <class T1, class T2, bool IsSame, bool FirstEmpty, bool SecondEmpty>
struct compressed_pair_switch;
@ -343,8 +352,8 @@ class compressed_pair
T1,
T2,
::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
::boost::is_empty<T1>::value,
::boost::is_empty<T2>::value>::value>
::boost::details::compressed_pair_empty<T1>::value,
::boost::details::compressed_pair_empty<T2>::value>::value>
{
private:
typedef details::compressed_pair_imp<T1, T2,
@ -352,8 +361,8 @@ private:
T1,
T2,
::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
::boost::is_empty<T1>::value,
::boost::is_empty<T2>::value>::value> base;
::boost::details::compressed_pair_empty<T1>::value,
::boost::details::compressed_pair_empty<T2>::value>::value> base;
public:
typedef T1 first_type;
typedef T2 second_type;
@ -388,8 +397,8 @@ class compressed_pair<T, T>
T,
T,
::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
::boost::is_empty<T>::value,
::boost::is_empty<T>::value>::value>
::boost::details::compressed_pair_empty<T>::value,
::boost::details::compressed_pair_empty<T>::value>::value>
{
private:
typedef details::compressed_pair_imp<T, T,
@ -397,8 +406,8 @@ private:
T,
T,
::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
::boost::is_empty<T>::value,
::boost::is_empty<T>::value>::value> base;
::boost::details::compressed_pair_empty<T>::value,
::boost::details::compressed_pair_empty<T>::value>::value> base;
public:
typedef T first_type;
typedef T second_type;

View File

@ -9,13 +9,16 @@
#ifndef BOOST_UTILITY_HPP
#define BOOST_UTILITY_HPP
#include <boost/utility/addressof.hpp>
// Use of this header is discouraged and it will be deprecated.
// Please include one or more of the headers below instead.
#include <boost/utility/base_from_member.hpp>
#include <boost/utility/binary.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/utility/identity_type.hpp>
#include <boost/core/addressof.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/core/checked_delete.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/next_prior.hpp>
#endif // BOOST_UTILITY_HPP

View File

@ -0,0 +1,58 @@
#ifndef BOOST_UTILITY_DETAIL_MINSTD_RAND_HPP_INCLUDED
#define BOOST_UTILITY_DETAIL_MINSTD_RAND_HPP_INCLUDED
// 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
//
// An implementation of minstd_rand that does not require
// the Random library
#include <boost/cstdint.hpp>
namespace boost
{
namespace detail
{
class minstd_rand
{
private:
boost::uint_least32_t x_;
enum { a = 48271, m = 2147483647 };
public:
minstd_rand(): x_( 1 )
{
}
explicit minstd_rand( boost::uint_least32_t x ): x_( x % m )
{
if( x_ == 0 )
{
x_ = 1;
}
}
boost::uint_least32_t operator()()
{
boost::uint_least64_t y = x_;
y = ( a * y ) % m;
x_ = static_cast<boost::uint_least32_t>( y );
return x_;
}
};
} // namespace detail
} // namespace boost
#endif // #ifndef BOOST_UTILITY_DETAIL_MINSTD_RAND_HPP_INCLUDED

View File

@ -25,16 +25,16 @@
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
: mpl::if_<
mpl::or_< is_pointer<F>, is_member_function_pointer<F> >
: conditional<
is_pointer<F>::value || is_member_function_pointer<F>::value
, boost::detail::tr1_result_of_impl<
typename remove_cv<F>::type,
typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS),
(boost::detail::has_result_type<F>::value)>
(boost::detail::result_of_has_result_type<F>::value)>
, boost::detail::tr1_result_of_impl<
F,
F(BOOST_RESULT_OF_ARGS),
(boost::detail::has_result_type<F>::value)> >::type { };
(boost::detail::result_of_has_result_type<F>::value)> >::type { };
#endif
#ifdef BOOST_RESULT_OF_USE_DECLTYPE
@ -46,7 +46,7 @@ struct result_of<F(BOOST_RESULT_OF_ARGS)>
#ifdef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
struct result_of<F(BOOST_RESULT_OF_ARGS)>
: mpl::if_<mpl::or_<detail::has_result_type<F>, detail::has_result<F> >,
: conditional<detail::result_of_has_result_type<F>::value || detail::result_of_has_result<F>::value,
tr1_result_of<F(BOOST_RESULT_OF_ARGS)>,
detail::cpp0x_result_of<F(BOOST_RESULT_OF_ARGS)> >::type { };
#endif // BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
@ -57,8 +57,8 @@ namespace detail {
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
struct cpp0x_result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))>
: mpl::if_<
is_member_function_pointer<F>
: conditional<
is_member_function_pointer<F>::value
, detail::tr1_result_of_impl<
typename remove_cv<F>::type,
typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false
@ -93,11 +93,11 @@ struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F *>
template<typename F>
struct BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())
: mpl::eval_if<
is_class<typename remove_reference<F>::type>,
: conditional<
is_class<typename remove_reference<F>::type>::value,
result_of_wrap_callable_class<F>,
mpl::identity<BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<typename remove_reference<F>::type>::type> >
>
type_identity<BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<typename remove_reference<F>::type>::type> >
>::type
{};
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)>
@ -108,7 +108,7 @@ struct BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION()) {
(boost::declval<wrapper_t>()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)), result_of_weird_type())
))
);
typedef mpl::bool_<value> type;
typedef integral_constant<bool, value> type;
};
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>

View File

@ -18,19 +18,16 @@
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/or.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_member_function_pointer.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/utility/declval.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/declval.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/type_identity.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/core/enable_if.hpp>
#ifndef BOOST_RESULT_OF_NUM_ARGS
# define BOOST_RESULT_OF_NUM_ARGS 16
@ -47,10 +44,6 @@
BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK cannot be defined at the same time.
#endif
#if defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) && defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
# error Cannot fallback to decltype if BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE is not defined.
#endif
#ifndef BOOST_RESULT_OF_USE_TR1
# ifndef BOOST_RESULT_OF_USE_DECLTYPE
# ifndef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
@ -71,11 +64,40 @@ template<typename F> struct tr1_result_of; // a TR1-style implementation of resu
#if !defined(BOOST_NO_SFINAE)
namespace detail {
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
typedef char result_of_yes_type; // sizeof(result_of_yes_type) == 1
typedef char (&result_of_no_type)[2]; // sizeof(result_of_no_type) == 2
template<class T> struct result_of_has_type {};
template<class T> struct result_of_has_result_type_impl
{
template<class U> static result_of_yes_type f( result_of_has_type<typename U::result_type>* );
template<class U> static result_of_no_type f( ... );
typedef boost::integral_constant<bool, sizeof(f<T>(0)) == sizeof(result_of_yes_type)> type;
};
template<class T> struct result_of_has_result_type: result_of_has_result_type_impl<T>::type
{
};
// Work around a nvcc bug by only defining has_result when it's needed.
#ifdef BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK
BOOST_MPL_HAS_XXX_TEMPLATE_DEF(result)
template<template<class> class C> struct result_of_has_template {};
template<class T> struct result_of_has_result_impl
{
template<class U> static result_of_yes_type f( result_of_has_template<U::template result>* );
template<class U> static result_of_no_type f( ... );
typedef boost::integral_constant<bool, sizeof(f<T>(0)) == sizeof(result_of_yes_type)> type;
};
template<class T> struct result_of_has_result: result_of_has_result_impl<T>::type
{
};
#endif
template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl;
@ -97,9 +119,6 @@ struct result_of_weird_type {
friend result_of_private_type operator,(result_of_private_type, result_of_weird_type);
};
typedef char result_of_yes_type; // sizeof(result_of_yes_type) == 1
typedef char (&result_of_no_type)[2]; // sizeof(result_of_no_type) == 2
template<typename T>
result_of_no_type result_of_is_private_type(T const &);
result_of_yes_type result_of_is_private_type(result_of_private_type);
@ -180,10 +199,10 @@ struct tr1_result_of_impl<F, FArgs, true>
};
template<typename FArgs>
struct is_function_with_no_args : mpl::false_ {};
struct is_function_with_no_args : false_type {};
template<typename F>
struct is_function_with_no_args<F(void)> : mpl::true_ {};
struct is_function_with_no_args<F(void)> : true_type {};
template<typename F, typename FArgs>
struct result_of_nested_result : F::template result<FArgs>
@ -191,7 +210,7 @@ struct result_of_nested_result : F::template result<FArgs>
template<typename F, typename FArgs>
struct tr1_result_of_impl<F, FArgs, false>
: mpl::if_<is_function_with_no_args<FArgs>,
: conditional<is_function_with_no_args<FArgs>::value,
result_of_void_impl<F>,
result_of_nested_result<F, FArgs> >::type
{};

View File

@ -181,6 +181,7 @@ namespace boost {
}
size_type find(basic_string_ref s) const {
if (s.empty()) return 0;
const_iterator iter = std::search ( this->cbegin (), this->cend (),
s.cbegin (), s.cend (), traits::eq );
return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
@ -193,6 +194,7 @@ namespace boost {
}
size_type rfind(basic_string_ref s) const {
if (s.empty()) return 0;
const_reverse_iterator iter = std::search ( this->crbegin (), this->crend (),
s.crbegin (), s.crend (), traits::eq );
return iter == this->crend () ? npos : (std::distance(iter, this->crend()) - s.size());

View File

@ -21,6 +21,7 @@
#include <boost/detail/workaround.hpp>
#include <boost/utility/string_view_fwd.hpp>
#include <boost/throw_exception.hpp>
#include <boost/container_hash/hash_fwd.hpp>
#include <cstddef>
#include <stdexcept>
@ -245,12 +246,27 @@ namespace boost {
return npos;
if (s.empty())
return pos;
const_iterator iter = std::search(this->cbegin() + pos, this->cend(),
s.cbegin (), s.cend (), traits::eq);
return iter == this->cend () ? npos : std::distance(this->cbegin (), iter);
if (s.size() > size() - pos)
return npos;
const charT* cur = ptr_ + pos;
const charT* last = cend() - s.size() + 1;
for (; cur != last ; ++cur) {
cur = traits::find(cur, last - cur, s[0]);
if (!cur)
return npos;
if (traits::compare(cur, s.cbegin(), s.size()) == 0)
return cur - ptr_;
}
return npos;
}
BOOST_CXX14_CONSTEXPR size_type find(charT c, size_type pos = 0) const BOOST_NOEXCEPT {
if (pos > size())
return npos;
const charT* ret_ptr = traits::find(ptr_ + pos, len_ - pos, c);
if (ret_ptr)
return ret_ptr - ptr_;
return npos;
}
BOOST_CXX14_CONSTEXPR size_type find(charT c, size_type pos = 0) const BOOST_NOEXCEPT
{ return find(basic_string_view(&c, 1), pos); }
BOOST_CXX14_CONSTEXPR size_type find(const charT* s, size_type pos, size_type n) const BOOST_NOEXCEPT
{ return find(basic_string_view(s, n), pos); }
BOOST_CXX14_CONSTEXPR size_type find(const charT* s, size_type pos = 0) const BOOST_NOEXCEPT
@ -287,7 +303,7 @@ namespace boost {
return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
}
BOOST_CXX14_CONSTEXPR size_type find_first_of(charT c, size_type pos = 0) const BOOST_NOEXCEPT
{ return find_first_of(basic_string_view(&c, 1), pos); }
{ return find(c, pos); }
BOOST_CXX14_CONSTEXPR size_type find_first_of(const charT* s, size_type pos, size_type n) const BOOST_NOEXCEPT
{ return find_first_of(basic_string_view(s, n), pos); }
BOOST_CXX14_CONSTEXPR size_type find_first_of(const charT* s, size_type pos = 0) const BOOST_NOEXCEPT
@ -675,6 +691,10 @@ namespace boost {
}
#endif
template <class charT, class traits>
std::size_t hash_value(basic_string_view<charT, traits> s) {
return boost::hash_range(s.begin(), s.end());
}
}
#if 0

View File

@ -20,7 +20,7 @@
<a href="call_traits.htm">call_traits</a><br>
<a href="../core/doc/html/core/checked_delete.html">checked_delete</a> (moved to the Boost.Core library)<br>
<a href="doc/html/compressed_pair.html">compressed_pair</a><br>
<a href="doc/html/declval.html">declval</a><br>
<a href="../type_traits/doc/html/boost_typetraits/reference/declval.html">declval</a> (moved to the Boost.TypeTraits library)<br>
<a href="../core/doc/html/core/enable_if.html">enable_if</a> (moved to the Boost.Core library)<br>
<a href="in_place_factories.html">in_place_factory</a><br>
<a href="iterator_adaptors.htm">iterator_adaptors</a><br>

View File

@ -1586,7 +1586,7 @@ T operator+( T lhs, const T&amp; rhs )
<h3><a name="a_demo">Arithmetic Operators Demonstration</a> and Test
Program</h3>
<p>The <cite><a href="operators_test.cpp">operators_test.cpp</a></cite>
<p>The <cite><a href="test/operators_test.cpp">operators_test.cpp</a></cite>
program demonstrates the use of the arithmetic operator templates, and
can also be used to verify correct operation. Check the compiler status
report for the test results with selected platforms.</p>
@ -1998,7 +1998,7 @@ struct function_output_iterator
<h3><a name="i_demo">Iterator Demonstration</a> and Test Program</h3>
<p>The <cite><a href="iterators_test.cpp">iterators_test.cpp</a></cite>
<p>The <cite><a href="test/iterators_test.cpp">iterators_test.cpp</a></cite>
program demonstrates the use of the iterator templates, and can also be
used to verify correct operation. The following is the custom iterator
defined in the test program. It demonstrates a correct (though trivial)
@ -2064,7 +2064,7 @@ public:
<dt><a href="http://www.boost.org/people/beman_dawes.html">Beman Dawes</a></dt>
<dd>Contributed <cite><a href=
"operators_test.cpp">operators_test.cpp</a></cite>.</dd>
"test/operators_test.cpp">operators_test.cpp</a></cite>.</dd>
<dt><a href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a></dt>

View File

@ -1,322 +0,0 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Shared Container Iterator Documentation</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<img src="../../boost.png" alt="boost.png (6897 bytes)"
align="center" width="277" height="86">
<h1>Shared Container Iterator</h1>
Defined in header
<a href="../../boost/shared_container_iterator.hpp">boost/shared_container_iterator.hpp</a>
<p>
The purpose of the shared container iterator is to attach the lifetime
of a container to the lifetime of its iterators. In other words, the
container will not be deleted until after all its iterators are
destroyed. The shared container iterator is typically used to
implement functions that return iterators over a range of objects that
only need to exist for the lifetime of the iterators. By returning a
pair of shared iterators from a function, the callee can return a
heap-allocated range of objects whose lifetime is automatically managed.
<p>
The shared container iterator augments an iterator over a shared
container. It maintains a reference count on the shared
container. If only shared container iterators hold references to
the container, the container's lifetime will end when the last shared
container iterator over it is destroyed. In any case, the shared
container is guaranteed to persist beyond the lifetime of all
the iterators. In all other ways, the
shared container iterator behaves the same as its base iterator.
<h2>Synopsis</h2>
<pre>
namespace boost {
template &lt;typename <a href="http://www.sgi.com/tech/stl/Container.html">Container</a>&gt;
class shared_container_iterator;
template &lt;typename <a href="http://www.sgi.com/tech/stl/Container.html">Container</a>&gt;
shared_container_iterator&lt;Container&gt;
make_shared_container_iterator(typename Container::iterator base,
boost::shared_ptr&lt;Container&gt; const&amp; container);
std::pair&lt;
typename shared_container_iterator&lt;Container&gt;,
typename shared_container_iterator&lt;Container&gt;
&gt;
make_shared_container_range(boost::shared_ptr&lt;Container&gt; const&amp; container);
}
</pre>
<hr>
<h2><a name="generator">The Shared Container Iterator Type</a></h2>
<pre>
template &lt;typename Container&gt; class shared_container_iterator;
</pre>
The class template <tt>shared_container_iterator</tt>
is the shared container iterator type. The <tt>Container</tt> template
type argument must model the
<a href="http://www.sgi.com/tech/stl/Container.html">Container</a>
concept.
<h3>Example</h3>
<p>
The following example illustrates how to create an iterator that
regulates the lifetime of a reference counted <tt>std::vector</tt>.
Though the original shared pointer <tt>ints</tt> ceases to exist
after <tt>set_range()</tt> returns, the
<tt>shared_counter_iterator</tt> objects maintain references to the
underlying vector and thereby extend the container's lifetime.
<p>
<a href="./shared_iterator_example1.cpp">shared_iterator_example1.cpp</a>:
<PRE>
<font color="#008040">#include "shared_container_iterator.hpp"</font>
<font color="#008040">#include "boost/shared_ptr.hpp"</font>
<font color="#008040">#include &lt;algorithm&gt;</font>
<font color="#008040">#include &lt;iostream&gt;</font>
<font color="#008040">#include &lt;vector&gt;</font>
<B>typedef</B> boost::shared_container_iterator&lt; std::vector&lt;<B>int</B>&gt; &gt; iterator;
<B>void</B> set_range(iterator& i, iterator& end) {
boost::shared_ptr&lt; std::vector&lt;<B>int</B>&gt; &gt; ints(<B>new</B> std::vector&lt;<B>int</B>&gt;());
ints-&gt;push_back(<font color="#0000A0">0</font>);
ints-&gt;push_back(<font color="#0000A0">1</font>);
ints-&gt;push_back(<font color="#0000A0">2</font>);
ints-&gt;push_back(<font color="#0000A0">3</font>);
ints-&gt;push_back(<font color="#0000A0">4</font>);
ints-&gt;push_back(<font color="#0000A0">5</font>);
i = iterator(ints-&gt;begin(),ints);
end = iterator(ints-&gt;end(),ints);
}
<B>int</B> main() {
iterator i,end;
set_range(i,end);
std::copy(i,end,std::ostream_iterator&lt;<B>int</B>&gt;(std::cout,<font color="#0000FF">","</font>));
std::cout.put(<font color="#0000FF">'\n'</font>);
<B>return</B> <font color="#0000A0">0</font>;
}
</PRE>
The output from this part is:
<pre>
0,1,2,3,4,5,
</pre>
<h3>Template Parameters</h3>
<Table border>
<TR>
<TH>Parameter</TH><TH>Description</TH>
</TR>
<TR>
<TD><a
href="http://www.sgi.com/tech/stl/Container.html"><tt>Container</tt></a></TD>
<TD>The type of the container that we wish to iterate over. It must be
a model of the
<a href="http://www.sgi.com/tech/stl/Container.html"><tt>Container</tt></a>
concept.
</TD>
</TR>
</Table>
<h3>Model of</h3>
The <tt>shared_container_iterator<Container></tt> type models the
same iterator concept as the base iterator
(<tt>Container::iterator</tt>).
<h3>Members</h3>
The shared container iterator type implements the member functions and
operators required of the <a
href="http://www.sgi.com/tech/stl/RandomAccessIterator.html">Random Access Iterator</a>
concept, though only operations defined for the base iterator will be valid.
In addition it has the following constructor:
<pre>
shared_container_iterator(Container::iterator const&amp; it,
boost::shared_ptr&lt;Container&gt; const&amp; container)
</pre>
<p>
<hr>
<p>
<h2><a name="make_iterator">The Shared Container Iterator Object Generator</a></h2>
<pre>
template &lt;typename Container&gt;
shared_container_iterator&lt;Container&gt;
make_shared_container_iterator(Container::iterator base,
boost::shared_ptr&lt;Container&gt; const&amp; container)
</pre>
This function provides an alternative to directly constructing a
shared container iterator. Using the object generator, a shared
container iterator can be created and passed to a function without
explicitly specifying its type.
<h3>Example</h3>
This example, similar to the previous, uses
<tt>make_shared_container_iterator()</tt> to create the iterators.
<p>
<a href="./shared_iterator_example2.cpp">shared_iterator_example2.cpp</a>:
<PRE>
<font color="#008040">#include "shared_container_iterator.hpp"</font>
<font color="#008040">#include "boost/shared_ptr.hpp"</font>
<font color="#008040">#include &lt;algorithm&gt;</font>
<font color="#008040">#include &lt;iterator&gt;</font>
<font color="#008040">#include &lt;iostream&gt;</font>
<font color="#008040">#include &lt;vector&gt;</font>
<B>template</B> &lt;<B>typename</B> Iterator&gt;
<B>void</B> print_range_nl (Iterator begin, Iterator end) {
<B>typedef</B> <B>typename</B> std::iterator_traits&lt;Iterator&gt;::value_type val;
std::copy(begin,end,std::ostream_iterator&lt;val&gt;(std::cout,<font color="#0000FF">","</font>));
std::cout.put(<font color="#0000FF">'\n'</font>);
}
<B>int</B> main() {
<B>typedef</B> boost::shared_ptr&lt; std::vector&lt;<B>int</B>&gt; &gt; ints_t;
{
ints_t ints(<B>new</B> std::vector&lt;<B>int</B>&gt;());
ints-&gt;push_back(<font color="#0000A0">0</font>);
ints-&gt;push_back(<font color="#0000A0">1</font>);
ints-&gt;push_back(<font color="#0000A0">2</font>);
ints-&gt;push_back(<font color="#0000A0">3</font>);
ints-&gt;push_back(<font color="#0000A0">4</font>);
ints-&gt;push_back(<font color="#0000A0">5</font>);
print_range_nl(boost::make_shared_container_iterator(ints-&gt;begin(),ints),
boost::make_shared_container_iterator(ints-&gt;end(),ints));
}
<B>return</B> <font color="#0000A0">0</font>;
}
</PRE>
Observe that the <tt>shared_container_iterator</tt> type is never
explicitly named. The output from this example is the same as the previous.
<h2><a name="make_range">The Shared Container Iterator Range Generator</a></h2>
<pre>
template &lt;typename Container&gt;
std::pair&lt
shared_container_iterator&lt;Container&gt;,
shared_container_iterator&lt;Container&gt;
&gt;
make_shared_container_range(boost::shared_ptr&lt;Container&gt; const&amp; container);
</pre>
Class <tt>shared_container_iterator</tt> is meant primarily to return,
using iterators, a range of values that we can guarantee will be alive as
long as the iterators are. This is a convenience
function to do just that. It is equivalent to
<pre>
std::make_pair(make_shared_container_iterator(container-&gt;begin(),container),
make_shared_container_iterator(container-&gt;end(),container));
</pre>
<h3>Example</h3>
In the following example, a range of values is returned as a pair of
<tt>shared_container_iterator</tt> objects.
<p>
<a href="./shared_iterator_example3.cpp">shared_iterator_example3.cpp</a>:
<PRE>
<font color="#008040">#include "shared_container_iterator.hpp"</font>
<font color="#008040">#include "boost/shared_ptr.hpp"</font>
<font color="#008040">#include "boost/tuple/tuple.hpp" // for boost::tie</font>
<font color="#008040">#include &lt;algorithm&gt; // for std::copy</font>
<font color="#008040">#include &lt;iostream&gt; </font>
<font color="#008040">#include &lt;vector&gt;</font>
<B>typedef</B> boost::shared_container_iterator&lt; std::vector&lt;<B>int</B>&gt; &gt; iterator;
std::pair&lt;iterator,iterator&gt;
return_range() {
boost::shared_ptr&lt; std::vector&lt;<B>int</B>&gt; &gt; range(<B>new</B> std::vector&lt;<B>int</B>&gt;());
range-&gt;push_back(<font color="#0000A0">0</font>);
range-&gt;push_back(<font color="#0000A0">1</font>);
range-&gt;push_back(<font color="#0000A0">2</font>);
range-&gt;push_back(<font color="#0000A0">3</font>);
range-&gt;push_back(<font color="#0000A0">4</font>);
range-&gt;push_back(<font color="#0000A0">5</font>);
<B>return</B> boost::make_shared_container_range(range);
}
<B>int</B> main() {
iterator i,end;
boost::tie(i,end) = return_range();
std::copy(i,end,std::ostream_iterator&lt;<B>int</B>&gt;(std::cout,<font color="#0000FF">","</font>));
std::cout.put(<font color="#0000FF">'\n'</font>);
<B>return</B> <font color="#0000A0">0</font>;
}
</PRE>
Though the <tt>range</tt> object only lives for the duration of the
<tt>return_range</tt> call, the reference counted
<tt>std::vector</tt> will live until <tt>i</tt> and <tt>end</tt>
are both destroyed. The output from this example is the same as
the previous two.
<hr>
<!-- hhmts start -->
Last modified: Mon Aug 11 11:27:03 EST 2003
<!-- hhmts end -->
<p><EFBFBD> Copyright 2003 The Trustees of Indiana University.
Use, modification and distribution is subject to 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)</p>
</body>
</html>

View File

@ -1,42 +0,0 @@
// Copyright 2003 The Trustees of Indiana University.
// Use, modification and distribution is subject to 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/shared_container_iterator.hpp"
#include "boost/shared_ptr.hpp"
#include <algorithm>
#include <iostream>
#include <vector>
typedef boost::shared_container_iterator< std::vector<int> > iterator;
void set_range(iterator& i, iterator& end) {
boost::shared_ptr< std::vector<int> > ints(new std::vector<int>());
ints->push_back(0);
ints->push_back(1);
ints->push_back(2);
ints->push_back(3);
ints->push_back(4);
ints->push_back(5);
i = iterator(ints->begin(),ints);
end = iterator(ints->end(),ints);
}
int main() {
iterator i,end;
set_range(i,end);
std::copy(i,end,std::ostream_iterator<int>(std::cout,","));
std::cout.put('\n');
return 0;
}

View File

@ -1,43 +0,0 @@
// Copyright 2003 The Trustees of Indiana University.
// Use, modification and distribution is subject to 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/shared_container_iterator.hpp"
#include "boost/shared_ptr.hpp"
#include <algorithm>
#include <iterator>
#include <iostream>
#include <vector>
template <typename Iterator>
void print_range_nl (Iterator begin, Iterator end) {
typedef typename std::iterator_traits<Iterator>::value_type val;
std::copy(begin,end,std::ostream_iterator<val>(std::cout,","));
std::cout.put('\n');
}
int main() {
typedef boost::shared_ptr< std::vector<int> > ints_t;
{
ints_t ints(new std::vector<int>());
ints->push_back(0);
ints->push_back(1);
ints->push_back(2);
ints->push_back(3);
ints->push_back(4);
ints->push_back(5);
print_range_nl(boost::make_shared_container_iterator(ints->begin(),ints),
boost::make_shared_container_iterator(ints->end(),ints));
}
return 0;
}

View File

@ -1,41 +0,0 @@
// Copyright 2003 The Trustees of Indiana University.
// Use, modification and distribution is subject to 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/shared_container_iterator.hpp"
#include "boost/shared_ptr.hpp"
#include "boost/tuple/tuple.hpp" // for boost::tie
#include <algorithm> // for std::copy
#include <iostream>
#include <vector>
typedef boost::shared_container_iterator< std::vector<int> > iterator;
std::pair<iterator,iterator>
return_range() {
boost::shared_ptr< std::vector<int> > range(new std::vector<int>());
range->push_back(0);
range->push_back(1);
range->push_back(2);
range->push_back(3);
range->push_back(4);
range->push_back(5);
return boost::make_shared_container_range(range);
}
int main() {
iterator i,end;
boost::tie(i,end) = return_range();
std::copy(i,end,std::ostream_iterator<int>(std::cout,","));
std::cout.put('\n');
return 0;
}

View File

@ -8,11 +8,6 @@
# bring in rules for testing
import testing ;
alias unit_test_framework
: # sources
/boost//unit_test_framework
;
run base_from_member_test.cpp ;
run base_from_member_ref_test.cpp ;
@ -20,25 +15,24 @@ run binary_test.cpp ;
run call_traits_test.cpp : -u ;
run compressed_pair_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ;
run compressed_pair_test.cpp ;
run compressed_pair_final_test.cpp ;
run iterators_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ;
run iterators_test.cpp ;
run operators_test.cpp ../../test/build//boost_test_exec_monitor/<link>static ;
run operators_test.cpp ;
compile result_of_test.cpp ;
run shared_iterator_test.cpp ;
# compile-fail string_ref_from_rvalue.cpp ;
run string_ref_test1.cpp unit_test_framework ;
run string_ref_test2.cpp unit_test_framework ;
run string_ref_test_io.cpp unit_test_framework ;
run string_ref_test1.cpp ;
run string_ref_test2.cpp ;
run string_ref_test_io.cpp ;
# compile-fail string_view_from_rvalue.cpp ;
compile string_view_constexpr_test1.cpp ;
run string_view_test1.cpp unit_test_framework ;
run string_view_test2.cpp unit_test_framework ;
run string_view_test_io.cpp unit_test_framework ;
run string_view_test1.cpp ;
run string_view_test2.cpp ;
run string_view_test_io.cpp ;
run value_init_test.cpp ;
run value_init_workaround_test.cpp ;

View File

@ -10,7 +10,7 @@
#include <boost/utility/base_from_member.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/core/lightweight_test.hpp>
struct foo : boost::base_from_member<int&>
{

View File

@ -10,10 +10,9 @@
// 14 Jun 2003 Adjusted code for Boost.Test changes (Daryle Walker)
// 29 Aug 2001 Initial Version (Daryle Walker)
#include <boost/test/minimal.hpp> // for BOOST_CHECK, main
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp> // for BOOST_NO_MEMBER_TEMPLATES
#include <boost/cstdlib.hpp> // for boost::exit_success
#include <boost/noncopyable.hpp> // for boost::noncopyable
#include <boost/utility/base_from_member.hpp> // for boost::base_from_member
@ -172,13 +171,13 @@ object_registrar obj_reg;
// Main functionality
int
test_main( int , char * [] )
main()
{
BOOST_CHECK( obj_reg.db_.empty() );
BOOST_CHECK( obj_reg.defrauders_in_.empty() );
BOOST_CHECK( obj_reg.defrauders_out_.empty() );
BOOST_CHECK( obj_reg.overeager_.empty() );
BOOST_CHECK( obj_reg.overkilled_.empty() );
BOOST_TEST( obj_reg.db_.empty() );
BOOST_TEST( obj_reg.defrauders_in_.empty() );
BOOST_TEST( obj_reg.defrauders_out_.empty() );
BOOST_TEST( obj_reg.overeager_.empty() );
BOOST_TEST( obj_reg.overkilled_.empty() );
// Make a separate block to examine pre- and post-effects
{
@ -186,20 +185,20 @@ test_main( int , char * [] )
using std::endl;
bad_class bc;
BOOST_CHECK( obj_reg.db_.size() == 3 );
BOOST_CHECK( obj_reg.defrauders_in_.size() == 1 );
BOOST_TEST( obj_reg.db_.size() == 3 );
BOOST_TEST( obj_reg.defrauders_in_.size() == 1 );
good_class_1 gc1;
BOOST_CHECK( obj_reg.db_.size() == 6 );
BOOST_CHECK( obj_reg.defrauders_in_.size() == 1 );
BOOST_TEST( obj_reg.db_.size() == 6 );
BOOST_TEST( obj_reg.defrauders_in_.size() == 1 );
good_class_2 gc2;
BOOST_CHECK( obj_reg.db_.size() == 11 );
BOOST_CHECK( obj_reg.defrauders_in_.size() == 1 );
BOOST_TEST( obj_reg.db_.size() == 11 );
BOOST_TEST( obj_reg.defrauders_in_.size() == 1 );
BOOST_CHECK( obj_reg.defrauders_out_.empty() );
BOOST_CHECK( obj_reg.overeager_.empty() );
BOOST_CHECK( obj_reg.overkilled_.empty() );
BOOST_TEST( obj_reg.defrauders_out_.empty() );
BOOST_TEST( obj_reg.overeager_.empty() );
BOOST_TEST( obj_reg.overkilled_.empty() );
// Getting the addresses of the objects ensure
// that they're used, and not optimized away.
@ -208,13 +207,13 @@ test_main( int , char * [] )
cout << "Object 'gc2' is at " << &gc2 << '.' << endl;
}
BOOST_CHECK( obj_reg.db_.empty() );
BOOST_CHECK( obj_reg.defrauders_in_.size() == 1 );
BOOST_CHECK( obj_reg.defrauders_out_.size() == 1 );
BOOST_CHECK( obj_reg.overeager_.empty() );
BOOST_CHECK( obj_reg.overkilled_.empty() );
BOOST_TEST( obj_reg.db_.empty() );
BOOST_TEST( obj_reg.defrauders_in_.size() == 1 );
BOOST_TEST( obj_reg.defrauders_out_.size() == 1 );
BOOST_TEST( obj_reg.overeager_.empty() );
BOOST_TEST( obj_reg.overkilled_.empty() );
return boost::exit_success;
return boost::report_errors();
}

View File

@ -6,7 +6,7 @@
http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#include <boost/test/minimal.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/utility/binary.hpp>
#include <algorithm>
#include <cstddef>
@ -614,34 +614,34 @@ typedef char (&unsigned_long_int_id_type)[unsigned_long_int_id];
unsigned_int_id_type binary_type_checker( unsigned int );
unsigned_long_int_id_type binary_type_checker( unsigned long int );
int test_main( int, char *[] )
int main()
{
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_1_bit ) );
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_2_bits ) );
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_3_bits ) );
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_4_bits ) );
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_5_bits ) );
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_6_bits ) );
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_7_bits ) );
BOOST_CHECK( is_ascending_from_0_array( unsigned_ints_8_bits ) );
BOOST_TEST( is_ascending_from_0_array( unsigned_ints_1_bit ) );
BOOST_TEST( is_ascending_from_0_array( unsigned_ints_2_bits ) );
BOOST_TEST( is_ascending_from_0_array( unsigned_ints_3_bits ) );
BOOST_TEST( is_ascending_from_0_array( unsigned_ints_4_bits ) );
BOOST_TEST( is_ascending_from_0_array( unsigned_ints_5_bits ) );
BOOST_TEST( is_ascending_from_0_array( unsigned_ints_6_bits ) );
BOOST_TEST( is_ascending_from_0_array( unsigned_ints_7_bits ) );
BOOST_TEST( is_ascending_from_0_array( unsigned_ints_8_bits ) );
BOOST_CHECK( std::equal( &random_unsigned_ints_hex[0]
BOOST_TEST( std::equal( &random_unsigned_ints_hex[0]
, random_unsigned_ints_hex + num_random_test_values
, &random_unsigned_ints_binary[0]
)
);
BOOST_CHECK( sizeof( binary_type_checker( BOOST_BINARY_U( 110100 1010 ) ) )
BOOST_TEST( sizeof( binary_type_checker( BOOST_BINARY_U( 110100 1010 ) ) )
== unsigned_int_id
);
BOOST_CHECK( sizeof( binary_type_checker( BOOST_BINARY_UL( 11110 ) ) )
BOOST_TEST( sizeof( binary_type_checker( BOOST_BINARY_UL( 11110 ) ) )
== unsigned_long_int_id
);
BOOST_CHECK( sizeof( binary_type_checker( BOOST_BINARY_LU( 10 0001 ) ) )
BOOST_TEST( sizeof( binary_type_checker( BOOST_BINARY_LU( 10 0001 ) ) )
== unsigned_long_int_id
);
return 0;
return boost::report_errors();
}

View File

@ -0,0 +1,55 @@
/*
Copyright 2018 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/config.hpp>
#if !defined(BOOST_NO_CXX11_FINAL)
#include <boost/compressed_pair.hpp>
#include <boost/core/lightweight_test.hpp>
struct type1 {
operator bool() const {
return false;
}
};
struct type2 final {
operator bool() const {
return false;
}
};
#if !defined(BOOST_IS_FINAL)
namespace boost {
template<>
struct is_final<type2>
: true_type { };
} /* boost*/
#endif
template<class T1, class T2>
void test()
{
boost::compressed_pair<T1, T2> p;
BOOST_TEST(!p.first());
BOOST_TEST(!p.second());
}
int main()
{
test<type1, type2>();
test<type2, type1>();
test<type2, type2>();
return boost::report_errors();
}
#else
int main()
{
return 0;
}
#endif

View File

@ -14,7 +14,7 @@
#include <cassert>
#include <boost/compressed_pair.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/core/lightweight_test.hpp>
using namespace boost;
@ -79,47 +79,47 @@ void compressed_pair_tester<T1, T2>::test(first_param_type p1, second_param_type
// first param construct:
boost::compressed_pair<T1,T2> cp2(p1);
cp2.second() = p2;
BOOST_CHECK(cp2.first() == p1);
BOOST_CHECK(cp2.second() == p2);
BOOST_TEST(cp2.first() == p1);
BOOST_TEST(cp2.second() == p2);
// second param construct:
boost::compressed_pair<T1,T2> cp3(p2);
cp3.first() = p1;
BOOST_CHECK(cp3.second() == p2);
BOOST_CHECK(cp3.first() == p1);
BOOST_TEST(cp3.second() == p2);
BOOST_TEST(cp3.first() == p1);
// both param construct:
boost::compressed_pair<T1,T2> cp4(p1, p2);
BOOST_CHECK(cp4.first() == p1);
BOOST_CHECK(cp4.second() == p2);
BOOST_TEST(cp4.first() == p1);
BOOST_TEST(cp4.second() == p2);
boost::compressed_pair<T1,T2> cp5(p3, p4);
BOOST_CHECK(cp5.first() == p3);
BOOST_CHECK(cp5.second() == p4);
BOOST_TEST(cp5.first() == p3);
BOOST_TEST(cp5.second() == p4);
// check const members:
const boost::compressed_pair<T1,T2>& cpr1 = cp4;
BOOST_CHECK(cpr1.first() == p1);
BOOST_CHECK(cpr1.second() == p2);
BOOST_TEST(cpr1.first() == p1);
BOOST_TEST(cpr1.second() == p2);
// copy construct:
boost::compressed_pair<T1,T2> cp6(cp4);
BOOST_CHECK(cp6.first() == p1);
BOOST_CHECK(cp6.second() == p2);
BOOST_TEST(cp6.first() == p1);
BOOST_TEST(cp6.second() == p2);
// assignment:
cp1 = cp4;
BOOST_CHECK(cp1.first() == p1);
BOOST_CHECK(cp1.second() == p2);
BOOST_TEST(cp1.first() == p1);
BOOST_TEST(cp1.second() == p2);
cp1 = cp5;
BOOST_CHECK(cp1.first() == p3);
BOOST_CHECK(cp1.second() == p4);
BOOST_TEST(cp1.first() == p3);
BOOST_TEST(cp1.second() == p4);
// swap:
cp4.swap(cp5);
BOOST_CHECK(cp4.first() == p3);
BOOST_CHECK(cp4.second() == p4);
BOOST_CHECK(cp5.first() == p1);
BOOST_CHECK(cp5.second() == p2);
BOOST_TEST(cp4.first() == p3);
BOOST_TEST(cp4.second() == p4);
BOOST_TEST(cp5.first() == p1);
BOOST_TEST(cp5.second() == p2);
swap(cp4,cp5);
BOOST_CHECK(cp4.first() == p1);
BOOST_CHECK(cp4.second() == p2);
BOOST_CHECK(cp5.first() == p3);
BOOST_CHECK(cp5.second() == p4);
BOOST_TEST(cp4.first() == p1);
BOOST_TEST(cp4.second() == p2);
BOOST_TEST(cp5.first() == p3);
BOOST_TEST(cp5.second() == p4);
}
//
@ -148,20 +148,20 @@ void compressed_pair_reference_tester<T1, T2>::test(first_param_type p1, second_
#endif
// both param construct:
boost::compressed_pair<T1,T2> cp4(p1, p2);
BOOST_CHECK(cp4.first() == p1);
BOOST_CHECK(cp4.second() == p2);
BOOST_TEST(cp4.first() == p1);
BOOST_TEST(cp4.second() == p2);
boost::compressed_pair<T1,T2> cp5(p3, p4);
BOOST_CHECK(cp5.first() == p3);
BOOST_CHECK(cp5.second() == p4);
BOOST_TEST(cp5.first() == p3);
BOOST_TEST(cp5.second() == p4);
// check const members:
const boost::compressed_pair<T1,T2>& cpr1 = cp4;
BOOST_CHECK(cpr1.first() == p1);
BOOST_CHECK(cpr1.second() == p2);
BOOST_TEST(cpr1.first() == p1);
BOOST_TEST(cpr1.second() == p2);
// copy construct:
boost::compressed_pair<T1,T2> cp6(cp4);
BOOST_CHECK(cp6.first() == p1);
BOOST_CHECK(cp6.second() == p2);
BOOST_TEST(cp6.first() == p1);
BOOST_TEST(cp6.second() == p2);
// assignment:
// VC6 bug:
// When second() is an empty class, VC6 performs the
@ -174,8 +174,8 @@ void compressed_pair_reference_tester<T1, T2>::test(first_param_type p1, second_
// settings - some generate the problem others do not.
cp4.first() = p3;
cp4.second() = p4;
BOOST_CHECK(cp4.first() == p3);
BOOST_CHECK(cp4.second() == p4);
BOOST_TEST(cp4.first() == p3);
BOOST_TEST(cp4.second() == p4);
}
//
// supplimentary tests for case where first arg only is a reference type:
@ -199,8 +199,8 @@ void compressed_pair_reference1_tester<T1, T2>::test(first_param_type p1, second
// first param construct:
boost::compressed_pair<T1,T2> cp2(p1);
cp2.second() = p2;
BOOST_CHECK(cp2.first() == p1);
BOOST_CHECK(cp2.second() == p2);
BOOST_TEST(cp2.first() == p1);
BOOST_TEST(cp2.second() == p2);
#endif
}
//
@ -225,8 +225,8 @@ void compressed_pair_reference2_tester<T1, T2>::test(first_param_type p1, second
// second param construct:
boost::compressed_pair<T1,T2> cp3(p2);
cp3.first() = p1;
BOOST_CHECK(cp3.second() == p2);
BOOST_CHECK(cp3.first() == p1);
BOOST_TEST(cp3.second() == p2);
BOOST_TEST(cp3.first() == p1);
#endif
}
@ -253,14 +253,14 @@ void compressed_pair_array1_tester<T1, T2>::test(first_param_type p1, second_par
// second param construct:
boost::compressed_pair<T1,T2> cp3(p2);
cp3.first()[0] = p1[0];
BOOST_CHECK(cp3.second() == p2);
BOOST_CHECK(cp3.first()[0] == p1[0]);
BOOST_TEST(cp3.second() == p2);
BOOST_TEST(cp3.first()[0] == p1[0]);
// check const members:
const boost::compressed_pair<T1,T2>& cpr1 = cp3;
BOOST_CHECK(cpr1.first()[0] == p1[0]);
BOOST_CHECK(cpr1.second() == p2);
BOOST_TEST(cpr1.first()[0] == p1[0]);
BOOST_TEST(cpr1.second() == p2);
BOOST_CHECK(sizeof(T1) == sizeof(cp1.first()));
BOOST_TEST(sizeof(T1) == sizeof(cp1.first()));
}
template <class T1, class T2>
@ -283,14 +283,14 @@ void compressed_pair_array2_tester<T1, T2>::test(first_param_type p1, second_par
// first param construct:
boost::compressed_pair<T1,T2> cp2(p1);
cp2.second()[0] = p2[0];
BOOST_CHECK(cp2.first() == p1);
BOOST_CHECK(cp2.second()[0] == p2[0]);
BOOST_TEST(cp2.first() == p1);
BOOST_TEST(cp2.second()[0] == p2[0]);
// check const members:
const boost::compressed_pair<T1,T2>& cpr1 = cp2;
BOOST_CHECK(cpr1.first() == p1);
BOOST_CHECK(cpr1.second()[0] == p2[0]);
BOOST_TEST(cpr1.first() == p1);
BOOST_TEST(cpr1.second()[0] == p2[0]);
BOOST_CHECK(sizeof(T2) == sizeof(cp1.second()));
BOOST_TEST(sizeof(T2) == sizeof(cp1.second()));
}
template <class T1, class T2>
@ -312,18 +312,18 @@ void compressed_pair_array_tester<T1, T2>::test(first_param_type p1, second_para
boost::compressed_pair<T1,T2> cp1;
cp1.first()[0] = p1[0];
cp1.second()[0] = p2[0];
BOOST_CHECK(cp1.first()[0] == p1[0]);
BOOST_CHECK(cp1.second()[0] == p2[0]);
BOOST_TEST(cp1.first()[0] == p1[0]);
BOOST_TEST(cp1.second()[0] == p2[0]);
// check const members:
const boost::compressed_pair<T1,T2>& cpr1 = cp1;
BOOST_CHECK(cpr1.first()[0] == p1[0]);
BOOST_CHECK(cpr1.second()[0] == p2[0]);
BOOST_TEST(cpr1.first()[0] == p1[0]);
BOOST_TEST(cpr1.second()[0] == p2[0]);
BOOST_CHECK(sizeof(T1) == sizeof(cp1.first()));
BOOST_CHECK(sizeof(T2) == sizeof(cp1.second()));
BOOST_TEST(sizeof(T1) == sizeof(cp1.first()));
BOOST_TEST(sizeof(T2) == sizeof(cp1.second()));
}
int test_main(int, char *[])
int main()
{
// declare some variables to pass to the tester:
non_empty1 ne1(2);
@ -383,13 +383,5 @@ int test_main(int, char *[])
compressed_pair_array2_tester<empty_POD_UDT,non_empty2[2]>::test(e1, nea3, e1, nea4);
// T1 == T2, both non-empty
compressed_pair_array_tester<non_empty1[2],non_empty1[2]>::test(nea1, nea1, nea2, nea2);
return 0;
return boost::report_errors();
}
unsigned int expected_failures = 0;

View File

@ -9,7 +9,7 @@
// 2 May 2010 (Created) Niels Dekker
#include <boost/utility/value_init.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/core/lightweight_test.hpp>
#include <string>

View File

@ -12,11 +12,9 @@
// library (Daryle Walker)
// 12 Dec 99 Initial version with iterator operators (Jeremy Siek)
#define BOOST_INCLUDE_MAIN
#include <boost/test/test_tools.hpp> // for main
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
#include <boost/cstdlib.hpp> // for boost::exit_success
#include <boost/operators.hpp> // for boost::random_access_iterator_helper
#include <cstddef> // for std::ptrdiff_t, std::size_t
@ -126,7 +124,7 @@ typename test_opr<T, R, P>::iter_type const
// Main testing function
int
test_main( int , char * [] )
main()
{
using std::string;
@ -136,7 +134,7 @@ test_main( int , char * [] )
test1_type::master_test( "non-const string" );
test2_type::master_test( "const string" );
return boost::exit_success;
return boost::report_errors();
}
// Tests for all of the operators added by random_access_iterator_helper
@ -174,7 +172,7 @@ test_opr<T, R, P>::post_increment_test
oss << *i++ << ' ';
}
BOOST_CHECK( oss.str() == "apple orange pear peach grape plum ");
BOOST_TEST( oss.str() == "apple orange pear peach grape plum ");
}
// Test post-decrement
@ -193,7 +191,7 @@ test_opr<T, R, P>::post_decrement_test
oss << *i << ' ';
}
BOOST_CHECK( oss.str() == "plum grape peach pear orange apple ");
BOOST_TEST( oss.str() == "plum grape peach pear orange apple ");
}
// Test indirect structure referral
@ -211,7 +209,7 @@ test_opr<T, R, P>::indirect_referral_test
oss << i->size() << ' ';
}
BOOST_CHECK( oss.str() == "5 6 4 5 5 4 ");
BOOST_TEST( oss.str() == "5 6 4 5 5 4 ");
}
// Test offset addition
@ -230,7 +228,7 @@ test_opr<T, R, P>::offset_addition_test
oss << *i << ' ';
}
BOOST_CHECK( oss.str() == "apple pear grape ");
BOOST_TEST( oss.str() == "apple pear grape ");
}
// Test offset addition, in reverse order
@ -249,7 +247,7 @@ test_opr<T, R, P>::reverse_offset_addition_test
oss << *i << ' ';
}
BOOST_CHECK( oss.str() == "apple pear grape ");
BOOST_TEST( oss.str() == "apple pear grape ");
}
// Test offset subtraction
@ -272,7 +270,7 @@ test_opr<T, R, P>::offset_subtraction_test
}
}
BOOST_CHECK( oss.str() == "grape pear apple ");
BOOST_TEST( oss.str() == "grape pear apple ");
}
// Test comparisons
@ -296,10 +294,10 @@ test_opr<T, R, P>::comparison_test
{
ptrdiff_t const j_offset = j - fruit_begin;
BOOST_CHECK( (i != j) == (i_offset != j_offset) );
BOOST_CHECK( (i > j) == (i_offset > j_offset) );
BOOST_CHECK( (i <= j) == (i_offset <= j_offset) );
BOOST_CHECK( (i >= j) == (i_offset >= j_offset) );
BOOST_TEST( (i != j) == (i_offset != j_offset) );
BOOST_TEST( (i > j) == (i_offset > j_offset) );
BOOST_TEST( (i <= j) == (i_offset <= j_offset) );
BOOST_TEST( (i >= j) == (i_offset >= j_offset) );
}
}
cout << std::endl;
@ -320,5 +318,5 @@ test_opr<T, R, P>::indexing_test
oss << fruit_begin[ k ] << ' ';
}
BOOST_CHECK( oss.str() == "apple orange pear peach grape plum ");
BOOST_TEST( oss.str() == "apple orange pear peach grape plum ");
}

View File

@ -21,13 +21,10 @@
// 12 Dec 99 Minor update, output confirmation message.
// 15 Nov 99 Initial version
#define BOOST_INCLUDE_MAIN
#include <boost/config.hpp> // for BOOST_MSVC
#include <boost/cstdlib.hpp> // for boost::exit_success
#include <boost/operators.hpp> // for the tested items
#include <boost/random/linear_congruential.hpp> // for boost::minstd_rand
#include <boost/test/test_tools.hpp> // for main
#include <boost/utility/detail/minstd_rand.hpp> // for boost::detail::minstd_rand
#include <boost/core/lightweight_test.hpp>
#include <iostream> // for std::cout (std::endl indirectly)
@ -311,17 +308,17 @@ namespace
template <class X1, class Y1, class X2, class Y2>
void sanity_check(X1 x1, Y1 y1, X2 x2, Y2 y2)
{
BOOST_CHECK( true_value(y1) == true_value(y2) );
BOOST_CHECK( true_value(x1) == true_value(x2) );
BOOST_TEST( true_value(y1) == true_value(y2) );
BOOST_TEST( true_value(x1) == true_value(x2) );
}
template <class X1, class Y1, class X2, class Y2>
void test_less_than_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2)
{
BOOST_CHECK( static_cast<bool>(x1 < y1) == static_cast<bool>(x2 < y2) );
BOOST_CHECK( static_cast<bool>(x1 <= y1) == static_cast<bool>(x2 <= y2) );
BOOST_CHECK( static_cast<bool>(x1 >= y1) == static_cast<bool>(x2 >= y2) );
BOOST_CHECK( static_cast<bool>(x1 > y1) == static_cast<bool>(x2 > y2) );
BOOST_TEST( static_cast<bool>(x1 < y1) == static_cast<bool>(x2 < y2) );
BOOST_TEST( static_cast<bool>(x1 <= y1) == static_cast<bool>(x2 <= y2) );
BOOST_TEST( static_cast<bool>(x1 >= y1) == static_cast<bool>(x2 >= y2) );
BOOST_TEST( static_cast<bool>(x1 > y1) == static_cast<bool>(x2 > y2) );
}
template <class X1, class Y1, class X2, class Y2>
@ -335,8 +332,8 @@ namespace
template <class X1, class Y1, class X2, class Y2>
void test_equality_comparable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2)
{
BOOST_CHECK( static_cast<bool>(x1 == y1) == static_cast<bool>(x2 == y2) );
BOOST_CHECK( static_cast<bool>(x1 != y1) == static_cast<bool>(x2 != y2) );
BOOST_TEST( static_cast<bool>(x1 == y1) == static_cast<bool>(x2 == y2) );
BOOST_TEST( static_cast<bool>(x1 != y1) == static_cast<bool>(x2 != y2) );
}
template <class X1, class Y1, class X2, class Y2>
@ -350,7 +347,7 @@ namespace
template <class X1, class Y1, class X2, class Y2>
void test_multipliable_aux(X1 x1, Y1 y1, X2 x2, Y2 y2)
{
BOOST_CHECK( (x1 * y1).value() == (x2 * y2) );
BOOST_TEST( (x1 * y1).value() == (x2 * y2) );
}
template <class X1, class Y1, class X2, class Y2>
@ -364,7 +361,7 @@ namespace
template <class A, class B>
void test_value_equality(A a, B b)
{
BOOST_CHECK(a.value() == b);
BOOST_TEST(a.value() == b);
}
#define TEST_OP_R(op) test_value_equality(x1 op y1, x2 op y2)
@ -490,16 +487,16 @@ namespace
void test_incrementable(X1 x1, X2 x2)
{
sanity_check( x1, x1, x2, x2 );
BOOST_CHECK( (x1++).value() == x2++ );
BOOST_CHECK( x1.value() == x2 );
BOOST_TEST( (x1++).value() == x2++ );
BOOST_TEST( x1.value() == x2 );
}
template <class X1, class X2>
void test_decrementable(X1 x1, X2 x2)
{
sanity_check( x1, x1, x2, x2 );
BOOST_CHECK( (x1--).value() == x2-- );
BOOST_CHECK( x1.value() == x2 );
BOOST_TEST( (x1--).value() == x2-- );
BOOST_TEST( x1.value() == x2 );
}
template <class X1, class Y1, class X2, class Y2>
@ -532,7 +529,7 @@ namespace
template <class Big, class Small>
struct tester
{
void operator()(boost::minstd_rand& randomizer) const
void operator()(boost::detail::minstd_rand& randomizer) const
{
Big b1 = Big( randomizer() );
Big b2 = Big( randomizer() );
@ -546,7 +543,7 @@ namespace
template <class Big, class Small>
struct tester_left
{
void operator()(boost::minstd_rand& randomizer) const
void operator()(boost::detail::minstd_rand& randomizer) const
{
Big b1 = Big( randomizer() );
Small s = Small( randomizer() );
@ -603,10 +600,10 @@ template Wrapped6<unsigned long, unsigned char>;
template Wrapped6<unsigned int, unsigned char>;
#endif
#define PRIVATE_EXPR_TEST(e, t) BOOST_CHECK( ((e), (t)) )
#define PRIVATE_EXPR_TEST(e, t) BOOST_TEST( ((e), (t)) )
int
test_main( int , char * [] )
main()
{
using std::cout;
using std::endl;
@ -620,7 +617,7 @@ test_main( int , char * [] )
for (int n = 0; n < 1000; ++n) // was 10,000 but took too long (Beman)
{
boost::minstd_rand r;
boost::detail::minstd_rand r;
tester<long, int>()(r);
tester<long, signed char>()(r);
tester<long, long>()(r);
@ -648,22 +645,22 @@ test_main( int , char * [] )
MyInt i2(2);
MyInt i;
BOOST_CHECK( i1.value() == 1 );
BOOST_CHECK( i2.value() == 2 );
BOOST_CHECK( i.value() == 0 );
BOOST_TEST( i1.value() == 1 );
BOOST_TEST( i2.value() == 2 );
BOOST_TEST( i.value() == 0 );
cout << "Created MyInt objects.\n";
PRIVATE_EXPR_TEST( (i = i2), (i.value() == 2) );
BOOST_CHECK( static_cast<bool>(i2 == i) );
BOOST_CHECK( static_cast<bool>(i1 != i2) );
BOOST_CHECK( static_cast<bool>(i1 < i2) );
BOOST_CHECK( static_cast<bool>(i1 <= i2) );
BOOST_CHECK( static_cast<bool>(i <= i2) );
BOOST_CHECK( static_cast<bool>(i2 > i1) );
BOOST_CHECK( static_cast<bool>(i2 >= i1) );
BOOST_CHECK( static_cast<bool>(i2 >= i) );
BOOST_TEST( static_cast<bool>(i2 == i) );
BOOST_TEST( static_cast<bool>(i1 != i2) );
BOOST_TEST( static_cast<bool>(i1 < i2) );
BOOST_TEST( static_cast<bool>(i1 <= i2) );
BOOST_TEST( static_cast<bool>(i <= i2) );
BOOST_TEST( static_cast<bool>(i2 > i1) );
BOOST_TEST( static_cast<bool>(i2 >= i1) );
BOOST_TEST( static_cast<bool>(i2 >= i) );
PRIVATE_EXPR_TEST( (i = i1 + i2), (i.value() == 3) );
PRIVATE_EXPR_TEST( (i = i + i2), (i.value() == 5) );
@ -687,86 +684,86 @@ test_main( int , char * [] )
MyLong j2(2);
MyLong j;
BOOST_CHECK( j1.value() == 1 );
BOOST_CHECK( j2.value() == 2 );
BOOST_CHECK( j.value() == 0 );
BOOST_TEST( j1.value() == 1 );
BOOST_TEST( j2.value() == 2 );
BOOST_TEST( j.value() == 0 );
cout << "Created MyLong objects.\n";
PRIVATE_EXPR_TEST( (j = j2), (j.value() == 2) );
BOOST_CHECK( static_cast<bool>(j2 == j) );
BOOST_CHECK( static_cast<bool>(2 == j) );
BOOST_CHECK( static_cast<bool>(j2 == 2) );
BOOST_CHECK( static_cast<bool>(j == j2) );
BOOST_CHECK( static_cast<bool>(j1 != j2) );
BOOST_CHECK( static_cast<bool>(j1 != 2) );
BOOST_CHECK( static_cast<bool>(1 != j2) );
BOOST_CHECK( static_cast<bool>(j1 < j2) );
BOOST_CHECK( static_cast<bool>(1 < j2) );
BOOST_CHECK( static_cast<bool>(j1 < 2) );
BOOST_CHECK( static_cast<bool>(j1 <= j2) );
BOOST_CHECK( static_cast<bool>(1 <= j2) );
BOOST_CHECK( static_cast<bool>(j1 <= j) );
BOOST_CHECK( static_cast<bool>(j <= j2) );
BOOST_CHECK( static_cast<bool>(2 <= j2) );
BOOST_CHECK( static_cast<bool>(j <= 2) );
BOOST_CHECK( static_cast<bool>(j2 > j1) );
BOOST_CHECK( static_cast<bool>(2 > j1) );
BOOST_CHECK( static_cast<bool>(j2 > 1) );
BOOST_CHECK( static_cast<bool>(j2 >= j1) );
BOOST_CHECK( static_cast<bool>(2 >= j1) );
BOOST_CHECK( static_cast<bool>(j2 >= 1) );
BOOST_CHECK( static_cast<bool>(j2 >= j) );
BOOST_CHECK( static_cast<bool>(2 >= j) );
BOOST_CHECK( static_cast<bool>(j2 >= 2) );
BOOST_TEST( static_cast<bool>(j2 == j) );
BOOST_TEST( static_cast<bool>(2 == j) );
BOOST_TEST( static_cast<bool>(j2 == 2) );
BOOST_TEST( static_cast<bool>(j == j2) );
BOOST_TEST( static_cast<bool>(j1 != j2) );
BOOST_TEST( static_cast<bool>(j1 != 2) );
BOOST_TEST( static_cast<bool>(1 != j2) );
BOOST_TEST( static_cast<bool>(j1 < j2) );
BOOST_TEST( static_cast<bool>(1 < j2) );
BOOST_TEST( static_cast<bool>(j1 < 2) );
BOOST_TEST( static_cast<bool>(j1 <= j2) );
BOOST_TEST( static_cast<bool>(1 <= j2) );
BOOST_TEST( static_cast<bool>(j1 <= j) );
BOOST_TEST( static_cast<bool>(j <= j2) );
BOOST_TEST( static_cast<bool>(2 <= j2) );
BOOST_TEST( static_cast<bool>(j <= 2) );
BOOST_TEST( static_cast<bool>(j2 > j1) );
BOOST_TEST( static_cast<bool>(2 > j1) );
BOOST_TEST( static_cast<bool>(j2 > 1) );
BOOST_TEST( static_cast<bool>(j2 >= j1) );
BOOST_TEST( static_cast<bool>(2 >= j1) );
BOOST_TEST( static_cast<bool>(j2 >= 1) );
BOOST_TEST( static_cast<bool>(j2 >= j) );
BOOST_TEST( static_cast<bool>(2 >= j) );
BOOST_TEST( static_cast<bool>(j2 >= 2) );
BOOST_CHECK( static_cast<bool>((j1 + 2) == 3) );
BOOST_CHECK( static_cast<bool>((1 + j2) == 3) );
BOOST_TEST( static_cast<bool>((j1 + 2) == 3) );
BOOST_TEST( static_cast<bool>((1 + j2) == 3) );
PRIVATE_EXPR_TEST( (j = j1 + j2), (j.value() == 3) );
BOOST_CHECK( static_cast<bool>((j + 2) == 5) );
BOOST_CHECK( static_cast<bool>((3 + j2) == 5) );
BOOST_TEST( static_cast<bool>((j + 2) == 5) );
BOOST_TEST( static_cast<bool>((3 + j2) == 5) );
PRIVATE_EXPR_TEST( (j = j + j2), (j.value() == 5) );
BOOST_CHECK( static_cast<bool>((j - 1) == 4) );
BOOST_TEST( static_cast<bool>((j - 1) == 4) );
PRIVATE_EXPR_TEST( (j = j - j1), (j.value() == 4) );
BOOST_CHECK( static_cast<bool>((j * 2) == 8) );
BOOST_CHECK( static_cast<bool>((4 * j2) == 8) );
BOOST_TEST( static_cast<bool>((j * 2) == 8) );
BOOST_TEST( static_cast<bool>((4 * j2) == 8) );
PRIVATE_EXPR_TEST( (j = j * j2), (j.value() == 8) );
BOOST_CHECK( static_cast<bool>((j / 2) == 4) );
BOOST_TEST( static_cast<bool>((j / 2) == 4) );
PRIVATE_EXPR_TEST( (j = j / j2), (j.value() == 4) );
BOOST_CHECK( static_cast<bool>((j % 3) == 1) );
BOOST_TEST( static_cast<bool>((j % 3) == 1) );
PRIVATE_EXPR_TEST( (j = j % ( j - j1 )), (j.value() == 1) );
PRIVATE_EXPR_TEST( (j = j2 + j2), (j.value() == 4) );
BOOST_CHECK( static_cast<bool>((1 | j2 | j) == 7) );
BOOST_CHECK( static_cast<bool>((j1 | 2 | j) == 7) );
BOOST_CHECK( static_cast<bool>((j1 | j2 | 4) == 7) );
BOOST_TEST( static_cast<bool>((1 | j2 | j) == 7) );
BOOST_TEST( static_cast<bool>((j1 | 2 | j) == 7) );
BOOST_TEST( static_cast<bool>((j1 | j2 | 4) == 7) );
PRIVATE_EXPR_TEST( (j = j1 | j2 | j), (j.value() == 7) );
BOOST_CHECK( static_cast<bool>((7 & j2) == 2) );
BOOST_CHECK( static_cast<bool>((j & 2) == 2) );
BOOST_TEST( static_cast<bool>((7 & j2) == 2) );
BOOST_TEST( static_cast<bool>((j & 2) == 2) );
PRIVATE_EXPR_TEST( (j = j & j2), (j.value() == 2) );
PRIVATE_EXPR_TEST( (j = j | j1), (j.value() == 3) );
BOOST_CHECK( static_cast<bool>((3 ^ j1) == 2) );
BOOST_CHECK( static_cast<bool>((j ^ 1) == 2) );
BOOST_TEST( static_cast<bool>((3 ^ j1) == 2) );
BOOST_TEST( static_cast<bool>((j ^ 1) == 2) );
PRIVATE_EXPR_TEST( (j = j ^ j1), (j.value() == 2) );
PRIVATE_EXPR_TEST( (j = ( j + j1 ) * ( j2 | j1 )), (j.value() == 9) );
BOOST_CHECK( static_cast<bool>((j1 << 2) == 4) );
BOOST_CHECK( static_cast<bool>((j2 << 1) == 4) );
BOOST_TEST( static_cast<bool>((j1 << 2) == 4) );
BOOST_TEST( static_cast<bool>((j2 << 1) == 4) );
PRIVATE_EXPR_TEST( (j = j1 << j2), (j.value() == 4) );
BOOST_CHECK( static_cast<bool>((j >> 2) == 1) );
BOOST_CHECK( static_cast<bool>((j2 >> 1) == 1) );
BOOST_TEST( static_cast<bool>((j >> 2) == 1) );
BOOST_TEST( static_cast<bool>((j2 >> 1) == 1) );
PRIVATE_EXPR_TEST( (j = j2 >> j1), (j.value() == 1) );
cout << "Performed tests on MyLong objects.\n";
@ -775,22 +772,22 @@ test_main( int , char * [] )
MyChar k2(2);
MyChar k;
BOOST_CHECK( k1.value() == 1 );
BOOST_CHECK( k2.value() == 2 );
BOOST_CHECK( k.value() == 0 );
BOOST_TEST( k1.value() == 1 );
BOOST_TEST( k2.value() == 2 );
BOOST_TEST( k.value() == 0 );
cout << "Created MyChar objects.\n";
PRIVATE_EXPR_TEST( (k = k2), (k.value() == 2) );
BOOST_CHECK( static_cast<bool>(k2 == k) );
BOOST_CHECK( static_cast<bool>(k1 != k2) );
BOOST_CHECK( static_cast<bool>(k1 < k2) );
BOOST_CHECK( static_cast<bool>(k1 <= k2) );
BOOST_CHECK( static_cast<bool>(k <= k2) );
BOOST_CHECK( static_cast<bool>(k2 > k1) );
BOOST_CHECK( static_cast<bool>(k2 >= k1) );
BOOST_CHECK( static_cast<bool>(k2 >= k) );
BOOST_TEST( static_cast<bool>(k2 == k) );
BOOST_TEST( static_cast<bool>(k1 != k2) );
BOOST_TEST( static_cast<bool>(k1 < k2) );
BOOST_TEST( static_cast<bool>(k1 <= k2) );
BOOST_TEST( static_cast<bool>(k <= k2) );
BOOST_TEST( static_cast<bool>(k2 > k1) );
BOOST_TEST( static_cast<bool>(k2 >= k1) );
BOOST_TEST( static_cast<bool>(k2 >= k) );
cout << "Performed tests on MyChar objects.\n";
@ -798,39 +795,39 @@ test_main( int , char * [] )
MyShort l2(2);
MyShort l;
BOOST_CHECK( l1.value() == 1 );
BOOST_CHECK( l2.value() == 2 );
BOOST_CHECK( l.value() == 0 );
BOOST_TEST( l1.value() == 1 );
BOOST_TEST( l2.value() == 2 );
BOOST_TEST( l.value() == 0 );
cout << "Created MyShort objects.\n";
PRIVATE_EXPR_TEST( (l = l2), (l.value() == 2) );
BOOST_CHECK( static_cast<bool>(l2 == l) );
BOOST_CHECK( static_cast<bool>(2 == l) );
BOOST_CHECK( static_cast<bool>(l2 == 2) );
BOOST_CHECK( static_cast<bool>(l == l2) );
BOOST_CHECK( static_cast<bool>(l1 != l2) );
BOOST_CHECK( static_cast<bool>(l1 != 2) );
BOOST_CHECK( static_cast<bool>(1 != l2) );
BOOST_CHECK( static_cast<bool>(l1 < l2) );
BOOST_CHECK( static_cast<bool>(1 < l2) );
BOOST_CHECK( static_cast<bool>(l1 < 2) );
BOOST_CHECK( static_cast<bool>(l1 <= l2) );
BOOST_CHECK( static_cast<bool>(1 <= l2) );
BOOST_CHECK( static_cast<bool>(l1 <= l) );
BOOST_CHECK( static_cast<bool>(l <= l2) );
BOOST_CHECK( static_cast<bool>(2 <= l2) );
BOOST_CHECK( static_cast<bool>(l <= 2) );
BOOST_CHECK( static_cast<bool>(l2 > l1) );
BOOST_CHECK( static_cast<bool>(2 > l1) );
BOOST_CHECK( static_cast<bool>(l2 > 1) );
BOOST_CHECK( static_cast<bool>(l2 >= l1) );
BOOST_CHECK( static_cast<bool>(2 >= l1) );
BOOST_CHECK( static_cast<bool>(l2 >= 1) );
BOOST_CHECK( static_cast<bool>(l2 >= l) );
BOOST_CHECK( static_cast<bool>(2 >= l) );
BOOST_CHECK( static_cast<bool>(l2 >= 2) );
BOOST_TEST( static_cast<bool>(l2 == l) );
BOOST_TEST( static_cast<bool>(2 == l) );
BOOST_TEST( static_cast<bool>(l2 == 2) );
BOOST_TEST( static_cast<bool>(l == l2) );
BOOST_TEST( static_cast<bool>(l1 != l2) );
BOOST_TEST( static_cast<bool>(l1 != 2) );
BOOST_TEST( static_cast<bool>(1 != l2) );
BOOST_TEST( static_cast<bool>(l1 < l2) );
BOOST_TEST( static_cast<bool>(1 < l2) );
BOOST_TEST( static_cast<bool>(l1 < 2) );
BOOST_TEST( static_cast<bool>(l1 <= l2) );
BOOST_TEST( static_cast<bool>(1 <= l2) );
BOOST_TEST( static_cast<bool>(l1 <= l) );
BOOST_TEST( static_cast<bool>(l <= l2) );
BOOST_TEST( static_cast<bool>(2 <= l2) );
BOOST_TEST( static_cast<bool>(l <= 2) );
BOOST_TEST( static_cast<bool>(l2 > l1) );
BOOST_TEST( static_cast<bool>(2 > l1) );
BOOST_TEST( static_cast<bool>(l2 > 1) );
BOOST_TEST( static_cast<bool>(l2 >= l1) );
BOOST_TEST( static_cast<bool>(2 >= l1) );
BOOST_TEST( static_cast<bool>(l2 >= 1) );
BOOST_TEST( static_cast<bool>(l2 >= l) );
BOOST_TEST( static_cast<bool>(2 >= l) );
BOOST_TEST( static_cast<bool>(l2 >= 2) );
cout << "Performed tests on MyShort objects.\n";
@ -840,44 +837,44 @@ test_main( int , char * [] )
MyDoubleInt di;
MyDoubleInt tmp;
BOOST_CHECK( di1.value() == 1 );
BOOST_CHECK( di2.value() == 2 );
BOOST_CHECK( di2.value() == 2 );
BOOST_CHECK( di.value() == 0 );
BOOST_TEST( di1.value() == 1 );
BOOST_TEST( di2.value() == 2 );
BOOST_TEST( di2.value() == 2 );
BOOST_TEST( di.value() == 0 );
cout << "Created MyDoubleInt objects.\n";
PRIVATE_EXPR_TEST( (di = di2), (di.value() == 2) );
BOOST_CHECK( static_cast<bool>(di2 == di) );
BOOST_CHECK( static_cast<bool>(2 == di) );
BOOST_CHECK( static_cast<bool>(di == 2) );
BOOST_CHECK( static_cast<bool>(di1 < di2) );
BOOST_CHECK( static_cast<bool>(1 < di2) );
BOOST_CHECK( static_cast<bool>(di1 <= di2) );
BOOST_CHECK( static_cast<bool>(1 <= di2) );
BOOST_CHECK( static_cast<bool>(di2 > di1) );
BOOST_CHECK( static_cast<bool>(di2 > 1) );
BOOST_CHECK( static_cast<bool>(di2 >= di1) );
BOOST_CHECK( static_cast<bool>(di2 >= 1) );
BOOST_CHECK( static_cast<bool>(di1 / di2 == half) );
BOOST_CHECK( static_cast<bool>(di1 / 2 == half) );
BOOST_CHECK( static_cast<bool>(1 / di2 == half) );
BOOST_TEST( static_cast<bool>(di2 == di) );
BOOST_TEST( static_cast<bool>(2 == di) );
BOOST_TEST( static_cast<bool>(di == 2) );
BOOST_TEST( static_cast<bool>(di1 < di2) );
BOOST_TEST( static_cast<bool>(1 < di2) );
BOOST_TEST( static_cast<bool>(di1 <= di2) );
BOOST_TEST( static_cast<bool>(1 <= di2) );
BOOST_TEST( static_cast<bool>(di2 > di1) );
BOOST_TEST( static_cast<bool>(di2 > 1) );
BOOST_TEST( static_cast<bool>(di2 >= di1) );
BOOST_TEST( static_cast<bool>(di2 >= 1) );
BOOST_TEST( static_cast<bool>(di1 / di2 == half) );
BOOST_TEST( static_cast<bool>(di1 / 2 == half) );
BOOST_TEST( static_cast<bool>(1 / di2 == half) );
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp/=2) == half) );
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp/=di2) == half) );
BOOST_CHECK( static_cast<bool>(di1 * di2 == di2) );
BOOST_CHECK( static_cast<bool>(di1 * 2 == di2) );
BOOST_CHECK( static_cast<bool>(1 * di2 == di2) );
BOOST_TEST( static_cast<bool>(di1 * di2 == di2) );
BOOST_TEST( static_cast<bool>(di1 * 2 == di2) );
BOOST_TEST( static_cast<bool>(1 * di2 == di2) );
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp*=2) == di2) );
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp*=di2) == di2) );
BOOST_CHECK( static_cast<bool>(di2 - di1 == di1) );
BOOST_CHECK( static_cast<bool>(di2 - 1 == di1) );
BOOST_CHECK( static_cast<bool>(2 - di1 == di1) );
BOOST_TEST( static_cast<bool>(di2 - di1 == di1) );
BOOST_TEST( static_cast<bool>(di2 - 1 == di1) );
BOOST_TEST( static_cast<bool>(2 - di1 == di1) );
PRIVATE_EXPR_TEST( (tmp=di2), static_cast<bool>((tmp-=1) == di1) );
PRIVATE_EXPR_TEST( (tmp=di2), static_cast<bool>((tmp-=di1) == di1) );
BOOST_CHECK( static_cast<bool>(di1 + di1 == di2) );
BOOST_CHECK( static_cast<bool>(di1 + 1 == di2) );
BOOST_CHECK( static_cast<bool>(1 + di1 == di2) );
BOOST_TEST( static_cast<bool>(di1 + di1 == di2) );
BOOST_TEST( static_cast<bool>(di1 + 1 == di2) );
BOOST_TEST( static_cast<bool>(1 + di1 == di2) );
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp+=1) == di2) );
PRIVATE_EXPR_TEST( (tmp=di1), static_cast<bool>((tmp+=di1) == di2) );
@ -888,52 +885,52 @@ test_main( int , char * [] )
MyLongInt li;
MyLongInt tmp2;
BOOST_CHECK( li1.value() == 1 );
BOOST_CHECK( li2.value() == 2 );
BOOST_CHECK( li.value() == 0 );
BOOST_TEST( li1.value() == 1 );
BOOST_TEST( li2.value() == 2 );
BOOST_TEST( li.value() == 0 );
cout << "Created MyLongInt objects.\n";
PRIVATE_EXPR_TEST( (li = li2), (li.value() == 2) );
BOOST_CHECK( static_cast<bool>(li2 == li) );
BOOST_CHECK( static_cast<bool>(2 == li) );
BOOST_CHECK( static_cast<bool>(li == 2) );
BOOST_CHECK( static_cast<bool>(li1 < li2) );
BOOST_CHECK( static_cast<bool>(1 < li2) );
BOOST_CHECK( static_cast<bool>(li1 <= li2) );
BOOST_CHECK( static_cast<bool>(1 <= li2) );
BOOST_CHECK( static_cast<bool>(li2 > li1) );
BOOST_CHECK( static_cast<bool>(li2 > 1) );
BOOST_CHECK( static_cast<bool>(li2 >= li1) );
BOOST_CHECK( static_cast<bool>(li2 >= 1) );
BOOST_CHECK( static_cast<bool>(li1 % li2 == li1) );
BOOST_CHECK( static_cast<bool>(li1 % 2 == li1) );
BOOST_CHECK( static_cast<bool>(1 % li2 == li1) );
BOOST_TEST( static_cast<bool>(li2 == li) );
BOOST_TEST( static_cast<bool>(2 == li) );
BOOST_TEST( static_cast<bool>(li == 2) );
BOOST_TEST( static_cast<bool>(li1 < li2) );
BOOST_TEST( static_cast<bool>(1 < li2) );
BOOST_TEST( static_cast<bool>(li1 <= li2) );
BOOST_TEST( static_cast<bool>(1 <= li2) );
BOOST_TEST( static_cast<bool>(li2 > li1) );
BOOST_TEST( static_cast<bool>(li2 > 1) );
BOOST_TEST( static_cast<bool>(li2 >= li1) );
BOOST_TEST( static_cast<bool>(li2 >= 1) );
BOOST_TEST( static_cast<bool>(li1 % li2 == li1) );
BOOST_TEST( static_cast<bool>(li1 % 2 == li1) );
BOOST_TEST( static_cast<bool>(1 % li2 == li1) );
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2%=2) == li1) );
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2%=li2) == li1) );
BOOST_CHECK( static_cast<bool>(li1 / li2 == 0) );
BOOST_CHECK( static_cast<bool>(li1 / 2 == 0) );
BOOST_CHECK( static_cast<bool>(1 / li2 == 0) );
BOOST_TEST( static_cast<bool>(li1 / li2 == 0) );
BOOST_TEST( static_cast<bool>(li1 / 2 == 0) );
BOOST_TEST( static_cast<bool>(1 / li2 == 0) );
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2/=2) == 0) );
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2/=li2) == 0) );
BOOST_CHECK( static_cast<bool>(li1 * li2 == li2) );
BOOST_CHECK( static_cast<bool>(li1 * 2 == li2) );
BOOST_CHECK( static_cast<bool>(1 * li2 == li2) );
BOOST_TEST( static_cast<bool>(li1 * li2 == li2) );
BOOST_TEST( static_cast<bool>(li1 * 2 == li2) );
BOOST_TEST( static_cast<bool>(1 * li2 == li2) );
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2*=2) == li2) );
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2*=li2) == li2) );
BOOST_CHECK( static_cast<bool>(li2 - li1 == li1) );
BOOST_CHECK( static_cast<bool>(li2 - 1 == li1) );
BOOST_CHECK( static_cast<bool>(2 - li1 == li1) );
BOOST_TEST( static_cast<bool>(li2 - li1 == li1) );
BOOST_TEST( static_cast<bool>(li2 - 1 == li1) );
BOOST_TEST( static_cast<bool>(2 - li1 == li1) );
PRIVATE_EXPR_TEST( (tmp2=li2), static_cast<bool>((tmp2-=1) == li1) );
PRIVATE_EXPR_TEST( (tmp2=li2), static_cast<bool>((tmp2-=li1) == li1) );
BOOST_CHECK( static_cast<bool>(li1 + li1 == li2) );
BOOST_CHECK( static_cast<bool>(li1 + 1 == li2) );
BOOST_CHECK( static_cast<bool>(1 + li1 == li2) );
BOOST_TEST( static_cast<bool>(li1 + li1 == li2) );
BOOST_TEST( static_cast<bool>(li1 + 1 == li2) );
BOOST_TEST( static_cast<bool>(1 + li1 == li2) );
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2+=1) == li2) );
PRIVATE_EXPR_TEST( (tmp2=li1), static_cast<bool>((tmp2+=li1) == li2) );
cout << "Performed tests on MyLongInt objects.\n";
return boost::exit_success;
return boost::report_errors();
}

View File

@ -1,64 +0,0 @@
// Copyright 2003 The Trustees of Indiana University.
// Use, modification and distribution is subject to 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)
// Shared container iterator adaptor
// Author: Ronald Garcia
// See http://boost.org/libs/utility/shared_container_iterator.html
// for documentation.
//
// shared_iterator_test.cpp - Regression tests for shared_container_iterator.
//
#include "boost/shared_container_iterator.hpp"
#include "boost/shared_ptr.hpp"
#include <vector>
#include <cassert>
struct resource {
static int count;
resource() { ++count; }
resource(resource const&) { ++count; }
~resource() { --count; }
};
int resource::count = 0;
typedef std::vector<resource> resources_t;
typedef boost::shared_container_iterator< resources_t > iterator;
void set_range(iterator& i, iterator& end) {
boost::shared_ptr< resources_t > objs(new resources_t());
for (int j = 0; j != 6; ++j)
objs->push_back(resource());
i = iterator(objs->begin(),objs);
end = iterator(objs->end(),objs);
assert(resource::count == 6);
}
int main() {
assert(resource::count == 0);
{
iterator i;
{
iterator end;
set_range(i,end);
assert(resource::count == 6);
}
assert(resource::count == 6);
}
assert(resource::count == 0);
return 0;
}

View File

@ -17,11 +17,9 @@
#error "Unsupported test"
#endif
#include "boost/test/minimal.hpp"
std::string makeatemp() { return "abc"; }
int test_main(int, char **)
int main()
{
boost::basic_string_ref<char> sv(makeatemp());
return 0;

View File

@ -13,17 +13,16 @@
#include <boost/utility/string_ref.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/core/lightweight_test.hpp>
typedef boost::string_ref string_ref;
// Should be equal
void interop ( const std::string &str, string_ref ref ) {
// BOOST_CHECK ( str == ref );
BOOST_CHECK ( str.size () == ref.size ());
BOOST_CHECK ( std::equal ( str.begin (), str.end (), ref.begin ()));
BOOST_CHECK ( std::equal ( str.rbegin (), str.rend (), ref.rbegin ()));
// BOOST_TEST ( str == ref );
BOOST_TEST ( str.size () == ref.size ());
BOOST_TEST ( std::equal ( str.begin (), str.end (), ref.begin ()));
BOOST_TEST ( std::equal ( str.rbegin (), str.rend (), ref.rbegin ()));
}
void null_tests ( const char *p ) {
@ -34,10 +33,10 @@ void null_tests ( const char *p ) {
string_ref sr4 ( p );
sr4.clear ();
BOOST_CHECK ( sr1 == sr2 );
BOOST_CHECK ( sr1 == sr3 );
BOOST_CHECK ( sr2 == sr3 );
BOOST_CHECK ( sr1 == sr4 );
BOOST_TEST ( sr1 == sr2 );
BOOST_TEST ( sr1 == sr3 );
BOOST_TEST ( sr2 == sr3 );
BOOST_TEST ( sr1 == sr4 );
}
// make sure that substrings work just like strings
@ -94,7 +93,7 @@ const char *test_strings [] = {
NULL
};
BOOST_AUTO_TEST_CASE( test_main )
int main()
{
const char **p = &test_strings[0];
@ -106,4 +105,6 @@ BOOST_AUTO_TEST_CASE( test_main )
p++;
}
return boost::report_errors();
}

View File

@ -12,8 +12,7 @@
#include <boost/utility/string_ref.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/core/lightweight_test.hpp>
typedef boost::string_ref string_ref;
@ -24,27 +23,27 @@ void ends_with ( const char *arg ) {
const char *p = arg;
while ( *p ) {
BOOST_CHECK ( sr.ends_with ( p ));
BOOST_TEST ( sr.ends_with ( p ));
++p;
}
while ( !sr2.empty ()) {
BOOST_CHECK ( sr.ends_with ( sr2 ));
BOOST_TEST ( sr.ends_with ( sr2 ));
sr2.remove_prefix (1);
}
sr2 = arg;
while ( !sr2.empty ()) {
BOOST_CHECK ( sr.ends_with ( sr2 ));
BOOST_TEST ( sr.ends_with ( sr2 ));
sr2.remove_prefix (1);
}
char ch = sz == 0 ? '\0' : arg [ sz - 1 ];
sr2 = arg;
if ( sz > 0 )
BOOST_CHECK ( sr2.ends_with ( ch ));
BOOST_CHECK ( !sr2.ends_with ( ++ch ));
BOOST_CHECK ( sr2.ends_with ( string_ref ()));
BOOST_TEST ( sr2.ends_with ( ch ));
BOOST_TEST ( !sr2.ends_with ( ++ch ));
BOOST_TEST ( sr2.ends_with ( string_ref ()));
}
void starts_with ( const char *arg ) {
@ -54,21 +53,21 @@ void starts_with ( const char *arg ) {
const char *p = arg + std::strlen ( arg ) - 1;
while ( p >= arg ) {
std::string foo ( arg, p + 1 );
BOOST_CHECK ( sr.starts_with ( foo ));
BOOST_TEST ( sr.starts_with ( foo ));
--p;
}
while ( !sr2.empty ()) {
BOOST_CHECK ( sr.starts_with ( sr2 ));
BOOST_TEST ( sr.starts_with ( sr2 ));
sr2.remove_suffix (1);
}
char ch = *arg;
sr2 = arg;
if ( sz > 0 )
BOOST_CHECK ( sr2.starts_with ( ch ));
BOOST_CHECK ( !sr2.starts_with ( ++ch ));
BOOST_CHECK ( sr2.starts_with ( string_ref ()));
BOOST_TEST ( sr2.starts_with ( ch ));
BOOST_TEST ( !sr2.starts_with ( ++ch ));
BOOST_TEST ( sr2.starts_with ( string_ref ()));
}
void reverse ( const char *arg ) {
@ -78,14 +77,14 @@ void reverse ( const char *arg ) {
string_ref sr2 ( string1 );
std::string string2 ( sr2.rbegin (), sr2.rend ());
BOOST_CHECK ( std::equal ( sr2.rbegin (), sr2.rend (), arg ));
BOOST_CHECK ( string2 == arg );
BOOST_CHECK ( std::equal ( sr1.begin (), sr1.end (), string2.begin ()));
BOOST_TEST ( std::equal ( sr2.rbegin (), sr2.rend (), arg ));
BOOST_TEST ( string2 == arg );
BOOST_TEST ( std::equal ( sr1.begin (), sr1.end (), string2.begin ()));
}
// This helper function eliminates signed vs. unsigned warnings
string_ref::size_type ptr_diff ( const char *res, const char *base ) {
BOOST_CHECK ( res >= base );
BOOST_TEST ( res >= base );
return static_cast<string_ref::size_type> ( res - base );
}
@ -94,12 +93,16 @@ void find ( const char *arg ) {
string_ref sr2;
const char *p;
// When we search for the empty string, we find it at position 0
BOOST_TEST ( sr1.find (sr2) == 0 );
BOOST_TEST ( sr1.rfind(sr2) == 0 );
// Look for each character in the string(searching from the start)
p = arg;
sr1 = arg;
while ( *p ) {
string_ref::size_type pos = sr1.find(*p);
BOOST_CHECK ( pos != string_ref::npos && ( pos <= ptr_diff ( p, arg )));
BOOST_TEST ( pos != string_ref::npos && ( pos <= ptr_diff ( p, arg )));
++p;
}
@ -108,7 +111,7 @@ void find ( const char *arg ) {
sr1 = arg;
while ( *p ) {
string_ref::size_type pos = sr1.rfind(*p);
BOOST_CHECK ( pos != string_ref::npos && pos < sr1.size () && ( pos >= ptr_diff ( p, arg )));
BOOST_TEST ( pos != string_ref::npos && pos < sr1.size () && ( pos >= ptr_diff ( p, arg )));
++p;
}
@ -118,7 +121,7 @@ void find ( const char *arg ) {
while ( *p && *(p+1)) {
string_ref sr3 ( p, 2 );
string_ref::size_type pos = sr1.find ( sr3 );
BOOST_CHECK ( pos != string_ref::npos && pos <= static_cast<string_ref::size_type>( p - arg ));
BOOST_TEST ( pos != string_ref::npos && pos <= static_cast<string_ref::size_type>( p - arg ));
p++;
}
@ -129,9 +132,9 @@ void find ( const char *arg ) {
for ( int ch = 1; ch < 256; ++ch ) {
string_ref::size_type pos = sr1.find(ch);
const char *strp = std::strchr ( arg, ch );
BOOST_CHECK (( strp == NULL ) == ( pos == string_ref::npos ));
BOOST_TEST (( strp == NULL ) == ( pos == string_ref::npos ));
if ( strp != NULL )
BOOST_CHECK ( ptr_diff ( strp, arg ) == pos );
BOOST_TEST ( ptr_diff ( strp, arg ) == pos );
}
sr1 = arg;
@ -141,9 +144,9 @@ void find ( const char *arg ) {
for ( int ch = 1; ch < 256; ++ch ) {
string_ref::size_type pos = sr1.rfind(ch);
const char *strp = std::strrchr ( arg, ch );
BOOST_CHECK (( strp == NULL ) == ( pos == string_ref::npos ));
BOOST_TEST (( strp == NULL ) == ( pos == string_ref::npos ));
if ( strp != NULL )
BOOST_CHECK ( ptr_diff ( strp, arg ) == pos );
BOOST_TEST ( ptr_diff ( strp, arg ) == pos );
}
@ -152,7 +155,7 @@ void find ( const char *arg ) {
sr1 = arg;
while ( !sr1.empty ()) {
string_ref::size_type pos = sr1.find(*p);
BOOST_CHECK ( pos == 0 );
BOOST_TEST ( pos == 0 );
sr1.remove_prefix (1);
++p;
}
@ -162,7 +165,7 @@ void find ( const char *arg ) {
p = arg + std::strlen ( arg ) - 1;
while ( !sr1.empty ()) {
string_ref::size_type pos = sr1.rfind(*p);
BOOST_CHECK ( pos == sr1.size () - 1 );
BOOST_TEST ( pos == sr1.size () - 1 );
sr1.remove_suffix (1);
--p;
}
@ -172,7 +175,7 @@ void find ( const char *arg ) {
p = arg;
while ( !sr1.empty ()) {
string_ref::size_type pos = sr1.find_first_of(*p);
BOOST_CHECK ( pos == 0 );
BOOST_TEST ( pos == 0 );
sr1.remove_prefix (1);
++p;
}
@ -183,7 +186,7 @@ void find ( const char *arg ) {
p = arg + std::strlen ( arg ) - 1;
while ( !sr1.empty ()) {
string_ref::size_type pos = sr1.find_last_of(*p);
BOOST_CHECK ( pos == sr1.size () - 1 );
BOOST_TEST ( pos == sr1.size () - 1 );
sr1.remove_suffix (1);
--p;
}
@ -192,8 +195,8 @@ void find ( const char *arg ) {
sr1 = arg;
sr2 = arg;
while ( !sr1.empty() ) {
BOOST_CHECK ( sr1.find_first_of ( sr2 ) == 0 );
BOOST_CHECK ( sr1.find_first_not_of ( sr2 ) == string_ref::npos );
BOOST_TEST ( sr1.find_first_of ( sr2 ) == 0 );
BOOST_TEST ( sr1.find_first_not_of ( sr2 ) == string_ref::npos );
sr1.remove_prefix ( 1 );
}
@ -202,14 +205,14 @@ void find ( const char *arg ) {
while ( *p ) {
string_ref::size_type pos1 = sr1.find_first_of(*p);
string_ref::size_type pos2 = sr1.find_first_not_of(*p);
BOOST_CHECK ( pos1 != string_ref::npos && pos1 < sr1.size () && pos1 <= ptr_diff ( p, arg ));
BOOST_TEST ( pos1 != string_ref::npos && pos1 < sr1.size () && pos1 <= ptr_diff ( p, arg ));
if ( pos2 != string_ref::npos ) {
for ( size_t i = 0 ; i < pos2; ++i )
BOOST_CHECK ( sr1[i] == *p );
BOOST_CHECK ( sr1 [ pos2 ] != *p );
BOOST_TEST ( sr1[i] == *p );
BOOST_TEST ( sr1 [ pos2 ] != *p );
}
BOOST_CHECK ( pos2 != pos1 );
BOOST_TEST ( pos2 != pos1 );
++p;
}
@ -217,8 +220,8 @@ void find ( const char *arg ) {
sr1 = arg;
sr2 = arg;
while ( !sr1.empty() ) {
BOOST_CHECK ( sr1.find_last_of ( sr2 ) == ( sr1.size () - 1 ));
BOOST_CHECK ( sr1.find_last_not_of ( sr2 ) == string_ref::npos );
BOOST_TEST ( sr1.find_last_of ( sr2 ) == ( sr1.size () - 1 ));
BOOST_TEST ( sr1.find_last_not_of ( sr2 ) == string_ref::npos );
sr1.remove_suffix ( 1 );
}
@ -227,15 +230,15 @@ void find ( const char *arg ) {
while ( *p ) {
string_ref::size_type pos1 = sr1.find_last_of(*p);
string_ref::size_type pos2 = sr1.find_last_not_of(*p);
BOOST_CHECK ( pos1 != string_ref::npos && pos1 < sr1.size () && pos1 >= ptr_diff ( p, arg ));
BOOST_CHECK ( pos2 == string_ref::npos || pos1 < sr1.size ());
BOOST_TEST ( pos1 != string_ref::npos && pos1 < sr1.size () && pos1 >= ptr_diff ( p, arg ));
BOOST_TEST ( pos2 == string_ref::npos || pos1 < sr1.size ());
if ( pos2 != string_ref::npos ) {
for ( size_t i = sr1.size () -1 ; i > pos2; --i )
BOOST_CHECK ( sr1[i] == *p );
BOOST_CHECK ( sr1 [ pos2 ] != *p );
BOOST_TEST ( sr1[i] == *p );
BOOST_TEST ( sr1 [ pos2 ] != *p );
}
BOOST_CHECK ( pos2 != pos1 );
BOOST_TEST ( pos2 != pos1 );
++p;
}
@ -251,11 +254,11 @@ void to_string ( const char *arg ) {
sr1 = arg;
// str2 = sr1.to_string<std::allocator<char> > ();
str2 = sr1.to_string ();
BOOST_CHECK ( str1 == str2 );
BOOST_TEST ( str1 == str2 );
#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
std::string str3 = static_cast<std::string> ( sr1 );
BOOST_CHECK ( str1 == str3 );
BOOST_TEST ( str1 == str3 );
#endif
}
@ -266,28 +269,28 @@ void compare ( const char *arg ) {
str1.assign ( arg );
sr1 = arg;
BOOST_CHECK ( sr1 == sr1); // compare string_ref and string_ref
BOOST_CHECK ( sr1 == str1); // compare string and string_ref
BOOST_CHECK ( str1 == sr1 ); // compare string_ref and string
BOOST_CHECK ( sr1 == arg ); // compare string_ref and pointer
BOOST_CHECK ( arg == sr1 ); // compare pointer and string_ref
BOOST_TEST ( sr1 == sr1); // compare string_ref and string_ref
BOOST_TEST ( sr1 == str1); // compare string and string_ref
BOOST_TEST ( str1 == sr1 ); // compare string_ref and string
BOOST_TEST ( sr1 == arg ); // compare string_ref and pointer
BOOST_TEST ( arg == sr1 ); // compare pointer and string_ref
if ( sr1.size () > 0 ) {
(*str1.rbegin())++;
BOOST_CHECK ( sr1 != str1 );
BOOST_CHECK ( str1 != sr1 );
BOOST_CHECK ( sr1 < str1 );
BOOST_CHECK ( sr1 <= str1 );
BOOST_CHECK ( str1 > sr1 );
BOOST_CHECK ( str1 >= sr1 );
BOOST_TEST ( sr1 != str1 );
BOOST_TEST ( str1 != sr1 );
BOOST_TEST ( sr1 < str1 );
BOOST_TEST ( sr1 <= str1 );
BOOST_TEST ( str1 > sr1 );
BOOST_TEST ( str1 >= sr1 );
(*str1.rbegin()) -= 2;
BOOST_CHECK ( sr1 != str1 );
BOOST_CHECK ( str1 != sr1 );
BOOST_CHECK ( sr1 > str1 );
BOOST_CHECK ( sr1 >= str1 );
BOOST_CHECK ( str1 < sr1 );
BOOST_CHECK ( str1 <= sr1 );
BOOST_TEST ( sr1 != str1 );
BOOST_TEST ( str1 != sr1 );
BOOST_TEST ( sr1 > str1 );
BOOST_TEST ( sr1 >= str1 );
BOOST_TEST ( str1 < sr1 );
BOOST_TEST ( str1 <= sr1 );
}
}
@ -301,7 +304,7 @@ const char *test_strings [] = {
NULL
};
BOOST_AUTO_TEST_CASE( test_main )
int main()
{
const char **p = &test_strings[0];
@ -315,4 +318,6 @@ BOOST_AUTO_TEST_CASE( test_main )
p++;
}
return boost::report_errors();
}

View File

@ -12,8 +12,6 @@
* \brief This header contains tests for stream operations of \c basic_string_ref.
*/
#define BOOST_TEST_MODULE string_ref_test_io
#include <boost/utility/string_ref.hpp>
#include <iomanip>
@ -23,23 +21,10 @@
#include <string>
#include <boost/config.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/core/lightweight_test.hpp>
typedef boost::mpl::vector<
char
#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
, wchar_t
#endif
/* Current implementations seem to be missing codecvt facets to convert chars to char16_t and char32_t even though the types are available.
#if !defined(BOOST_NO_CXX11_CHAR16_T)
, char16_t
#endif
#if !defined(BOOST_NO_CXX11_CHAR32_T)
, char32_t
#endif
*/
>::type char_types;
static const char* test_strings[] =
{
@ -72,7 +57,8 @@ struct context
};
// Test regular output
BOOST_AUTO_TEST_CASE_TEMPLATE(string_ref_output, CharT, char_types)
template<class CharT>
void test_string_ref_output()
{
typedef CharT char_type;
typedef std::basic_ostringstream< char_type > ostream_type;
@ -82,11 +68,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(string_ref_output, CharT, char_types)
ostream_type strm;
strm << string_ref_type(ctx.abcd);
BOOST_CHECK(strm.str() == ctx.abcd);
BOOST_TEST(strm.str() == ctx.abcd);
}
// Test support for padding
BOOST_AUTO_TEST_CASE_TEMPLATE(padding, CharT, char_types)
template<class CharT>
void test_padding()
{
typedef CharT char_type;
typedef std::basic_ostringstream< char_type > ostream_type;
@ -102,7 +89,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(padding, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::setw(8) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
// Test for long padding
@ -113,7 +100,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(padding, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::setw(100) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
// Test that short width does not truncate the string
@ -124,12 +111,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(padding, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::setw(1) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
}
// Test support for padding fill
BOOST_AUTO_TEST_CASE_TEMPLATE(padding_fill, CharT, char_types)
template<class CharT>
void test_padding_fill()
{
typedef CharT char_type;
typedef std::basic_ostringstream< char_type > ostream_type;
@ -143,11 +131,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(padding_fill, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::setfill(static_cast< char_type >('x')) << std::setw(8) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
// Test support for alignment
BOOST_AUTO_TEST_CASE_TEMPLATE(alignment, CharT, char_types)
template<class CharT>
void test_alignment()
{
typedef CharT char_type;
typedef std::basic_ostringstream< char_type > ostream_type;
@ -163,7 +152,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(alignment, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::left << std::setw(8) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
// Right alignment
@ -174,6 +163,22 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(alignment, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::right << std::setw(8) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
}
template<class CharT>
void test()
{
test_string_ref_output<CharT>();
test_padding<CharT>();
test_padding_fill<CharT>();
test_alignment<CharT>();
}
int main()
{
test<char>();
test<wchar_t>();
return boost::report_errors();
}

View File

@ -16,14 +16,7 @@
#include <boost/config.hpp>
#include <boost/utility/string_view.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#if __cplusplus < 201402L
BOOST_AUTO_TEST_CASE( test_main ) {}
#else
#if __cplusplus >= 201402L
struct constexpr_char_traits
{
typedef char char_type;
@ -78,7 +71,7 @@ constexpr size_t constexpr_char_traits::length(const char_type* s) noexcept
typedef boost::basic_string_view<char, constexpr_char_traits> string_view;
BOOST_AUTO_TEST_CASE( test_main )
int main()
{
constexpr string_view sv1;
constexpr string_view sv2{"abc", 3}; // ptr, len

View File

@ -17,11 +17,9 @@
#error "Unsupported test"
#endif
#include "boost/test/minimal.hpp"
std::string makeatemp() { return "abc"; }
int test_main(int, char **)
int main()
{
boost::basic_string_view<char> sv(makeatemp());
return 0;

View File

@ -12,18 +12,18 @@
#include <string>
#include <boost/utility/string_view.hpp>
#include <boost/container_hash/hash.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/core/lightweight_test.hpp>
typedef boost::string_view string_view;
// Should be equal
void interop ( const std::string &str, string_view ref ) {
// BOOST_CHECK ( str == ref );
BOOST_CHECK ( str.size () == ref.size ());
BOOST_CHECK ( std::equal ( str.begin (), str.end (), ref.begin ()));
BOOST_CHECK ( std::equal ( str.rbegin (), str.rend (), ref.rbegin ()));
// BOOST_TEST ( str == ref );
BOOST_TEST ( str.size () == ref.size ());
BOOST_TEST ( std::equal ( str.begin (), str.end (), ref.begin ()));
BOOST_TEST ( std::equal ( str.rbegin (), str.rend (), ref.rbegin ()));
}
void null_tests ( const char *p ) {
@ -34,10 +34,10 @@ void null_tests ( const char *p ) {
string_view sr4 ( p );
sr4.clear ();
BOOST_CHECK ( sr1 == sr2 );
BOOST_CHECK ( sr1 == sr3 );
BOOST_CHECK ( sr2 == sr3 );
BOOST_CHECK ( sr1 == sr4 );
BOOST_TEST ( sr1 == sr2 );
BOOST_TEST ( sr1 == sr3 );
BOOST_TEST ( sr2 == sr3 );
BOOST_TEST ( sr1 == sr4 );
}
// make sure that substrings work just like strings
@ -86,6 +86,14 @@ void test_remove ( const std::string &str ) {
}
}
void test_hash(const std::string& str) {
string_view ref = str;
BOOST_TEST(boost::hash_value(ref) == boost::hash_value(str));
boost::hash<std::string> hstr;
boost::hash<string_view> hsv;
BOOST_TEST(hsv(ref) == hstr(str));
}
const char *test_strings [] = {
"",
"1",
@ -94,7 +102,7 @@ const char *test_strings [] = {
NULL
};
BOOST_AUTO_TEST_CASE( test_main )
int main()
{
const char **p = &test_strings[0];
@ -103,7 +111,10 @@ BOOST_AUTO_TEST_CASE( test_main )
test_substr ( *p );
test_remove ( *p );
null_tests ( *p );
test_hash( *p );
p++;
}
return boost::report_errors();
}

View File

@ -16,8 +16,7 @@
#include <boost/utility/string_view.hpp>
#include <boost/config.hpp>
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/core/lightweight_test.hpp>
typedef boost::string_view string_view;
@ -28,27 +27,27 @@ void ends_with ( const char *arg ) {
const char *p = arg;
while ( *p ) {
BOOST_CHECK ( sr.ends_with ( p ));
BOOST_TEST ( sr.ends_with ( p ));
++p;
}
while ( !sr2.empty ()) {
BOOST_CHECK ( sr.ends_with ( sr2 ));
BOOST_TEST ( sr.ends_with ( sr2 ));
sr2.remove_prefix (1);
}
sr2 = arg;
while ( !sr2.empty ()) {
BOOST_CHECK ( sr.ends_with ( sr2 ));
BOOST_TEST ( sr.ends_with ( sr2 ));
sr2.remove_prefix (1);
}
char ch = sz == 0 ? '\0' : arg [ sz - 1 ];
sr2 = arg;
if ( sz > 0 )
BOOST_CHECK ( sr2.ends_with ( ch ));
BOOST_CHECK ( !sr2.ends_with ( ++ch ));
BOOST_CHECK ( sr2.ends_with ( string_view()));
BOOST_TEST ( sr2.ends_with ( ch ));
BOOST_TEST ( !sr2.ends_with ( ++ch ));
BOOST_TEST ( sr2.ends_with ( string_view()));
}
void starts_with ( const char *arg ) {
@ -58,21 +57,21 @@ void starts_with ( const char *arg ) {
const char *p = arg + std::strlen ( arg ) - 1;
while ( p >= arg ) {
std::string foo ( arg, p + 1 );
BOOST_CHECK ( sr.starts_with ( foo ));
BOOST_TEST ( sr.starts_with ( foo ));
--p;
}
while ( !sr2.empty ()) {
BOOST_CHECK ( sr.starts_with ( sr2 ));
BOOST_TEST ( sr.starts_with ( sr2 ));
sr2.remove_suffix (1);
}
char ch = *arg;
sr2 = arg;
if ( sz > 0 )
BOOST_CHECK ( sr2.starts_with ( ch ));
BOOST_CHECK ( !sr2.starts_with ( ++ch ));
BOOST_CHECK ( sr2.starts_with ( string_view ()));
BOOST_TEST ( sr2.starts_with ( ch ));
BOOST_TEST ( !sr2.starts_with ( ++ch ));
BOOST_TEST ( sr2.starts_with ( string_view ()));
}
void reverse ( const char *arg ) {
@ -82,14 +81,14 @@ void reverse ( const char *arg ) {
string_view sr2 ( string1 );
std::string string2 ( sr2.rbegin (), sr2.rend ());
BOOST_CHECK ( std::equal ( sr2.rbegin (), sr2.rend (), arg ));
BOOST_CHECK ( string2 == arg );
BOOST_CHECK ( std::equal ( sr1.begin (), sr1.end (), string2.begin ()));
BOOST_TEST ( std::equal ( sr2.rbegin (), sr2.rend (), arg ));
BOOST_TEST ( string2 == arg );
BOOST_TEST ( std::equal ( sr1.begin (), sr1.end (), string2.begin ()));
}
// This helper function eliminates signed vs. unsigned warnings
string_view::size_type ptr_diff ( const char *res, const char *base ) {
BOOST_CHECK ( res >= base );
BOOST_TEST ( res >= base );
return static_cast<string_view::size_type> ( res - base );
}
@ -98,12 +97,16 @@ void find ( const char *arg ) {
string_view sr2;
const char *p;
// When we search for the empty string, we find it at position 0
BOOST_TEST ( sr1.find (sr2) == 0 );
BOOST_TEST ( sr1.rfind(sr2) == 0 );
// Look for each character in the string(searching from the start)
p = arg;
sr1 = arg;
while ( *p ) {
string_view::size_type pos = sr1.find(*p);
BOOST_CHECK ( pos != string_view::npos && ( pos <= ptr_diff ( p, arg )));
BOOST_TEST ( pos != string_view::npos && ( pos <= ptr_diff ( p, arg )));
++p;
}
@ -112,7 +115,7 @@ void find ( const char *arg ) {
sr1 = arg;
while ( *p ) {
string_view::size_type pos = sr1.rfind(*p);
BOOST_CHECK ( pos != string_view::npos && pos < sr1.size () && ( pos >= ptr_diff ( p, arg )));
BOOST_TEST ( pos != string_view::npos && pos < sr1.size () && ( pos >= ptr_diff ( p, arg )));
++p;
}
@ -122,7 +125,7 @@ void find ( const char *arg ) {
while ( *p && *(p+1)) {
string_view sr3 ( p, 2 );
string_view::size_type pos = sr1.find ( sr3 );
BOOST_CHECK ( pos != string_view::npos && pos <= static_cast<string_view::size_type>( p - arg ));
BOOST_TEST ( pos != string_view::npos && pos <= static_cast<string_view::size_type>( p - arg ));
p++;
}
@ -133,9 +136,9 @@ void find ( const char *arg ) {
for ( int ch = 1; ch < 256; ++ch ) {
string_view::size_type pos = sr1.find(ch);
const char *strp = std::strchr ( arg, ch );
BOOST_CHECK (( strp == NULL ) == ( pos == string_view::npos ));
BOOST_TEST (( strp == NULL ) == ( pos == string_view::npos ));
if ( strp != NULL )
BOOST_CHECK ( ptr_diff ( strp, arg ) == pos );
BOOST_TEST ( ptr_diff ( strp, arg ) == pos );
}
sr1 = arg;
@ -145,9 +148,9 @@ void find ( const char *arg ) {
for ( int ch = 1; ch < 256; ++ch ) {
string_view::size_type pos = sr1.rfind(ch);
const char *strp = std::strrchr ( arg, ch );
BOOST_CHECK (( strp == NULL ) == ( pos == string_view::npos ));
BOOST_TEST (( strp == NULL ) == ( pos == string_view::npos ));
if ( strp != NULL )
BOOST_CHECK ( ptr_diff ( strp, arg ) == pos );
BOOST_TEST ( ptr_diff ( strp, arg ) == pos );
}
@ -156,7 +159,7 @@ void find ( const char *arg ) {
sr1 = arg;
while ( !sr1.empty ()) {
string_view::size_type pos = sr1.find(*p);
BOOST_CHECK ( pos == 0 );
BOOST_TEST ( pos == 0 );
sr1.remove_prefix (1);
++p;
}
@ -166,7 +169,7 @@ void find ( const char *arg ) {
p = arg + std::strlen ( arg ) - 1;
while ( !sr1.empty ()) {
string_view::size_type pos = sr1.rfind(*p);
BOOST_CHECK ( pos == sr1.size () - 1 );
BOOST_TEST ( pos == sr1.size () - 1 );
sr1.remove_suffix (1);
--p;
}
@ -176,7 +179,7 @@ void find ( const char *arg ) {
p = arg;
while ( !sr1.empty ()) {
string_view::size_type pos = sr1.find_first_of(*p);
BOOST_CHECK ( pos == 0 );
BOOST_TEST ( pos == 0 );
sr1.remove_prefix (1);
++p;
}
@ -187,7 +190,7 @@ void find ( const char *arg ) {
p = arg + std::strlen ( arg ) - 1;
while ( !sr1.empty ()) {
string_view::size_type pos = sr1.find_last_of(*p);
BOOST_CHECK ( pos == sr1.size () - 1 );
BOOST_TEST ( pos == sr1.size () - 1 );
sr1.remove_suffix (1);
--p;
}
@ -196,8 +199,8 @@ void find ( const char *arg ) {
sr1 = arg;
sr2 = arg;
while ( !sr1.empty() ) {
BOOST_CHECK ( sr1.find_first_of ( sr2 ) == 0 );
BOOST_CHECK ( sr1.find_first_not_of ( sr2 ) == string_view::npos );
BOOST_TEST ( sr1.find_first_of ( sr2 ) == 0 );
BOOST_TEST ( sr1.find_first_not_of ( sr2 ) == string_view::npos );
sr1.remove_prefix ( 1 );
}
@ -206,14 +209,14 @@ void find ( const char *arg ) {
while ( *p ) {
string_view::size_type pos1 = sr1.find_first_of(*p);
string_view::size_type pos2 = sr1.find_first_not_of(*p);
BOOST_CHECK ( pos1 != string_view::npos && pos1 < sr1.size () && pos1 <= ptr_diff ( p, arg ));
BOOST_TEST ( pos1 != string_view::npos && pos1 < sr1.size () && pos1 <= ptr_diff ( p, arg ));
if ( pos2 != string_view::npos ) {
for ( size_t i = 0 ; i < pos2; ++i )
BOOST_CHECK ( sr1[i] == *p );
BOOST_CHECK ( sr1 [ pos2 ] != *p );
BOOST_TEST ( sr1[i] == *p );
BOOST_TEST ( sr1 [ pos2 ] != *p );
}
BOOST_CHECK ( pos2 != pos1 );
BOOST_TEST ( pos2 != pos1 );
++p;
}
@ -221,8 +224,8 @@ void find ( const char *arg ) {
sr1 = arg;
sr2 = arg;
while ( !sr1.empty() ) {
BOOST_CHECK ( sr1.find_last_of ( sr2 ) == ( sr1.size () - 1 ));
BOOST_CHECK ( sr1.find_last_not_of ( sr2 ) == string_view::npos );
BOOST_TEST ( sr1.find_last_of ( sr2 ) == ( sr1.size () - 1 ));
BOOST_TEST ( sr1.find_last_not_of ( sr2 ) == string_view::npos );
sr1.remove_suffix ( 1 );
}
@ -231,15 +234,15 @@ void find ( const char *arg ) {
while ( *p ) {
string_view::size_type pos1 = sr1.find_last_of(*p);
string_view::size_type pos2 = sr1.find_last_not_of(*p);
BOOST_CHECK ( pos1 != string_view::npos && pos1 < sr1.size () && pos1 >= ptr_diff ( p, arg ));
BOOST_CHECK ( pos2 == string_view::npos || pos1 < sr1.size ());
BOOST_TEST ( pos1 != string_view::npos && pos1 < sr1.size () && pos1 >= ptr_diff ( p, arg ));
BOOST_TEST ( pos2 == string_view::npos || pos1 < sr1.size ());
if ( pos2 != string_view::npos ) {
for ( size_t i = sr1.size () -1 ; i > pos2; --i )
BOOST_CHECK ( sr1[i] == *p );
BOOST_CHECK ( sr1 [ pos2 ] != *p );
BOOST_TEST ( sr1[i] == *p );
BOOST_TEST ( sr1 [ pos2 ] != *p );
}
BOOST_CHECK ( pos2 != pos1 );
BOOST_TEST ( pos2 != pos1 );
++p;
}
@ -335,14 +338,14 @@ void to_string ( const char *arg ) {
sr1 = arg;
// str2 = sr1.to_string<std::allocator<char> > ();
str2 = sr1.to_string ();
BOOST_CHECK ( str1 == str2 );
BOOST_TEST ( str1 == str2 );
std::basic_string<char, std::char_traits<char>, custom_allocator<char> > str3 = sr1.to_string(custom_allocator<char>());
BOOST_CHECK ( std::strcmp(str1.c_str(), str3.c_str()) == 0 );
BOOST_TEST ( std::strcmp(str1.c_str(), str3.c_str()) == 0 );
#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
std::string str4 = static_cast<std::string> ( sr1 );
BOOST_CHECK ( str1 == str4 );
BOOST_TEST ( str1 == str4 );
#endif
}
@ -353,28 +356,28 @@ void compare ( const char *arg ) {
str1.assign ( arg );
sr1 = arg;
BOOST_CHECK ( sr1 == sr1); // compare string_view and string_view
BOOST_CHECK ( sr1 == str1); // compare string and string_view
BOOST_CHECK ( str1 == sr1 ); // compare string_view and string
BOOST_CHECK ( sr1 == arg ); // compare string_view and pointer
BOOST_CHECK ( arg == sr1 ); // compare pointer and string_view
BOOST_TEST ( sr1 == sr1); // compare string_view and string_view
BOOST_TEST ( sr1 == str1); // compare string and string_view
BOOST_TEST ( str1 == sr1 ); // compare string_view and string
BOOST_TEST ( sr1 == arg ); // compare string_view and pointer
BOOST_TEST ( arg == sr1 ); // compare pointer and string_view
if ( sr1.size () > 0 ) {
(*str1.rbegin())++;
BOOST_CHECK ( sr1 != str1 );
BOOST_CHECK ( str1 != sr1 );
BOOST_CHECK ( sr1 < str1 );
BOOST_CHECK ( sr1 <= str1 );
BOOST_CHECK ( str1 > sr1 );
BOOST_CHECK ( str1 >= sr1 );
BOOST_TEST ( sr1 != str1 );
BOOST_TEST ( str1 != sr1 );
BOOST_TEST ( sr1 < str1 );
BOOST_TEST ( sr1 <= str1 );
BOOST_TEST ( str1 > sr1 );
BOOST_TEST ( str1 >= sr1 );
(*str1.rbegin()) -= 2;
BOOST_CHECK ( sr1 != str1 );
BOOST_CHECK ( str1 != sr1 );
BOOST_CHECK ( sr1 > str1 );
BOOST_CHECK ( sr1 >= str1 );
BOOST_CHECK ( str1 < sr1 );
BOOST_CHECK ( str1 <= sr1 );
BOOST_TEST ( sr1 != str1 );
BOOST_TEST ( str1 != sr1 );
BOOST_TEST ( sr1 > str1 );
BOOST_TEST ( sr1 >= str1 );
BOOST_TEST ( str1 < sr1 );
BOOST_TEST ( str1 <= sr1 );
}
}
@ -388,7 +391,7 @@ const char *test_strings [] = {
NULL
};
BOOST_AUTO_TEST_CASE( test_main )
int main()
{
const char **p = &test_strings[0];
@ -402,4 +405,6 @@ BOOST_AUTO_TEST_CASE( test_main )
p++;
}
return boost::report_errors();
}

View File

@ -12,8 +12,6 @@
* \brief This header contains tests for stream operations of \c basic_string_ref.
*/
#define BOOST_TEST_MODULE string_ref_test_io
#include <boost/utility/string_view.hpp>
#include <iomanip>
@ -23,23 +21,10 @@
#include <string>
#include <boost/config.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/core/lightweight_test.hpp>
typedef boost::mpl::vector<
char
#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_STD_WSTREAMBUF) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
, wchar_t
#endif
/* Current implementations seem to be missing codecvt facets to convert chars to char16_t and char32_t even though the types are available.
#if !defined(BOOST_NO_CXX11_CHAR16_T)
, char16_t
#endif
#if !defined(BOOST_NO_CXX11_CHAR32_T)
, char32_t
#endif
*/
>::type char_types;
static const char* test_strings[] =
{
@ -72,7 +57,8 @@ struct context
};
// Test regular output
BOOST_AUTO_TEST_CASE_TEMPLATE(string_view_output, CharT, char_types)
template<class CharT>
void test_string_view_output()
{
typedef CharT char_type;
typedef std::basic_ostringstream< char_type > ostream_type;
@ -82,11 +68,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(string_view_output, CharT, char_types)
ostream_type strm;
strm << string_view_type(ctx.abcd);
BOOST_CHECK(strm.str() == ctx.abcd);
BOOST_TEST(strm.str() == ctx.abcd);
}
// Test support for padding
BOOST_AUTO_TEST_CASE_TEMPLATE(padding, CharT, char_types)
template<class CharT>
void test_padding()
{
typedef CharT char_type;
typedef std::basic_ostringstream< char_type > ostream_type;
@ -102,7 +89,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(padding, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::setw(8) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
// Test for long padding
@ -113,7 +100,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(padding, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::setw(100) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
// Test that short width does not truncate the string
@ -124,12 +111,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(padding, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::setw(1) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
}
// Test support for padding fill
BOOST_AUTO_TEST_CASE_TEMPLATE(padding_fill, CharT, char_types)
template<class CharT>
void test_padding_fill()
{
typedef CharT char_type;
typedef std::basic_ostringstream< char_type > ostream_type;
@ -143,11 +131,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(padding_fill, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::setfill(static_cast< char_type >('x')) << std::setw(8) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
// Test support for alignment
BOOST_AUTO_TEST_CASE_TEMPLATE(alignment, CharT, char_types)
template<class CharT>
void test_alignment()
{
typedef CharT char_type;
typedef std::basic_ostringstream< char_type > ostream_type;
@ -163,7 +152,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(alignment, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::left << std::setw(8) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
// Right alignment
@ -174,6 +163,22 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(alignment, CharT, char_types)
ostream_type strm_correct;
strm_correct << ctx.begin << std::right << std::setw(8) << ctx.abcd << ctx.end;
BOOST_CHECK(strm_ref.str() == strm_correct.str());
BOOST_TEST(strm_ref.str() == strm_correct.str());
}
}
template<class CharT>
void test()
{
test_string_view_output<CharT>();
test_padding<CharT>();
test_padding_fill<CharT>();
test_alignment<CharT>();
}
int main()
{
test<char>();
test<wchar_t>();
return boost::report_errors();
}

View File

@ -16,13 +16,12 @@
#include <string>
#include "boost/utility/value_init.hpp"
#include <boost/shared_ptr.hpp>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include <boost/detail/lightweight_test.hpp>
#include <boost/core/lightweight_test.hpp>
//
// Sample POD type
@ -270,9 +269,12 @@ bool test ( T const& y, T const& z )
boost::value_initialized<T> copy2;
copy2 = x;
BOOST_TEST ( boost::get(copy2) == boost::get(x) ) ;
boost::shared_ptr<boost::value_initialized<T> > ptr( new boost::value_initialized<T> );
BOOST_TEST ( y == *ptr ) ;
{
boost::value_initialized<T> * ptr = new boost::value_initialized<T>;
BOOST_TEST ( y == *ptr ) ;
delete ptr;
}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
boost::value_initialized<T const> cx ;
@ -287,7 +289,7 @@ bool test ( T const& y, T const& z )
return boost::detail::test_errors() == errors_before_test ;
}
int main(int, char **)
int main()
{
BOOST_TEST ( test( 0,1234 ) ) ;
BOOST_TEST ( test( 0.0,12.34 ) ) ;

View File

@ -17,9 +17,7 @@
#pragma hdrstop
#endif
#include "boost/test/minimal.hpp"
int test_main(int, char **)
int main()
{
boost::value_initialized<int> const x_c ;
@ -27,11 +25,3 @@ int test_main(int, char **)
return 0;
}
unsigned int expected_failures = 0;

View File

@ -17,9 +17,7 @@
#pragma hdrstop
#endif
#include "boost/test/minimal.hpp"
int test_main(int, char **)
int main()
{
boost::value_initialized<int const> cx ;
@ -27,10 +25,3 @@ int test_main(int, char **)
return 0;
}
unsigned int expected_failures = 0;

View File

@ -17,9 +17,7 @@
#pragma hdrstop
#endif
#include "boost/test/minimal.hpp"
int test_main(int, char **)
int main()
{
boost::value_initialized<int const> const cx_c ;
@ -27,11 +25,3 @@ int test_main(int, char **)
return 0;
}
unsigned int expected_failures = 0;