Compare commits

..

41 Commits

Author SHA1 Message Date
Peter Dimov
37168a3f4b Use address-model=32 for msvc-9.0, 10.0, 11.0 2020-10-12 00:01:10 +03:00
Glen Fernandes
e56171989a Merge pull request #69 from giomasce-throwaway/develop
Fix copyright headers.
2020-10-11 11:48:14 -04:00
Giovanni Mascellani
f00a5bf0d3 Fix copyright headers. 2020-10-11 17:35:14 +02:00
Andrey Semashev
a4feaf4f24 Merge pull request #66 from boostorg/feature/value-init
Add a new value_init test, change implementation to not depend on TypeTraits
2020-05-27 12:51:45 +03:00
Peter Dimov
688628f764 Add test/value_init_test3 2020-05-26 00:39:51 +03:00
Peter Dimov
8faf831bd1 memset data_ instead of *this 2020-05-25 23:50:35 +03:00
Peter Dimov
25cb7aa122 Use a base class to apply the memset workaround to avoid dependency on TypeTraits 2020-05-25 05:09:36 +03:00
Peter Dimov
0ae5cebc7f Add value_init_test2.cpp, which tests the cases from value_init_workaround_test 2020-05-25 04:44:29 +03:00
Andrey Semashev
1caa002121 Added gcc 10 build jobs to Travis CI. 2020-05-22 18:46:41 +03:00
Andrey Semashev
691f3238d7 Use 20 instead of 2a to refer to C++20 in Travis CI. 2020-05-05 23:12:01 +03:00
Andrey Semashev
8b6da499a3 Added clang-10 jobs to Travis CI. 2020-05-05 23:02:58 +03:00
Glen Fernandes
6e6d0777e8 Merge pull request #64 from glenfe/develop
Update to Operators constexpr support
2020-04-12 13:33:17 -04:00
Glen Fernandes
64fffa0f97 Simplify BOOST_OPERATORS_CONSTEXPR definition 2020-04-12 13:03:30 -04:00
Glen Fernandes
5da340a2a4 Rename BOOST_OPS_CONSTEXPR to BOOST_OPERATORS_CONSTEXPR 2020-04-12 13:03:22 -04:00
Glen Fernandes
9a4cff038b Move constexpr operators test to separate test 2020-04-12 13:03:18 -04:00
Marshall Clow
0c059a50ad Merge pull request #63 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74. Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost conf…
2020-04-12 09:49:06 -07:00
Daniel Frey
bdc5b5cf3a Merge pull request #55 from tonyelewis/add-constexpr-support
Add constexpr to operators (w/ basic docs, tests)
2020-04-12 13:07:24 +02:00
Glen Fernandes
86e7caefea Update CMakeLists.txt 2020-04-11 14:14:33 -04:00
Tony Lewis
7953ba56ba Update tests to run constexpr on newer MSVCs 2020-04-11 18:39:15 +01:00
Tony Lewis
46f72656b3 Remove constexpr from all but the comparison ops 2020-04-11 18:31:15 +01:00
Tony Lewis
e3a2a06011 Re-add constexpr support for newer MSVC versions 2020-04-11 18:30:24 +01:00
Edward Diener
a4752e066d Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-24 01:39:51 -04:00
Glen Fernandes
957aeba2e9 Update Travis and Appveyor configurations 2019-12-15 10:39:10 -05:00
Glen Fernandes
2b436d7d50 Use ostream_put from Boost.IO 2019-12-15 09:46:38 -05:00
Peter Dimov
882c9c86c4 More detabification 2019-12-12 06:00:51 +02:00
Peter Dimov
c81d8e3990 Add <cstdio> for EOF; detabify, remove trailing whitespace 2019-12-12 05:57:51 +02:00
Andrey Semashev
75276a055d Disabled all but one OS X jobs because they are slow on Travis CI. 2019-10-22 15:11:41 +03:00
Andrey Semashev
309e6a1b31 Updated CI configs, added compilers. 2019-10-22 00:52:54 +03:00
Andrey Semashev
9eeb7f85c5 Replaced tabs with spaces. 2019-06-25 15:46:36 +03:00
Daniel Frey
62c34f51f6 Avoid confusion with the spaceship operator, fixes #59 2019-04-30 18:29:28 +02:00
Glen Fernandes
6a1917ceec Add Free Functions section heading 2019-04-29 20:12:30 -04:00
Glen Fernandes
47c9f69ffe Correct documentation URLs and update documentation 2019-04-29 18:48:51 -04:00
Glen Fernandes
7b74d2d494 Update libraries.json and documentation 2019-04-23 15:37:57 -04:00
Marshall Clow
57da5f0c18 Merge pull request #58 from boostorg/ostream_write
Refactor stream write functionality into a standalone utility
2019-04-23 03:56:04 -07:00
Glen Fernandes
dabf53a703 Refactor stream write functionality into a standalone utility 2019-04-19 09:53:29 -04:00
Marshall Clow
ff56b3649e Merge pull request #57 from glenfe/develop
Make string_view operator<< use rdbuf directly
2019-04-18 09:00:53 -07:00
Peter Dimov
31e0ae4c37 Switch Appveyor to 2015 image 2019-04-14 18:13:56 +03:00
Glen Fernandes
5fe9df91c0 Make string_view operator<< use rdbuf directly 2019-04-12 18:06:35 -04:00
Tony Lewis
6b62dcc504 Completely remove constexpr for MSVC 2018-12-24 07:02:31 +00:00
Tony Lewis
91ebdcd1dd Remove C++14 constexpr due to MSVC/GCC problems 2018-12-22 15:52:13 +00:00
Tony Lewis
e8d2b2ba76 Add constexpr to operators (w/ basic docs, tests) 2018-12-21 10:28:22 +00:00
25 changed files with 744 additions and 317 deletions

View File

@@ -1,4 +1,5 @@
# Copyright 2016, 2017 Peter Dimov # Copyright 2016, 2017 Peter Dimov
# Copyright 2019 Andrey Semashev
# Distributed under the Boost Software License, Version 1.0. # Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
@@ -24,12 +25,32 @@ matrix:
- env: BOGUS_JOB=true - env: BOGUS_JOB=true
include: include:
# gcc, Linux
- os: linux - os: linux
compiler: g++ dist: trusty
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11 compiler: gcc-4.4
env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
addons:
apt:
packages:
- g++-4.4
sources:
- ubuntu-toolchain-r-test
- os: linux - os: linux
compiler: g++-4.7 dist: trusty
compiler: gcc-4.6
env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
addons:
apt:
packages:
- g++-4.6
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: gcc-4.7
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11 env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
addons: addons:
apt: apt:
@@ -39,7 +60,8 @@ matrix:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- os: linux - os: linux
compiler: g++-4.8 dist: xenial
compiler: gcc-4.8
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11 env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
addons: addons:
apt: apt:
@@ -47,8 +69,10 @@ matrix:
- g++-4.8 - g++-4.8
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- os: linux - os: linux
compiler: g++-4.9 dist: xenial
compiler: gcc-4.9
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11 env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
addons: addons:
apt: apt:
@@ -58,7 +82,8 @@ matrix:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- os: linux - os: linux
compiler: g++-5 dist: xenial
compiler: gcc-5
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
addons: addons:
apt: apt:
@@ -68,7 +93,8 @@ matrix:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- os: linux - os: linux
compiler: g++-6 dist: xenial
compiler: gcc-6
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
addons: addons:
apt: apt:
@@ -78,8 +104,8 @@ matrix:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- os: linux - os: linux
dist: trusty dist: xenial
compiler: g++-7 compiler: gcc-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
addons: addons:
apt: apt:
@@ -89,9 +115,9 @@ matrix:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- os: linux - os: linux
dist: trusty dist: xenial
compiler: g++-8 compiler: gcc-8
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17 env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17,2a
addons: addons:
apt: apt:
packages: packages:
@@ -100,22 +126,45 @@ matrix:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- os: linux - os: linux
compiler: clang++ dist: bionic
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11 compiler: gcc-9
env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- g++-9
sources:
- sourceline: "ppa:ubuntu-toolchain-r/test"
- os: linux - os: linux
compiler: clang++-3.5 dist: bionic
compiler: gcc-10
env: TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14,17,20
addons:
apt:
packages:
- g++-10
sources:
- sourceline: "ppa:ubuntu-toolchain-r/test"
# clang, Linux
- os: linux
dist: trusty
compiler: clang-3.5
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11 env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11
addons: addons:
apt: apt:
packages: packages:
- clang-3.5 - clang-3.5
- libstdc++-4.9-dev
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5 - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.5 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux - os: linux
compiler: clang++-3.6 dist: trusty
compiler: clang-3.6
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
addons: addons:
apt: apt:
@@ -124,10 +173,12 @@ matrix:
- libstdc++-5-dev - libstdc++-5-dev
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6 - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.6 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux - os: linux
compiler: clang++-3.7 dist: trusty
compiler: clang-3.7
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
addons: addons:
apt: apt:
@@ -136,83 +187,163 @@ matrix:
- libstdc++-5-dev - libstdc++-5-dev
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7 - sourceline: "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.7 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux - os: linux
compiler: clang++-3.8 dist: xenial
compiler: clang-3.8
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
addons: addons:
apt: apt:
packages: packages:
- clang-3.8 - clang-3.8
- libstdc++-5-dev - libstdc++-6-dev
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8 - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.8 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux - os: linux
compiler: clang++-3.9 dist: xenial
compiler: clang-3.9
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
addons: addons:
apt: apt:
packages: packages:
- clang-3.9 - clang-3.9
- libstdc++-5-dev - libstdc++-6-dev
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9 - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux - os: linux
compiler: clang++-4.0 dist: xenial
compiler: clang-4
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
addons: addons:
apt: apt:
packages: packages:
- clang-4.0 - clang-4.0
- libstdc++-5-dev - libstdc++-6-dev
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0 - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux - os: linux
compiler: clang++-5.0 dist: xenial
compiler: clang-5
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
addons: addons:
apt: apt:
packages: packages:
- clang-5.0 - clang-5.0
- libstdc++-5-dev - libstdc++-7-dev
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0 - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux - os: linux
compiler: clang++-6.0 dist: xenial
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17 compiler: clang-6
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17,2a
addons: addons:
apt: apt:
packages: packages:
- clang-6.0 - clang-6.0
- libstdc++-5-dev - libstdc++-8-dev
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0 - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux - os: linux
compiler: clang++-7 dist: xenial
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17 compiler: clang-7
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a
addons: addons:
apt: apt:
packages: packages:
- clang-7 - clang-7
- libstdc++-5-dev - libstdc++-8-dev
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-trusty-7 - sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux
dist: xenial
compiler: clang-8
env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- clang-8
- libstdc++-8-dev
sources:
- ubuntu-toolchain-r-test
- sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux
dist: xenial
compiler: clang-9
env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- clang-9
- libstdc++-9-dev
sources:
- sourceline: "ppa:ubuntu-toolchain-r/test"
- sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux
dist: xenial
compiler: clang-10
env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20
addons:
apt:
packages:
- clang-10
- libstdc++-9-dev
sources:
- sourceline: "ppa:ubuntu-toolchain-r/test"
- sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
- os: linux
dist: xenial
compiler: clang-libc++
env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,20 CXXFLAGS="-stdlib=libc++" LINKFLAGS="-stdlib=libc++"
addons:
apt:
packages:
- clang-10
- libc++-10-dev
- libc++abi-10-dev
sources:
- sourceline: "ppa:ubuntu-toolchain-r/test"
- sourceline: "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main"
key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key"
# clang, OS X
# OS X builds are slow on Travis CI
# - os: osx
# env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
# osx_image: xcode9.4
#
# - os: osx
# env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
# osx_image: xcode10.3
- os: osx - os: osx
compiler: clang++ env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,17
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z osx_image: xcode11.2
install: install:
- GIT_FETCH_JOBS=8 - GIT_FETCH_JOBS=8
@@ -227,6 +358,7 @@ install:
- git submodule init libs/assert - git submodule init libs/assert
- git submodule init libs/config - git submodule init libs/config
- git submodule init libs/core - git submodule init libs/core
- git submodule init libs/io
- git submodule init libs/preprocessor - git submodule init libs/preprocessor
- git submodule init libs/static_assert - git submodule init libs/static_assert
- git submodule init libs/throw_exception - git submodule init libs/throw_exception
@@ -243,7 +375,7 @@ script:
- |- - |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- BUILD_JOBS=`(nproc || sysctl -n hw.ncpu) 2> /dev/null` - BUILD_JOBS=`(nproc || sysctl -n hw.ncpu) 2> /dev/null`
- ./b2 -j $BUILD_JOBS libs/utility/test toolset=$TOOLSET cxxstd=$CXXSTD - ./b2 -j $BUILD_JOBS libs/utility/test toolset=$TOOLSET cxxstd=$CXXSTD ${CXXFLAGS:+cxxflags="$CXXFLAGS"} ${LINKFLAGS:+linkflags="$LINKFLAGS"}
notifications: notifications:
email: email:

View File

@@ -20,6 +20,7 @@ target_link_libraries(boost_utility
Boost::config Boost::config
Boost::container_hash Boost::container_hash
Boost::core Boost::core
Boost::io
Boost::preprocessor Boost::preprocessor
Boost::static_assert Boost::static_assert
Boost::throw_exception Boost::throw_exception

View File

@@ -1,4 +1,5 @@
# Copyright 2016, 2017 Peter Dimov # Copyright 2016-2019 Peter Dimov
# Copyright 2019 Andrey Semashev
# Distributed under the Boost Software License, Version 1.0. # Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
@@ -14,13 +15,44 @@ branches:
environment: environment:
matrix: matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0 ADDRMD: 32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-14.0 - TOOLSET: msvc-12.0,msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 ADDRMD: 32,64
TOOLSET: msvc-14.1 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: msvc-14.1
CXXSTD: 14,17 CXXSTD: 14,17
ADDRMD: 32,64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- TOOLSET: msvc-14.2
ADDRMD: 32,64
CXXSTD: 14,17
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- TOOLSET: clang-win
ADDRMD: 32,64
CXXSTD: 14,17
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
ADDPATH: C:\cygwin\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
ADDPATH: C:\cygwin64\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
ADDPATH: C:\mingw\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- TOOLSET: gcc
CXXSTD: 03,11,14,1z
ADDPATH: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
install: install:
- set GIT_FETCH_JOBS=8 - set GIT_FETCH_JOBS=8
@@ -35,6 +67,7 @@ install:
- git submodule init libs/assert - git submodule init libs/assert
- git submodule init libs/config - git submodule init libs/config
- git submodule init libs/core - git submodule init libs/core
- git submodule init libs/io
- git submodule init libs/preprocessor - git submodule init libs/preprocessor
- git submodule init libs/static_assert - git submodule init libs/static_assert
- git submodule init libs/throw_exception - git submodule init libs/throw_exception
@@ -43,7 +76,7 @@ install:
- git submodule init libs/integer - git submodule init libs/integer
- git submodule init libs/detail - git submodule init libs/detail
- git submodule update --jobs %GIT_FETCH_JOBS% - git submodule update --jobs %GIT_FETCH_JOBS%
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\utility - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\utility\
- cmd /c bootstrap - cmd /c bootstrap
- b2 -d0 headers - b2 -d0 headers
@@ -52,4 +85,5 @@ build: off
test_script: test_script:
- PATH=%ADDPATH%%PATH% - PATH=%ADDPATH%%PATH%
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD% - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
- b2 -j %NUMBER_OF_PROCESSORS% libs/utility/test toolset=%TOOLSET% %CXXSTD% - if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
- b2 -j %NUMBER_OF_PROCESSORS% libs/utility/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release

View File

@@ -1,6 +1,6 @@
[/ [/
/ Copyright (c) 2008 Howard Hinnant / Copyright (c) 2008 Howard Hinnant
/ Copyright (c) 2009-20012 Vicente J. Botet Escriba / Copyright (c) 2009-2012 Vicente J. Botet Escriba
/ /
/ Distributed under the Boost Software License, Version 1.0. (See accompanying / 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) / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -156,6 +156,11 @@ String-like operations:
[section History] [section History]
[/===============] [/===============]
[heading boost 1.71]
* Glen Fernandes updated the implementation of the stream insertion operator to
write directly to the `basic_streambuf` and refactored that functionality into
a common utility.
[heading boost 1.53] [heading boost 1.53]
* Introduced * Introduced

View File

@@ -100,7 +100,7 @@ struct call_traits<T&>
typedef T& param_type; // hh removed const typedef T& param_type; // hh removed const
}; };
#if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 ) #if BOOST_WORKAROUND( BOOST_BORLANDC, < 0x5A0 )
// these are illegal specialisations; cv-qualifies applied to // these are illegal specialisations; cv-qualifies applied to
// references have no effect according to [8.3.2p1], // references have no effect according to [8.3.2p1],
// C++ Builder requires them though as it treats cv-qualified // C++ Builder requires them though as it treats cv-qualified

View File

@@ -109,6 +109,13 @@
# pragma warning( disable : 4284 ) // complaint about return type of # pragma warning( disable : 4284 ) // complaint about return type of
#endif // operator-> not begin a UDT #endif // operator-> not begin a UDT
// Define BOOST_OPERATORS_CONSTEXPR to be like BOOST_CONSTEXPR but empty under MSVC < v19.22
#if BOOST_WORKAROUND(BOOST_MSVC, < 1922)
#define BOOST_OPERATORS_CONSTEXPR
#else
#define BOOST_OPERATORS_CONSTEXPR BOOST_CONSTEXPR
#endif
// In this section we supply the xxxx1 and xxxx2 forms of the operator // In this section we supply the xxxx1 and xxxx2 forms of the operator
// templates, which are explicitly targeted at the 1-type-argument and // templates, which are explicitly targeted at the 1-type-argument and
// 2-type-argument operator forms, respectively. // 2-type-argument operator forms, respectively.
@@ -132,34 +139,34 @@ template <typename T> class empty_base {};
template <class T, class U, class B = operators_detail::empty_base<T> > template <class T, class U, class B = operators_detail::empty_base<T> >
struct less_than_comparable2 : B struct less_than_comparable2 : B
{ {
friend bool operator<=(const T& x, const U& y) { return !static_cast<bool>(x > y); } friend BOOST_OPERATORS_CONSTEXPR bool operator<=(const T& x, const U& y) { return !static_cast<bool>(x > y); }
friend bool operator>=(const T& x, const U& y) { return !static_cast<bool>(x < y); } friend BOOST_OPERATORS_CONSTEXPR bool operator>=(const T& x, const U& y) { return !static_cast<bool>(x < y); }
friend bool operator>(const U& x, const T& y) { return y < x; } friend BOOST_OPERATORS_CONSTEXPR bool operator>(const U& x, const T& y) { return y < x; }
friend bool operator<(const U& x, const T& y) { return y > x; } friend BOOST_OPERATORS_CONSTEXPR bool operator<(const U& x, const T& y) { return y > x; }
friend bool operator<=(const U& x, const T& y) { return !static_cast<bool>(y < x); } friend BOOST_OPERATORS_CONSTEXPR bool operator<=(const U& x, const T& y) { return !static_cast<bool>(y < x); }
friend bool operator>=(const U& x, const T& y) { return !static_cast<bool>(y > x); } friend BOOST_OPERATORS_CONSTEXPR bool operator>=(const U& x, const T& y) { return !static_cast<bool>(y > x); }
}; };
template <class T, class B = operators_detail::empty_base<T> > template <class T, class B = operators_detail::empty_base<T> >
struct less_than_comparable1 : B struct less_than_comparable1 : B
{ {
friend bool operator>(const T& x, const T& y) { return y < x; } friend BOOST_OPERATORS_CONSTEXPR bool operator>(const T& x, const T& y) { return y < x; }
friend bool operator<=(const T& x, const T& y) { return !static_cast<bool>(y < x); } friend BOOST_OPERATORS_CONSTEXPR bool operator<=(const T& x, const T& y) { return !static_cast<bool>(y < x); }
friend bool operator>=(const T& x, const T& y) { return !static_cast<bool>(x < y); } friend BOOST_OPERATORS_CONSTEXPR bool operator>=(const T& x, const T& y) { return !static_cast<bool>(x < y); }
}; };
template <class T, class U, class B = operators_detail::empty_base<T> > template <class T, class U, class B = operators_detail::empty_base<T> >
struct equality_comparable2 : B struct equality_comparable2 : B
{ {
friend bool operator==(const U& y, const T& x) { return x == y; } friend BOOST_OPERATORS_CONSTEXPR bool operator==(const U& y, const T& x) { return x == y; }
friend bool operator!=(const U& y, const T& x) { return !static_cast<bool>(x == y); } friend BOOST_OPERATORS_CONSTEXPR bool operator!=(const U& y, const T& x) { return !static_cast<bool>(x == y); }
friend bool operator!=(const T& y, const U& x) { return !static_cast<bool>(y == x); } friend BOOST_OPERATORS_CONSTEXPR bool operator!=(const T& y, const U& x) { return !static_cast<bool>(y == x); }
}; };
template <class T, class B = operators_detail::empty_base<T> > template <class T, class B = operators_detail::empty_base<T> >
struct equality_comparable1 : B struct equality_comparable1 : B
{ {
friend bool operator!=(const T& x, const T& y) { return !static_cast<bool>(x == y); } friend BOOST_OPERATORS_CONSTEXPR bool operator!=(const T& x, const T& y) { return !static_cast<bool>(x == y); }
}; };
// A macro which produces "name_2left" from "name". // A macro which produces "name_2left" from "name".
@@ -362,7 +369,7 @@ BOOST_BINARY_OPERATOR( right_shiftable, >> )
template <class T, class U, class B = operators_detail::empty_base<T> > template <class T, class U, class B = operators_detail::empty_base<T> >
struct equivalent2 : B struct equivalent2 : B
{ {
friend bool operator==(const T& x, const U& y) friend BOOST_OPERATORS_CONSTEXPR bool operator==(const T& x, const U& y)
{ {
return !static_cast<bool>(x < y) && !static_cast<bool>(x > y); return !static_cast<bool>(x < y) && !static_cast<bool>(x > y);
} }
@@ -371,7 +378,7 @@ struct equivalent2 : B
template <class T, class B = operators_detail::empty_base<T> > template <class T, class B = operators_detail::empty_base<T> >
struct equivalent1 : B struct equivalent1 : B
{ {
friend bool operator==(const T&x, const T&y) friend BOOST_OPERATORS_CONSTEXPR bool operator==(const T&x, const T&y)
{ {
return !static_cast<bool>(x < y) && !static_cast<bool>(y < x); return !static_cast<bool>(x < y) && !static_cast<bool>(y < x);
} }
@@ -380,28 +387,28 @@ struct equivalent1 : B
template <class T, class U, class B = operators_detail::empty_base<T> > template <class T, class U, class B = operators_detail::empty_base<T> >
struct partially_ordered2 : B struct partially_ordered2 : B
{ {
friend bool operator<=(const T& x, const U& y) friend BOOST_OPERATORS_CONSTEXPR bool operator<=(const T& x, const U& y)
{ return static_cast<bool>(x < y) || static_cast<bool>(x == y); } { return static_cast<bool>(x < y) || static_cast<bool>(x == y); }
friend bool operator>=(const T& x, const U& y) friend BOOST_OPERATORS_CONSTEXPR bool operator>=(const T& x, const U& y)
{ return static_cast<bool>(x > y) || static_cast<bool>(x == y); } { return static_cast<bool>(x > y) || static_cast<bool>(x == y); }
friend bool operator>(const U& x, const T& y) friend BOOST_OPERATORS_CONSTEXPR bool operator>(const U& x, const T& y)
{ return y < x; } { return y < x; }
friend bool operator<(const U& x, const T& y) friend BOOST_OPERATORS_CONSTEXPR bool operator<(const U& x, const T& y)
{ return y > x; } { return y > x; }
friend bool operator<=(const U& x, const T& y) friend BOOST_OPERATORS_CONSTEXPR bool operator<=(const U& x, const T& y)
{ return static_cast<bool>(y > x) || static_cast<bool>(y == x); } { return static_cast<bool>(y > x) || static_cast<bool>(y == x); }
friend bool operator>=(const U& x, const T& y) friend BOOST_OPERATORS_CONSTEXPR bool operator>=(const U& x, const T& y)
{ return static_cast<bool>(y < x) || static_cast<bool>(y == x); } { return static_cast<bool>(y < x) || static_cast<bool>(y == x); }
}; };
template <class T, class B = operators_detail::empty_base<T> > template <class T, class B = operators_detail::empty_base<T> >
struct partially_ordered1 : B struct partially_ordered1 : B
{ {
friend bool operator>(const T& x, const T& y) friend BOOST_OPERATORS_CONSTEXPR bool operator>(const T& x, const T& y)
{ return y < x; } { return y < x; }
friend bool operator<=(const T& x, const T& y) friend BOOST_OPERATORS_CONSTEXPR bool operator<=(const T& x, const T& y)
{ return static_cast<bool>(x < y) || static_cast<bool>(x == y); } { return static_cast<bool>(x < y) || static_cast<bool>(x == y); }
friend bool operator>=(const T& x, const T& y) friend BOOST_OPERATORS_CONSTEXPR bool operator>=(const T& x, const T& y)
{ return static_cast<bool>(y < x) || static_cast<bool>(x == y); } { return static_cast<bool>(y < x) || static_cast<bool>(x == y); }
}; };

View File

@@ -22,7 +22,7 @@
# define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T) # define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)
#endif #endif
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) #if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)> struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)>
: conditional< : conditional<
@@ -151,7 +151,7 @@ struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)),
#else // defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) #else // defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK)
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) #if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
struct result_of<F(BOOST_RESULT_OF_ARGS)> struct result_of<F(BOOST_RESULT_OF_ARGS)>
: tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { }; : tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { };
@@ -177,7 +177,7 @@ struct tr1_result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), F
typedef R type; typedef R type;
}; };
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) #if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551))
template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)>
struct tr1_result_of_impl<R (T0::*) struct tr1_result_of_impl<R (T0::*)
(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)), (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)),

View File

@@ -1,5 +1,6 @@
/* /*
Copyright (c) Marshall Clow 2012-2015. Copyright (c) Marshall Clow 2012-2015.
Copyright (c) Glen Joseph Fernandes 2019 (glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -17,6 +18,7 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#include <boost/io/ostream_put.hpp>
#include <boost/utility/string_ref_fwd.hpp> #include <boost/utility/string_ref_fwd.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
@@ -421,52 +423,11 @@ namespace boost {
return basic_string_ref<charT, traits>(x) >= y; return basic_string_ref<charT, traits>(x) >= y;
} }
namespace detail {
template<class charT, class traits>
inline void sr_insert_fill_chars(std::basic_ostream<charT, traits>& os, std::size_t n) {
enum { chunk_size = 8 };
charT fill_chars[chunk_size];
std::fill_n(fill_chars, static_cast< std::size_t >(chunk_size), os.fill());
for (; n >= chunk_size && os.good(); n -= chunk_size)
os.write(fill_chars, static_cast< std::size_t >(chunk_size));
if (n > 0 && os.good())
os.write(fill_chars, n);
}
template<class charT, class traits>
void sr_insert_aligned(std::basic_ostream<charT, traits>& os, const basic_string_ref<charT,traits>& str) {
const std::size_t size = str.size();
const std::size_t alignment_size = static_cast< std::size_t >(os.width()) - size;
const bool align_left = (os.flags() & std::basic_ostream<charT, traits>::adjustfield) == std::basic_ostream<charT, traits>::left;
if (!align_left) {
detail::sr_insert_fill_chars(os, alignment_size);
if (os.good())
os.write(str.data(), size);
}
else {
os.write(str.data(), size);
if (os.good())
detail::sr_insert_fill_chars(os, alignment_size);
}
}
} // namespace detail
// Inserter // Inserter
template<class charT, class traits> template<class charT, class traits>
inline std::basic_ostream<charT, traits>& inline std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, const basic_string_ref<charT,traits>& str) { operator<<(std::basic_ostream<charT, traits>& os, const basic_string_ref<charT,traits>& str) {
if (os.good()) { return boost::io::ostream_put(os, str.data(), str.size());
const std::size_t size = str.size();
const std::size_t w = static_cast< std::size_t >(os.width());
if (w <= size)
os.write(str.data(), size);
else
detail::sr_insert_aligned(os, str);
os.width(0);
}
return os;
} }
#if 0 #if 0

View File

@@ -1,6 +1,7 @@
/* /*
Copyright (c) Marshall Clow 2012-2015. Copyright (c) Marshall Clow 2012-2015.
Copyright (c) Beman Dawes 2015 Copyright (c) Beman Dawes 2015
Copyright (c) Glen Joseph Fernandes 2019 (glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0. (See accompanying 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) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -19,6 +20,7 @@
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#include <boost/io/ostream_put.hpp>
#include <boost/utility/string_view_fwd.hpp> #include <boost/utility/string_view_fwd.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/container_hash/hash_fwd.hpp> #include <boost/container_hash/hash_fwd.hpp>
@@ -184,7 +186,7 @@ namespace boost {
if (pos > size()) if (pos > size())
BOOST_THROW_EXCEPTION(std::out_of_range("string_view::copy" )); BOOST_THROW_EXCEPTION(std::out_of_range("string_view::copy" ));
size_type rlen = (std::min)(n, len_ - pos); size_type rlen = (std::min)(n, len_ - pos);
traits_type::copy(s, data() + pos, rlen); traits_type::copy(s, data() + pos, rlen);
return rlen; return rlen;
} }
@@ -571,53 +573,12 @@ namespace boost {
return basic_string_view<charT, traits>(x) >= y; return basic_string_view<charT, traits>(x) >= y;
} }
namespace detail {
template<class charT, class traits>
inline void sv_insert_fill_chars(std::basic_ostream<charT, traits>& os, std::size_t n) {
enum { chunk_size = 8 };
charT fill_chars[chunk_size];
std::fill_n(fill_chars, static_cast< std::size_t >(chunk_size), os.fill());
for (; n >= chunk_size && os.good(); n -= chunk_size)
os.write(fill_chars, static_cast< std::size_t >(chunk_size));
if (n > 0 && os.good())
os.write(fill_chars, n);
}
template<class charT, class traits>
void sv_insert_aligned(std::basic_ostream<charT, traits>& os, const basic_string_view<charT,traits>& str) {
const std::size_t size = str.size();
const std::size_t alignment_size = static_cast< std::size_t >(os.width()) - size;
const bool align_left = (os.flags() & std::basic_ostream<charT, traits>::adjustfield) == std::basic_ostream<charT, traits>::left;
if (!align_left) {
detail::sv_insert_fill_chars(os, alignment_size);
if (os.good())
os.write(str.data(), size);
}
else {
os.write(str.data(), size);
if (os.good())
detail::sv_insert_fill_chars(os, alignment_size);
}
}
} // namespace detail
// Inserter // Inserter
template<class charT, class traits> template<class charT, class traits>
inline std::basic_ostream<charT, traits>& inline std::basic_ostream<charT, traits>&
operator<<(std::basic_ostream<charT, traits>& os, operator<<(std::basic_ostream<charT, traits>& os,
const basic_string_view<charT,traits>& str) { const basic_string_view<charT,traits>& str) {
if (os.good()) { return boost::io::ostream_put(os, str.data(), str.size());
const std::size_t size = str.size();
const std::size_t w = static_cast< std::size_t >(os.width());
if (w <= size)
os.write(str.data(), size);
else
detail::sv_insert_aligned(os, str);
os.width(0);
}
return os;
} }
#if 0 #if 0

View File

@@ -1,4 +1,5 @@
// (C) Copyright 2002-2008, Fernando Luis Cacciola Carballal. // (C) Copyright 2002-2008, Fernando Luis Cacciola Carballal.
// Copyright 2020 Peter Dimov
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
@@ -21,15 +22,10 @@
// issues, by clearing the bytes of T, before constructing the T object it // issues, by clearing the bytes of T, before constructing the T object it
// contains. More details on these issues are at libs/utility/value_init.htm // contains. More details on these issues are at libs/utility/value_init.htm
#include <boost/aligned_storage.hpp>
#include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION. #include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION.
#include <boost/detail/workaround.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/cv_traits.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/swap.hpp> #include <boost/swap.hpp>
#include <cstring> #include <cstring>
#include <new> #include <cstddef>
#ifdef BOOST_MSVC #ifdef BOOST_MSVC
#pragma warning(push) #pragma warning(push)
@@ -60,92 +56,58 @@
namespace boost { namespace boost {
namespace detail {
struct zero_init
{
zero_init()
{
}
zero_init( void * p, std::size_t n )
{
std::memset( p, 0, n );
}
};
} // namespace detail
template<class T> template<class T>
class initialized class initialized
#if BOOST_DETAIL_VALUE_INIT_WORKAROUND
: detail::zero_init
#endif
{ {
private : private:
struct wrapper
{
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
typename
#endif
remove_const<T>::type data;
BOOST_GPU_ENABLED T data_;
wrapper()
:
data()
{
}
BOOST_GPU_ENABLED
wrapper(T const & arg)
:
data(arg)
{
}
};
mutable
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
typename
#endif
aligned_storage<sizeof(wrapper), alignment_of<wrapper>::value>::type x;
BOOST_GPU_ENABLED
wrapper * wrapper_address() const
{
return static_cast<wrapper *>( static_cast<void*>(&x));
}
public : public :
BOOST_GPU_ENABLED BOOST_GPU_ENABLED
initialized() initialized():
{
#if BOOST_DETAIL_VALUE_INIT_WORKAROUND #if BOOST_DETAIL_VALUE_INIT_WORKAROUND
std::memset(&x, 0, sizeof(x)); zero_init( &const_cast< char& >( reinterpret_cast<char const volatile&>( data_ ) ), sizeof( data_ ) ),
#endif #endif
new (wrapper_address()) wrapper(); data_()
{
} }
BOOST_GPU_ENABLED BOOST_GPU_ENABLED
initialized(initialized const & arg) explicit initialized(T const & arg): data_( arg )
{ {
new (wrapper_address()) wrapper( static_cast<wrapper const &>(*(arg.wrapper_address())));
}
BOOST_GPU_ENABLED
explicit initialized(T const & arg)
{
new (wrapper_address()) wrapper(arg);
}
BOOST_GPU_ENABLED
initialized & operator=(initialized const & arg)
{
// Assignment is only allowed when T is non-const.
BOOST_STATIC_ASSERT( ! is_const<T>::value );
*wrapper_address() = static_cast<wrapper const &>(*(arg.wrapper_address()));
return *this;
}
BOOST_GPU_ENABLED
~initialized()
{
wrapper_address()->wrapper::~wrapper();
} }
BOOST_GPU_ENABLED BOOST_GPU_ENABLED
T const & data() const T const & data() const
{ {
return wrapper_address()->data; return data_;
} }
BOOST_GPU_ENABLED BOOST_GPU_ENABLED
T& data() T& data()
{ {
return wrapper_address()->data; return data_;
} }
BOOST_GPU_ENABLED BOOST_GPU_ENABLED
@@ -157,13 +119,13 @@ class initialized
BOOST_GPU_ENABLED BOOST_GPU_ENABLED
operator T const &() const operator T const &() const
{ {
return wrapper_address()->data; return data_;
} }
BOOST_GPU_ENABLED BOOST_GPU_ENABLED
operator T&() operator T&()
{ {
return wrapper_address()->data; return data_;
} }
} ; } ;

View File

@@ -12,29 +12,31 @@
<p>The Boost Utility Library isn't really a single library at all. It is just a <p>The Boost Utility Library isn't really a single library at all. It is just a
collection for components too small to be called libraries in their own right.</p> collection for components too small to be called libraries in their own right.</p>
<p>But that doesn't mean there isn't useful stuff here. Take a look:</p> <p>But that doesn't mean there isn't useful stuff here. Take a look:</p>
<blockquote> <ul>
<p> <li><a href="doc/html/base_from_member.html">base_from_member</a></li>
<a href="../core/doc/html/core/addressof.html">addressof</a> (moved to the Boost.Core library)<br> <li><a href="utility.htm#BOOST_BINARY">BOOST_BINARY</a></li>
<a href="doc/html/base_from_member.html">base_from_member</a><br> <li><a href="call_traits.htm">call_traits</a></li>
<a href="utility.htm#BOOST_BINARY">BOOST_BINARY</a><br> <li><a href="doc/html/compressed_pair.html">compressed_pair</a></li>
<a href="call_traits.htm">call_traits</a><br> <li><a href="in_place_factories.html">in_place_factory</a></li>
<a href="../core/doc/html/core/checked_delete.html">checked_delete</a> (moved to the Boost.Core library)<br> <li><a href="iterator_adaptors.htm">iterator_adaptors</a></li>
<a href="doc/html/compressed_pair.html">compressed_pair</a><br> <li><a href="operators.htm">operators</a></li>
<a href="../type_traits/doc/html/boost_typetraits/reference/declval.html">declval</a> (moved to the Boost.TypeTraits library)<br> <li><a href="utility.htm#result_of">result_of</a></li>
<a href="../core/doc/html/core/enable_if.html">enable_if</a> (moved to the Boost.Core library)<br> <li><a href="throw_exception.html">throw_exception</a></li>
<a href="in_place_factories.html">in_place_factory</a><br> <li><a href="utility.htm">utility</a></li>
<a href="iterator_adaptors.htm">iterator_adaptors</a><br> <li><a href="doc/html/string_ref.html">string_ref</a></li>
<a href="../iterator/doc/generator_iterator.htm">generator iterator adaptors</a> (moved to the Boost.Iterator library)<br> <li><a href="value_init.htm">value_init</a></li>
<a href="../iterator/doc/html/iterator/algorithms/next_prior.html">next/prior</a> (moved to the Boost.Iterator library)<br> </ul>
<a href="../core/doc/html/core/noncopyable.html">noncopyable</a> (moved to the Boost.Core library)<br> <p>Over time useful stuff here has moved to more appropriate Boost libraries:</p>
<a href="operators.htm">operators</a><br> <ul>
<a href="utility.htm#result_of">result_of</a><br> <li><a href="../core/doc/html/core/addressof.html">addressof</a> (moved to Boost.Core)</li>
<a href="throw_exception.html">throw_exception</a><br> <li><a href="../core/doc/html/core/checked_delete.html">checked_delete</a> (moved to Boost.Core)</li>
<a href="utility.htm">utility</a><br> <li><a href="../type_traits/doc/html/boost_typetraits/reference/declval.html">declval</a> (moved to Boost.TypeTraits)</li>
<a href="doc/html/string_ref.html">string_ref</a><br> <li><a href="../core/doc/html/core/enable_if.html">enable_if</a> (moved to Boost.Core)</li>
<a href="value_init.htm">value_init</a><br> <li><a href="../iterator/doc/generator_iterator.htm">generator iterator adaptors</a> (moved to Boost.Iterator)</li>
</p> <li><a href="../iterator/doc/html/iterator/algorithms/next_prior.html">next/prior</a> (moved to Boost.Iterator)</li>
</blockquote> <li><a href="../core/doc/html/core/noncopyable.html">noncopyable</a> (moved to Boost.Core)</li>
<li><a href="../io/doc/html/io.html">ostream_string</a> (moved to Boost.IO)</li>
</ul>
<hr> <hr>
<p>&copy; Copyright Beman Dawes, 2001</p> <p>&copy; Copyright Beman Dawes, 2001</p>
<p>Distributed under the Boost Software License, Version 1.0. (See <p>Distributed under the Boost Software License, Version 1.0. (See

View File

@@ -98,6 +98,19 @@
"Daniel Walker <daniel.j.walker -at- gmail.com>" "Daniel Walker <daniel.j.walker -at- gmail.com>"
] ]
}, },
{
"key": "utility/string_ref",
"name": "string_ref",
"description": "String view templates.",
"documentation": "doc/html/string_ref.html",
"category": [
"Containers"
],
"authors": "Marshall Clow",
"maintainers": [
"Marshall Clow <marshall -at- idio.com>"
]
},
{ {
"key": "utility/value_initialized", "key": "utility/value_initialized",
"name": "Value Initialized", "name": "Value Initialized",

View File

@@ -119,8 +119,8 @@
also want <code>x &gt; y, x &gt;= y,</code> and <code>x &lt;= y</code>. also want <code>x &gt; y, x &gt;= y,</code> and <code>x &lt;= y</code>.
Moreover, unless your class has really surprising behavior, some of these Moreover, unless your class has really surprising behavior, some of these
related operators can be defined in terms of others (e.g. <code>x &gt;= y related operators can be defined in terms of others (e.g. <code>x &gt;= y
&lt;=&gt; !(x &lt; y)</code>). Replicating this boilerplate for multiple is equivalent to !(x &lt; y)</code>). Replicating this boilerplate for
classes is both tedious and error-prone. The <cite><a href= multiple classes is both tedious and error-prone. The <cite><a href=
"../../boost/operators.hpp">boost/operators.hpp</a></cite> templates help "../../boost/operators.hpp">boost/operators.hpp</a></cite> templates help
by generating operators for you at namespace scope based on other by generating operators for you at namespace scope based on other
operators you've defined in your class.</p> operators you've defined in your class.</p>
@@ -454,7 +454,7 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
</caption> </caption>
<tr> <tr>
<td colspan="3"> <td colspan="4">
<table align="center" border="1"> <table align="center" border="1">
<caption> <caption>
<em>Key</em> <em>Key</em>
@@ -482,6 +482,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<th>Supplied Operations</th> <th>Supplied Operations</th>
<th>Requirements</th> <th>Requirements</th>
<th>Propagates <code>constexpr</code>?</th>
</tr> </tr>
<tr> <tr>
@@ -496,6 +498,9 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>t &lt; t1</code>.<br> <td><code>t &lt; t1</code>.<br>
Return convertible to <code>bool</code>. See the <a href= Return convertible to <code>bool</code>. See the <a href=
"#ordering">Ordering Note</a>.</td> "#ordering">Ordering Note</a>.</td>
<td>Since <code>C++11</code><br>
<span style="font-size:small;">(except <a href="https://developercommunity.visualstudio.com/content/problem/414193/rejects-valid-constexpr-marked-friend-function-def.html">MSVC &lt; v19.22</a>)</span></td>
</tr> </tr>
<tr> <tr>
@@ -513,6 +518,9 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>t &lt; u</code>. <code>t &gt; u</code>.<br> <td><code>t &lt; u</code>. <code>t &gt; u</code>.<br>
Returns convertible to <code>bool</code>. See the <a href= Returns convertible to <code>bool</code>. See the <a href=
"#ordering">Ordering Note</a>.</td> "#ordering">Ordering Note</a>.</td>
<td>Since <code>C++11</code><br>
<span style="font-size:small;">(except <a href="https://developercommunity.visualstudio.com/content/problem/414193/rejects-valid-constexpr-marked-friend-function-def.html">MSVC &lt; v19.22</a>)</span></td>
</tr> </tr>
<tr> <tr>
@@ -524,6 +532,9 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>t == t1</code>.<br> <td><code>t == t1</code>.<br>
Return convertible to <code>bool</code>.</td> Return convertible to <code>bool</code>.</td>
<td>Since <code>C++11</code><br>
<span style="font-size:small;">(except <a href="https://developercommunity.visualstudio.com/content/problem/414193/rejects-valid-constexpr-marked-friend-function-def.html">MSVC &lt; v19.22</a>)</span></td>
</tr> </tr>
<tr> <tr>
@@ -537,6 +548,9 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>t == u</code>.<br> <td><code>t == u</code>.<br>
Return convertible to <code>bool</code>.</td> Return convertible to <code>bool</code>.</td>
<td>Since <code>C++11</code><br>
<span style="font-size:small;">(except <a href="https://developercommunity.visualstudio.com/content/problem/414193/rejects-valid-constexpr-marked-friend-function-def.html">MSVC &lt; v19.22</a>)</span></td>
</tr> </tr>
<tr> <tr>
@@ -548,6 +562,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp += t1</code>.<br> <td><code>T temp(t); temp += t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -560,6 +576,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp += u</code>.<br> <td><code>T temp(t); temp += u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -572,6 +590,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp -= t1</code>.<br> <td><code>T temp(t); temp -= t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -584,6 +604,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp -= u</code>.<br> <td><code>T temp(t); temp -= u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -594,6 +616,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(u); temp -= t</code>.<br> <td><code>T temp(u); temp -= t</code>.<br>
Return convertible to <code>T</code>.</td> Return convertible to <code>T</code>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -606,6 +630,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp *= t1</code>.<br> <td><code>T temp(t); temp *= t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -619,6 +645,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp *= u</code>.<br> <td><code>T temp(t); temp *= u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -630,6 +658,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp /= t1</code>.<br> <td><code>T temp(t); temp /= t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -641,6 +671,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp /= u</code>.<br> <td><code>T temp(t); temp /= u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -651,6 +683,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(u); temp /= t</code>.<br> <td><code>T temp(u); temp /= t</code>.<br>
Return convertible to <code>T</code>.</td> Return convertible to <code>T</code>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -662,6 +696,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp %= t1</code>.<br> <td><code>T temp(t); temp %= t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -673,6 +709,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp %= u</code>.<br> <td><code>T temp(t); temp %= u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -683,6 +721,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(u); temp %= t</code>.<br> <td><code>T temp(u); temp %= t</code>.<br>
Return convertible to <code>T</code>.</td> Return convertible to <code>T</code>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -694,6 +734,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp |= t1</code>.<br> <td><code>T temp(t); temp |= t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -706,6 +748,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp |= u</code>.<br> <td><code>T temp(t); temp |= u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -717,6 +761,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp &amp;= t1</code>.<br> <td><code>T temp(t); temp &amp;= t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -729,6 +775,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp &amp;= u</code>.<br> <td><code>T temp(t); temp &amp;= u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -740,6 +788,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp ^= t1</code>.<br> <td><code>T temp(t); temp ^= t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -752,6 +802,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp ^= u</code>.<br> <td><code>T temp(t); temp ^= u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -762,6 +814,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); ++t</code><br> <td><code>T temp(t); ++t</code><br>
Return convertible to <code>T</code>.</td> Return convertible to <code>T</code>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -772,6 +826,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); --t;</code><br> <td><code>T temp(t); --t;</code><br>
Return convertible to <code>T</code>.</td> Return convertible to <code>T</code>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -784,6 +840,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp &lt;&lt;= t1</code>.<br> <td><code>T temp(t); temp &lt;&lt;= t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -796,6 +854,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp &lt;&lt;= u</code>.<br> <td><code>T temp(t); temp &lt;&lt;= u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -808,6 +868,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp &gt;&gt;= t1</code>.<br> <td><code>T temp(t); temp &gt;&gt;= t1</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -820,6 +882,8 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>T temp(t); temp &gt;&gt;= u</code>.<br> <td><code>T temp(t); temp &gt;&gt;= u</code>.<br>
Return convertible to <code>T</code>. See the <a href= Return convertible to <code>T</code>. See the <a href=
"#symmetry">Symmetry Note</a>.</td> "#symmetry">Symmetry Note</a>.</td>
<td>No</td>
</tr> </tr>
<tr> <tr>
@@ -831,6 +895,9 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>t &lt; t1</code>.<br> <td><code>t &lt; t1</code>.<br>
Return convertible to <code>bool</code>. See the <a href= Return convertible to <code>bool</code>. See the <a href=
"#ordering">Ordering Note</a>.</td> "#ordering">Ordering Note</a>.</td>
<td>Since <code>C++11</code><br>
<span style="font-size:small;">(except <a href="https://developercommunity.visualstudio.com/content/problem/414193/rejects-valid-constexpr-marked-friend-function-def.html">MSVC &lt; v19.22</a>)</span></td>
</tr> </tr>
<tr> <tr>
@@ -842,6 +909,9 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>t &lt; u</code>. <code>t &gt; u</code>.<br> <td><code>t &lt; u</code>. <code>t &gt; u</code>.<br>
Returns convertible to <code>bool</code>. See the <a href= Returns convertible to <code>bool</code>. See the <a href=
"#ordering">Ordering Note</a>.</td> "#ordering">Ordering Note</a>.</td>
<td>Since <code>C++11</code><br>
<span style="font-size:small;">(except <a href="https://developercommunity.visualstudio.com/content/problem/414193/rejects-valid-constexpr-marked-friend-function-def.html">MSVC &lt; v19.22</a>)</span></td>
</tr> </tr>
<tr> <tr>
@@ -856,6 +926,9 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
<td><code>t &lt; t1</code>. <code>t == t1</code>.<br> <td><code>t &lt; t1</code>. <code>t == t1</code>.<br>
Returns convertible to <code>bool</code>. See the <a href= Returns convertible to <code>bool</code>. See the <a href=
"#ordering">Ordering Note</a>.</td> "#ordering">Ordering Note</a>.</td>
<td>Since <code>C++11</code><br>
<span style="font-size:small;">(except <a href="https://developercommunity.visualstudio.com/content/problem/414193/rejects-valid-constexpr-marked-friend-function-def.html">MSVC &lt; v19.22</a>)</span></td>
</tr> </tr>
<tr> <tr>
@@ -874,6 +947,9 @@ const point&lt;float&gt; pi_over_4_normalized = pi_over_4 / length(pi_over_4);
u</code>.<br> u</code>.<br>
Returns convertible to <code>bool</code>. See the <a href= Returns convertible to <code>bool</code>. See the <a href=
"#ordering">Ordering Note</a>.</td> "#ordering">Ordering Note</a>.</td>
<td>Since <code>C++11</code><br>
<span style="font-size:small;">(except <a href="https://developercommunity.visualstudio.com/content/problem/414193/rejects-valid-constexpr-marked-friend-function-def.html">MSVC &lt; v19.22</a>)</span></td>
</tr> </tr>
</table> </table>

View File

@@ -21,6 +21,7 @@ run compressed_pair_final_test.cpp ;
run iterators_test.cpp ; run iterators_test.cpp ;
run operators_test.cpp ; run operators_test.cpp ;
compile operators_constexpr_test.cpp ;
compile result_of_test.cpp ; compile result_of_test.cpp ;
@@ -35,6 +36,8 @@ run string_view_test2.cpp ;
run string_view_test_io.cpp ; run string_view_test_io.cpp ;
run value_init_test.cpp ; run value_init_test.cpp ;
run value_init_test2.cpp ;
run value_init_test3.cpp ;
run value_init_workaround_test.cpp ; run value_init_workaround_test.cpp ;
run initialized_test.cpp ; run initialized_test.cpp ;
compile-fail value_init_test_fail1.cpp ; compile-fail value_init_test_fail1.cpp ;

View File

@@ -376,7 +376,7 @@ void call_traits_test<T, true>::assert_construct(typename boost::call_traits<T>:
reference r = t; reference r = t;
const_reference cr = t; const_reference cr = t;
reference r2 = r; reference r2 = r;
#ifndef __BORLANDC__ #ifndef BOOST_BORLANDC
// C++ Builder buglet: // C++ Builder buglet:
const_reference cr2 = r; const_reference cr2 = r;
#endif #endif
@@ -393,7 +393,7 @@ void call_traits_test<T, true>::assert_construct(typename boost::call_traits<T>:
unused_variable(v3); unused_variable(v3);
unused_variable(v4); unused_variable(v4);
unused_variable(v5); unused_variable(v5);
#ifndef __BORLANDC__ #ifndef BOOST_BORLANDC
unused_variable(r2); unused_variable(r2);
unused_variable(cr2); unused_variable(cr2);
#endif #endif

View File

@@ -0,0 +1,59 @@
/*
Copyright 2020 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_CONSTEXPR) && \
(!defined(BOOST_MSVC) || (BOOST_MSVC >= 1922))
#include <boost/operators.hpp>
#include <boost/static_assert.hpp>
namespace {
class Value
: boost::operators<Value> {
public:
BOOST_OPERATORS_CONSTEXPR explicit Value(int v)
: v_(v) { }
BOOST_OPERATORS_CONSTEXPR bool
operator<(const Value& x) const {
return v_ < x.v_;
}
BOOST_OPERATORS_CONSTEXPR bool
operator==(const Value& x) const {
return v_ == x.v_;
}
private:
int v_;
};
} // namespace
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) == Value(2)));
BOOST_STATIC_ASSERT(Value(1) != Value(2));
BOOST_STATIC_ASSERT(Value(1) < Value(2));
BOOST_STATIC_ASSERT(Value(1) <= Value(2));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) > Value(2)));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) >= Value(2)));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(2) == Value(1)));
BOOST_STATIC_ASSERT(Value(2) != Value(1));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(2) < Value(1)));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(2) <= Value(1)));
BOOST_STATIC_ASSERT(Value(2) > Value(1));
BOOST_STATIC_ASSERT(Value(2) >= Value(1));
BOOST_STATIC_ASSERT(Value(1) == Value(1));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) != Value(1)));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) < Value(1)));
BOOST_STATIC_ASSERT(Value(1) <= Value(1));
BOOST_STATIC_ASSERT(!static_cast<bool>(Value(1) > Value(1)));
BOOST_STATIC_ASSERT(Value(1) >= Value(1));
#endif

View File

@@ -50,9 +50,9 @@ namespace
void operator!() const; void operator!() const;
public: public:
convertible_to_bool( const bool value ) : _value( value ) {} convertible_to_bool( const bool value ) : _value( value ) {}
operator unspecified_bool_type() const operator unspecified_bool_type() const
{ return _value ? &convertible_to_bool::_value : 0; } { return _value ? &convertible_to_bool::_value : 0; }
}; };
@@ -64,12 +64,12 @@ namespace
, boost::shiftable<Wrapped1<T> > , boost::shiftable<Wrapped1<T> >
{ {
public: public:
explicit Wrapped1( T v = T() ) : _value(v) {} explicit Wrapped1( T v = T() ) : _value(v) {}
T value() const { return _value; } T value() const { return _value; }
convertible_to_bool operator<(const Wrapped1& x) const convertible_to_bool operator<(const Wrapped1& x) const
{ return _value < x._value; } { return _value < x._value; }
convertible_to_bool operator==(const Wrapped1& x) const convertible_to_bool operator==(const Wrapped1& x) const
{ return _value == x._value; } { return _value == x._value; }
Wrapped1& operator+=(const Wrapped1& x) Wrapped1& operator+=(const Wrapped1& x)
@@ -92,8 +92,8 @@ namespace
{ _value <<= x._value; return *this; } { _value <<= x._value; return *this; }
Wrapped1& operator>>=(const Wrapped1& x) Wrapped1& operator>>=(const Wrapped1& x)
{ _value >>= x._value; return *this; } { _value >>= x._value; return *this; }
Wrapped1& operator++() { ++_value; return *this; } Wrapped1& operator++() { ++_value; return *this; }
Wrapped1& operator--() { --_value; return *this; } Wrapped1& operator--() { --_value; return *this; }
private: private:
T _value; T _value;

View File

@@ -12,6 +12,7 @@
#include <cstddef> // for NULL, std::size_t, std::ptrdiff_t #include <cstddef> // for NULL, std::size_t, std::ptrdiff_t
#include <cstring> // for std::strchr and std::strcmp #include <cstring> // for std::strchr and std::strcmp
#include <cstdlib> // for std::malloc and std::free #include <cstdlib> // for std::malloc and std::free
#include <cstdio> // for EOF
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/utility/string_view.hpp> #include <boost/utility/string_view.hpp>
@@ -19,11 +20,11 @@
#if __cplusplus >= 201402L #if __cplusplus >= 201402L
struct constexpr_char_traits struct constexpr_char_traits
{ {
typedef char char_type; typedef char char_type;
typedef int int_type; typedef int int_type;
typedef std::streamoff off_type; typedef std::streamoff off_type;
typedef std::streampos pos_type; typedef std::streampos pos_type;
typedef std::mbstate_t state_type; typedef std::mbstate_t state_type;
static void assign(char_type& c1, const char_type& c2) noexcept { c1 = c2; } static void assign(char_type& c1, const char_type& c2) noexcept { c1 = c2; }
static constexpr bool eq(char_type c1, char_type c2) noexcept { return c1 == c2; } static constexpr bool eq(char_type c1, char_type c2) noexcept { return c1 == c2; }
@@ -43,11 +44,11 @@ struct constexpr_char_traits
static constexpr int_type eof() noexcept { return EOF; } static constexpr int_type eof() noexcept { return EOF; }
}; };
// yields: // yields:
// 0 if for each i in [0,n), X::eq(s1[i],s2[i]) is true; // 0 if for each i in [0,n), X::eq(s1[i],s2[i]) is true;
// else, a negative value if, for some j in [0,n), X::lt(s1[j],s2[j]) is true and // else, a negative value if, for some j in [0,n), X::lt(s1[j],s2[j]) is true and
// for each i in [0,j) X::eq(s2[i],s2[i]) is true; // for each i in [0,j) X::eq(s2[i],s2[i]) is true;
// else a positive value. // else a positive value.
constexpr int constexpr_char_traits::compare(const char_type* s1, const char_type* s2, size_t n) noexcept constexpr int constexpr_char_traits::compare(const char_type* s1, const char_type* s2, size_t n) noexcept
{ {
for (; n != 0; --n, ++s1, ++s2) for (; n != 0; --n, ++s1, ++s2)
@@ -77,38 +78,38 @@ int main()
constexpr string_view sv2{"abc", 3}; // ptr, len constexpr string_view sv2{"abc", 3}; // ptr, len
constexpr string_view sv3{"def"}; // ptr constexpr string_view sv3{"def"}; // ptr
constexpr const char *s1 = ""; constexpr const char *s1 = "";
constexpr const char *s2 = "abc"; constexpr const char *s2 = "abc";
static_assert( (sv1 == sv1), "" );
static_assert(!(sv1 == sv2), "" );
static_assert( (sv1 != sv2), "" );
static_assert( (sv1 < sv2), "" );
static_assert( (sv1 <= sv2), "" );
static_assert(!(sv1 > sv2), "" );
static_assert(!(sv1 >= sv2), "" );
static_assert(!(s1 == sv2), "" ); static_assert( (sv1 == sv1), "" );
static_assert( (s1 != sv2), "" );
static_assert( (s1 < sv2), "" );
static_assert( (s1 <= sv2), "" );
static_assert(!(s1 > sv2), "" );
static_assert(!(s1 >= sv2), "" );
static_assert(!(sv1 == s2), "" ); static_assert(!(sv1 == sv2), "" );
static_assert( (sv1 != s2), "" ); static_assert( (sv1 != sv2), "" );
static_assert( (sv1 < s2), "" ); static_assert( (sv1 < sv2), "" );
static_assert( (sv1 <= s2), "" ); static_assert( (sv1 <= sv2), "" );
static_assert(!(sv1 > s2), "" ); static_assert(!(sv1 > sv2), "" );
static_assert(!(sv1 >= s2), "" ); static_assert(!(sv1 >= sv2), "" );
static_assert( sv1.compare(sv2) < 0, "" ); static_assert(!(s1 == sv2), "" );
static_assert( sv1.compare(sv1) == 0, "" ); static_assert( (s1 != sv2), "" );
static_assert( sv3.compare(sv1) > 0, "" ); static_assert( (s1 < sv2), "" );
static_assert( (s1 <= sv2), "" );
static_assert(!(s1 > sv2), "" );
static_assert(!(s1 >= sv2), "" );
static_assert( sv1.compare(s2) < 0, "" ); static_assert(!(sv1 == s2), "" );
static_assert( sv1.compare(s1) == 0, "" ); static_assert( (sv1 != s2), "" );
static_assert( sv3.compare(s1) > 0, "" ); static_assert( (sv1 < s2), "" );
static_assert( (sv1 <= s2), "" );
static_assert(!(sv1 > s2), "" );
static_assert(!(sv1 >= s2), "" );
static_assert( sv1.compare(sv2) < 0, "" );
static_assert( sv1.compare(sv1) == 0, "" );
static_assert( sv3.compare(sv1) > 0, "" );
static_assert( sv1.compare(s2) < 0, "" );
static_assert( sv1.compare(s1) == 0, "" );
static_assert( sv3.compare(s1) > 0, "" );
} }
#endif #endif

View File

@@ -17,11 +17,12 @@
#include "boost/utility/value_init.hpp" #include "boost/utility/value_init.hpp"
#ifdef __BORLANDC__ #ifdef BOOST_BORLANDC
#pragma hdrstop #pragma hdrstop
#endif #endif
#include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test.hpp>
#include <boost/config/workaround.hpp>
// //
// Sample POD type // Sample POD type
@@ -217,8 +218,8 @@ void check_initialized_value ( T const& y )
BOOST_TEST ( y == initializedValue ) ; BOOST_TEST ( y == initializedValue ) ;
} }
#ifdef __BORLANDC__ #ifdef BOOST_BORLANDC
#if __BORLANDC__ == 0x582 #if BOOST_BORLANDC == 0x582
void check_initialized_value( NonPOD const& ) void check_initialized_value( NonPOD const& )
{ {
// The initialized_value check is skipped for Borland 5.82 // The initialized_value check is skipped for Borland 5.82

169
test/value_init_test2.cpp Normal file
View File

@@ -0,0 +1,169 @@
// Copyright 2010, Niels Dekker.
//
// 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)
//
// Test program for the boost::value_initialized<T> workaround.
//
// 17 June 2010 (Created) Niels Dekker
#include <boost/utility/value_init.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config/workaround.hpp>
#include <iostream>
namespace
{
struct empty_struct
{
};
// A POD aggregate struct derived from an empty struct.
// Similar to struct Foo1 from Microsoft Visual C++ bug report 484295,
// "VC++ does not value-initialize members of derived classes without
// user-declared constructor", reported in 2009 by Sylvester Hesp:
// https://connect.microsoft.com/VisualStudio/feedback/details/484295
struct derived_struct: empty_struct
{
int data;
};
bool is_value_initialized(const derived_struct& arg)
{
return arg.data == 0;
}
class virtual_destructor_holder
{
public:
int i;
virtual ~virtual_destructor_holder()
{
}
};
bool is_value_initialized(const virtual_destructor_holder& arg)
{
return arg.i == 0;
}
// Equivalent to the Stats class from GCC Bug 33916,
// "Default constructor fails to initialize array members", reported in 2007 by
// Michael Elizabeth Chastain: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916
// and fixed for GCC 4.2.4.
class private_int_array_pair
{
friend bool is_value_initialized(const private_int_array_pair& arg);
private:
int first[12];
int second[12];
};
bool is_value_initialized(const private_int_array_pair& arg)
{
for ( unsigned i = 0; i < 12; ++i)
{
if ( (arg.first[i] != 0) || (arg.second[i] != 0) )
{
return false;
}
}
return true;
}
struct int_pair_struct
{
int first;
int second;
};
typedef int int_pair_struct::*ptr_to_member_type;
struct ptr_to_member_struct
{
ptr_to_member_type data;
};
bool is_value_initialized(const ptr_to_member_struct& arg)
{
return arg.data == 0;
}
template <typename T>
bool is_value_initialized(const T(& arg)[2])
{
return
is_value_initialized(arg[0]) &&
is_value_initialized(arg[1]);
}
template <typename T>
bool is_value_initialized(const boost::value_initialized<T>& arg)
{
return is_value_initialized(arg.data());
}
// Returns zero when the specified object is value-initializated, and one otherwise.
// Prints a message to standard output if the value-initialization has failed.
template <class T>
unsigned failed_to_value_initialized(const T& object, const char *const object_name)
{
if ( is_value_initialized(object) )
{
return 0u;
}
else
{
std::cout << "Note: Failed to value-initialize " << object_name << '.' << std::endl;
return 1u;
}
}
// A macro that passed both the name and the value of the specified object to
// the function above here.
#define FAILED_TO_VALUE_INITIALIZE(value) failed_to_value_initialized(value, #value)
// Equivalent to the dirty_stack() function from GCC Bug 33916,
// "Default constructor fails to initialize array members", reported in 2007 by
// Michael Elizabeth Chastain: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916
void dirty_stack()
{
unsigned char array_on_stack[4096];
for (unsigned i = 0; i < sizeof(array_on_stack); ++i)
{
array_on_stack[i] = 0x11;
}
}
}
int main()
{
#ifdef BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED
std::cout << "BOOST_DETAIL_VALUE_INIT_WORKAROUND_SUGGESTED is defined.\n\n";
#endif
dirty_stack();
BOOST_TEST( is_value_initialized( boost::value_initialized<derived_struct>() ) );
BOOST_TEST( is_value_initialized( boost::value_initialized<virtual_destructor_holder[2]>() ) );
BOOST_TEST( is_value_initialized( boost::value_initialized<private_int_array_pair>() ) );
#if !BOOST_WORKAROUND( BOOST_MSVC, BOOST_TESTED_AT(1925) )
// Null pointers to data members are represented as -1 in MSVC, but
// value initialization sets them to all zero. The workaround employed
// by value_initialized<> is to memset the storage to all zero, which
// doesn't help.
BOOST_TEST( is_value_initialized( boost::value_initialized<ptr_to_member_struct>() ) );
#endif
return boost::report_errors();
}

40
test/value_init_test3.cpp Normal file
View File

@@ -0,0 +1,40 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt)
#include <boost/utility/value_init.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp>
#include <boost/config/pragma_message.hpp>
#if __cplusplus >= 201103L || ( defined(BOOST_MSVC) && BOOST_MSVC >= 1900 )
struct X
{
int a;
char b;
};
struct Y: boost::value_initialized<X>
{
char c = 42;
};
int main()
{
Y y;
BOOST_TEST_EQ( y.data().a, 0 );
BOOST_TEST_EQ( y.data().b, 0 );
BOOST_TEST_EQ( y.c, 42 );
return boost::report_errors();
}
#else
BOOST_PRAGMA_MESSAGE( "Skipping test because compiler doesn't support in-class member initializers" )
int main() {}
#endif

View File

@@ -13,7 +13,7 @@
#include "boost/utility/value_init.hpp" #include "boost/utility/value_init.hpp"
#ifdef __BORLANDC__ #ifdef BOOST_BORLANDC
#pragma hdrstop #pragma hdrstop
#endif #endif

View File

@@ -13,7 +13,7 @@
#include "boost/utility/value_init.hpp" #include "boost/utility/value_init.hpp"
#ifdef __BORLANDC__ #ifdef BOOST_BORLANDC
#pragma hdrstop #pragma hdrstop
#endif #endif

View File

@@ -13,7 +13,7 @@
#include "boost/utility/value_init.hpp" #include "boost/utility/value_init.hpp"
#ifdef __BORLANDC__ #ifdef BOOST_BORLANDC
#pragma hdrstop #pragma hdrstop
#endif #endif