forked from boostorg/core
Compare commits
95 Commits
boost-1.83
...
feature/st
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92f6cfb3cc | ||
|
|
ed452c57a3 | ||
|
|
78885aab8e | ||
|
|
8ebe2e7f57 | ||
|
|
32e6c30f4b | ||
|
|
cebfe007e8 | ||
|
|
3e16f3df14 | ||
|
|
e3a2e88e4c | ||
|
|
5e451b6c84 | ||
|
|
88a957b21c | ||
|
|
1bac0ccfd1 | ||
|
|
602961e526 | ||
|
|
366802b43c | ||
|
|
9dd0a8e1e4 | ||
|
|
622476533c | ||
|
|
a09ee19e3e | ||
|
|
040b018ce0 | ||
|
|
42d0c5954a | ||
|
|
76d0f22d3b | ||
|
|
243eec26fe | ||
|
|
44c32d7691 | ||
|
|
0ee7dc5910 | ||
|
|
9e9e6e3898 | ||
|
|
242b14bb69 | ||
|
|
76061d91d4 | ||
|
|
bda05a7812 | ||
|
|
d66b8c1c13 | ||
|
|
bd29e0dd15 | ||
|
|
72761e34e0 | ||
|
|
983234baee | ||
|
|
83a3a51bee | ||
|
|
acbeaae181 | ||
|
|
d01b4e94cc | ||
|
|
e22bd49fa7 | ||
|
|
c056f3dfc9 | ||
|
|
8b8944dd6e | ||
|
|
278d3f0060 | ||
|
|
3f36d507f2 | ||
|
|
a77338b1cd | ||
|
|
a8c757ddf2 | ||
|
|
98a055cf34 | ||
|
|
074a467d9d | ||
|
|
965508d9e1 | ||
|
|
0a238bb30d | ||
|
|
d03e58b77e | ||
|
|
f774295cdb | ||
|
|
b18495fe35 | ||
|
|
c928c844da | ||
|
|
0a42ddabef | ||
|
|
04cc766db3 | ||
|
|
aa01ad8bf0 | ||
|
|
442e36f652 | ||
|
|
03040c7f5c | ||
|
|
8b31acf9a4 | ||
|
|
fd01cf788c | ||
|
|
151d0c4143 | ||
|
|
31117ef800 | ||
|
|
25b0defdeb | ||
|
|
541745ea24 | ||
|
|
083b41c17e | ||
|
|
a973490f53 | ||
|
|
5f825106c7 | ||
|
|
8cc2fdad76 | ||
|
|
0fb4d92d83 | ||
|
|
76401063a6 | ||
|
|
c4bb59617c | ||
|
|
2d7e036416 | ||
|
|
4a0df827c1 | ||
|
|
59c0fb69f0 | ||
|
|
2f092c62fe | ||
|
|
ccfee3f638 | ||
|
|
45e7e1a91a | ||
|
|
ce20d15048 | ||
|
|
b077925d77 | ||
|
|
61191fc0a1 | ||
|
|
0a35bb6a20 | ||
|
|
95f0b35c36 | ||
|
|
7b1d3718c1 | ||
|
|
80e12e1116 | ||
|
|
6f70ee87a3 | ||
|
|
db20a49e48 | ||
|
|
a57c78221b | ||
|
|
e4adc769aa | ||
|
|
8af04d101c | ||
|
|
cece8ca5b4 | ||
|
|
6c95750f37 | ||
|
|
a9f1407d84 | ||
|
|
db0fd77af1 | ||
|
|
7cbbb08e7b | ||
|
|
ba6360e8ed | ||
|
|
2a70a0f239 | ||
|
|
31a2f7fb6b | ||
|
|
0120dbfe65 | ||
|
|
5f6fe65eb2 | ||
|
|
9fc2a2f1ac |
111
.drone.jsonnet
111
.drone.jsonnet
@@ -32,6 +32,8 @@ local linux_pipeline(name, image, environment, packages = "", sources = [], arch
|
||||
commands:
|
||||
[
|
||||
'set -e',
|
||||
'uname -a',
|
||||
'echo $DRONE_STAGE_MACHINE',
|
||||
'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -',
|
||||
] +
|
||||
(if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) +
|
||||
@@ -97,41 +99,40 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
|
||||
[
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.4",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
"Linux 16.04 GCC 4.4",
|
||||
"cppalliance/droneubuntu1604:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-4.4', CXXSTD: '98,0x' },
|
||||
"g++-4.4",
|
||||
[ "ppa:ubuntu-toolchain-r/test" ],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.6 32/64",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
"Linux 16.04 GCC 4.6 32/64",
|
||||
"cppalliance/droneubuntu1604:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-4.6', CXXSTD: '98,0x', ADDRMD: '32,64' },
|
||||
"g++-4.6-multilib",
|
||||
[ "ppa:ubuntu-toolchain-r/test" ],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.7 32/64",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
"Linux 16.04 GCC 4.7 32/64",
|
||||
"cppalliance/droneubuntu1604:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-4.7', CXXSTD: '98,0x', ADDRMD: '32,64' },
|
||||
"g++-4.7-multilib",
|
||||
[ "ppa:ubuntu-toolchain-r/test" ],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.8* 32/64",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
"Linux 16.04 GCC 4.8 32/64",
|
||||
"cppalliance/droneubuntu1604:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11', ADDRMD: '32,64' },
|
||||
"g++-4.8-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.9 32/64",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
"Linux 16.04 GCC 4.9 32/64",
|
||||
"cppalliance/droneubuntu1604:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-4.9', CXXSTD: '03,11', ADDRMD: '32,64' },
|
||||
"g++-4.9-multilib",
|
||||
[ "ppa:ubuntu-toolchain-r/test" ],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
@@ -194,17 +195,44 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 22.04 GCC 12 32 ASAN",
|
||||
"Linux 22.04 GCC 12 32/64",
|
||||
"cppalliance/droneubuntu2204:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan,
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32,64' },
|
||||
"g++-12-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 22.04 GCC 12 64 ASAN",
|
||||
"cppalliance/droneubuntu2204:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + asan,
|
||||
"g++-12-multilib",
|
||||
"Linux 24.04 GCC 13* 32/64",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32,64' },
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.04 GCC 14 32 ASAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan,
|
||||
"g++-14-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.04 GCC 14 64 ASAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + asan,
|
||||
"g++-14-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.04 GCC 14 32 UBSAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + ubsan,
|
||||
"g++-14-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.04 GCC 14 64 UBSAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + ubsan,
|
||||
"g++-14-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
@@ -313,16 +341,9 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 22.04 Clang 14 UBSAN",
|
||||
"Linux 22.04 Clang 14",
|
||||
"cppalliance/droneubuntu2204:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-14', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
|
||||
"clang-14",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 22.04 Clang 14 ASAN",
|
||||
"cppalliance/droneubuntu2204:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-14', CXXSTD: '03,11,14,17,20,2b' } + asan,
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-14', CXXSTD: '03,11,14,17,20,2b' },
|
||||
"clang-14",
|
||||
),
|
||||
|
||||
@@ -331,15 +352,41 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
"cppalliance/droneubuntu2204:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-15', CXXSTD: '03,11,14,17,20,2b' },
|
||||
"clang-15",
|
||||
["deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main"],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 22.04 Clang 16",
|
||||
"cppalliance/droneubuntu2204:1",
|
||||
"Linux 24.04 Clang 16",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-16', CXXSTD: '03,11,14,17,20,2b' },
|
||||
"clang-16",
|
||||
["deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main"],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.04 Clang 17",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '03,11,14,17,20,2b' },
|
||||
"clang-17",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.04 Clang 18 UBSAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
|
||||
"clang-18",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.04 Clang 18 ASAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + asan,
|
||||
"clang-18",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.10 Clang 19",
|
||||
"cppalliance/droneubuntu2410:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-19', CXXSTD: '03,11,14,17,20,2b' },
|
||||
"clang-19",
|
||||
),
|
||||
|
||||
macos_pipeline(
|
||||
@@ -367,7 +414,7 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
windows_pipeline(
|
||||
"Windows VS2015 msvc-14.0",
|
||||
"cppalliance/dronevs2015",
|
||||
{ TOOLSET: 'msvc-14.0', CXXSTD: '14,latest', ADDRMD: '32,64' },
|
||||
{ TOOLSET: 'msvc-14.0', CXXSTD: '14,latest', B2_DONT_EMBED_MANIFEST: '1' },
|
||||
),
|
||||
|
||||
windows_pipeline(
|
||||
|
||||
321
.github/workflows/ci.yml
vendored
321
.github/workflows/ci.yml
vendored
@@ -1,5 +1,5 @@
|
||||
# Copyright 2020-2021 Peter Dimov
|
||||
# Copyright 2021-2022 Andrey Semashev
|
||||
# Copyright 2021-2024 Andrey Semashev
|
||||
#
|
||||
# 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)
|
||||
@@ -121,6 +121,20 @@ jobs:
|
||||
os: ubuntu-22.04
|
||||
install:
|
||||
- g++-12-multilib
|
||||
- toolset: gcc-13
|
||||
cxxstd: "03,11,14,17,20,23"
|
||||
address-model: 32,64
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:23.04
|
||||
install:
|
||||
- g++-13-multilib
|
||||
- toolset: gcc-14
|
||||
cxxstd: "03,11,14,17,20,23"
|
||||
address-model: 32,64
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:24.04
|
||||
install:
|
||||
- g++-14-multilib
|
||||
- name: UBSAN
|
||||
toolset: gcc-12
|
||||
cxxstd: "03,11,14,17,20,23"
|
||||
@@ -221,30 +235,40 @@ jobs:
|
||||
os: ubuntu-22.04
|
||||
install:
|
||||
- clang-11
|
||||
- g++-11
|
||||
gcc_toolchain: 11
|
||||
- toolset: clang
|
||||
compiler: clang++-12
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
install:
|
||||
- clang-12
|
||||
- g++-11
|
||||
gcc_toolchain: 11
|
||||
- toolset: clang
|
||||
compiler: clang++-13
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
install:
|
||||
- clang-13
|
||||
- g++-11
|
||||
gcc_toolchain: 11
|
||||
- toolset: clang
|
||||
compiler: clang++-14
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
install:
|
||||
- clang-14
|
||||
- g++-11
|
||||
gcc_toolchain: 11
|
||||
- toolset: clang
|
||||
compiler: clang++-15
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
install:
|
||||
- clang-15
|
||||
- g++-11
|
||||
gcc_toolchain: 11
|
||||
- toolset: clang
|
||||
compiler: clang++-15
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
@@ -258,15 +282,34 @@ jobs:
|
||||
- toolset: clang
|
||||
compiler: clang++-16
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:23.04
|
||||
install:
|
||||
- clang-16
|
||||
- libc++-16-dev
|
||||
- libc++abi-16-dev
|
||||
sources:
|
||||
- "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main"
|
||||
source_keys:
|
||||
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
- toolset: clang
|
||||
compiler: clang++-17
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:23.10
|
||||
install:
|
||||
- clang-17
|
||||
- libc++-17-dev
|
||||
- libc++abi-17-dev
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
- toolset: clang
|
||||
compiler: clang++-18
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:24.04
|
||||
install:
|
||||
- clang-18
|
||||
- libc++-18-dev
|
||||
- libc++abi-18-dev
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
- name: UBSAN
|
||||
@@ -283,13 +326,16 @@ jobs:
|
||||
- libc++abi-15-dev
|
||||
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,2a"
|
||||
os: macos-11
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-13
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,2a"
|
||||
os: macos-12
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-14
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-15
|
||||
|
||||
timeout-minutes: 120
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{matrix.os}}
|
||||
container: ${{matrix.container}}
|
||||
|
||||
@@ -318,8 +364,6 @@ jobs:
|
||||
fi
|
||||
git config --global pack.threads 0
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install packages
|
||||
if: matrix.install
|
||||
run: |
|
||||
@@ -434,11 +478,25 @@ jobs:
|
||||
then
|
||||
DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS")
|
||||
fi
|
||||
mkdir -p snapshot
|
||||
cd snapshot
|
||||
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
|
||||
curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
|
||||
tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz"
|
||||
if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ]
|
||||
then
|
||||
echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:"
|
||||
ls -la
|
||||
exit 1
|
||||
fi
|
||||
rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz"
|
||||
cd ..
|
||||
git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root"
|
||||
cd boost-root
|
||||
mkdir -p libs/$LIBRARY
|
||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||
mkdir -p libs
|
||||
rm -rf "libs/$LIBRARY"
|
||||
mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY"
|
||||
rm -rf "../snapshot"
|
||||
git submodule update --init tools/boostdep
|
||||
DEPINST_ARGS+=("$LIBRARY")
|
||||
python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}"
|
||||
@@ -457,7 +515,7 @@ jobs:
|
||||
- name: Run tests
|
||||
if: matrix.cmake_tests == ''
|
||||
run: |
|
||||
cd ../boost-root
|
||||
cd boost-root
|
||||
B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}")
|
||||
if [ -n "${{matrix.build_variant}}" ]
|
||||
then
|
||||
@@ -516,10 +574,9 @@ jobs:
|
||||
os: windows-2019
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Boost
|
||||
shell: cmd
|
||||
run: |
|
||||
@@ -533,10 +590,24 @@ jobs:
|
||||
set BOOST_BRANCH=develop
|
||||
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||
mkdir snapshot
|
||||
cd snapshot
|
||||
echo Downloading library snapshot: https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip
|
||||
curl -L --retry %NET_RETRY_COUNT% -o "%LIBRARY%-%GITHUB_SHA%.zip" "https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip"
|
||||
tar -xf "%LIBRARY%-%GITHUB_SHA%.zip"
|
||||
if not exist "%LIBRARY%-%GITHUB_SHA%\" (
|
||||
echo Library snapshot does not contain the library directory %LIBRARY%-%GITHUB_SHA%:
|
||||
dir
|
||||
exit /b 1
|
||||
)
|
||||
del /f "%LIBRARY%-%GITHUB_SHA%.zip"
|
||||
cd ..
|
||||
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||
if not exist "libs\" mkdir libs
|
||||
if exist "libs\%LIBRARY%\" rmdir /s /q "libs\%LIBRARY%"
|
||||
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
|
||||
rmdir /s /q "..\snapshot"
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
|
||||
cmd /c bootstrap
|
||||
@@ -545,7 +616,7 @@ jobs:
|
||||
- name: Run tests
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root
|
||||
cd boost-root
|
||||
b2 -j %NUMBER_OF_PROCESSORS% libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release embed-manifest-via=linker
|
||||
|
||||
posix-cmake-subdir:
|
||||
@@ -555,17 +626,20 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: ubuntu-24.04
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
- os: macos-15
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install packages
|
||||
if: matrix.install
|
||||
run: sudo apt install ${{matrix.install}}
|
||||
run: |
|
||||
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
|
||||
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y ${{join(matrix.install, ' ')}}
|
||||
|
||||
- name: Setup Boost
|
||||
run: |
|
||||
@@ -580,16 +654,34 @@ jobs:
|
||||
echo REF: $REF
|
||||
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
|
||||
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
|
||||
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
|
||||
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
|
||||
mkdir -p snapshot
|
||||
cd snapshot
|
||||
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
|
||||
curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
|
||||
tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz"
|
||||
if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ]
|
||||
then
|
||||
echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:"
|
||||
ls -la
|
||||
exit 1
|
||||
fi
|
||||
rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz"
|
||||
cd ..
|
||||
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||
mkdir -p libs
|
||||
rm -rf "libs/$LIBRARY"
|
||||
mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY"
|
||||
rm -rf "../snapshot"
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" $LIBRARY
|
||||
|
||||
- name: Use library with add_subdirectory
|
||||
run: |
|
||||
cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
|
||||
cd boost-root/libs/$LIBRARY/test/cmake_subdir_test
|
||||
mkdir __build__ && cd __build__
|
||||
cmake ..
|
||||
cmake --build . -- -j $BUILD_JOBS
|
||||
@@ -602,17 +694,20 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: ubuntu-24.04
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
- os: macos-15
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install packages
|
||||
if: matrix.install
|
||||
run: sudo apt install ${{matrix.install}}
|
||||
run: |
|
||||
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
|
||||
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y ${{join(matrix.install, ' ')}}
|
||||
|
||||
- name: Setup Boost
|
||||
run: |
|
||||
@@ -627,27 +722,45 @@ jobs:
|
||||
echo REF: $REF
|
||||
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
|
||||
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
|
||||
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
|
||||
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
|
||||
mkdir -p snapshot
|
||||
cd snapshot
|
||||
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
|
||||
curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
|
||||
tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz"
|
||||
if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ]
|
||||
then
|
||||
echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:"
|
||||
ls -la
|
||||
exit 1
|
||||
fi
|
||||
rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz"
|
||||
cd ..
|
||||
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||
mkdir -p libs
|
||||
rm -rf "libs/$LIBRARY"
|
||||
mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY"
|
||||
rm -rf "../snapshot"
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" $LIBRARY
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cd ../boost-root
|
||||
cd boost-root
|
||||
mkdir __build__ && cd __build__
|
||||
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd boost-root/__build__
|
||||
cmake --build . --target install -- -j $BUILD_JOBS
|
||||
|
||||
- name: Use the installed library
|
||||
run: |
|
||||
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||
cd boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||
cmake --build . -- -j $BUILD_JOBS
|
||||
ctest --output-on-failure --no-tests=error
|
||||
@@ -659,17 +772,24 @@ jobs:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: ubuntu-24.04
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
- os: macos-15
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install packages
|
||||
if: matrix.install
|
||||
run: sudo apt install ${{matrix.install}}
|
||||
run: |
|
||||
if [ -f "/etc/debian_version" ]
|
||||
then
|
||||
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
|
||||
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ninja-build ${{join(matrix.install, ' ')}}
|
||||
else
|
||||
brew install ninja ${{join(matrix.install, ' ')}}
|
||||
fi
|
||||
|
||||
- name: Setup Boost
|
||||
run: |
|
||||
@@ -684,27 +804,47 @@ jobs:
|
||||
echo REF: $REF
|
||||
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
|
||||
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
|
||||
echo BUILD_JOBS: $BUILD_JOBS
|
||||
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
|
||||
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
|
||||
mkdir -p snapshot
|
||||
cd snapshot
|
||||
echo "Downloading library snapshot: https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
|
||||
curl -L --retry "$NET_RETRY_COUNT" -o "${LIBRARY}-${GITHUB_SHA}.tar.gz" "https://github.com/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz"
|
||||
tar -xf "${LIBRARY}-${GITHUB_SHA}.tar.gz"
|
||||
if [ ! -d "${LIBRARY}-${GITHUB_SHA}" ]
|
||||
then
|
||||
echo "Library snapshot does not contain the library directory ${LIBRARY}-${GITHUB_SHA}:"
|
||||
ls -la
|
||||
exit 1
|
||||
fi
|
||||
rm -f "${LIBRARY}-${GITHUB_SHA}.tar.gz"
|
||||
cd ..
|
||||
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||
mkdir -p libs
|
||||
rm -rf "libs/$LIBRARY"
|
||||
mv -f "../snapshot/${LIBRARY}-${GITHUB_SHA}" "libs/$LIBRARY"
|
||||
rm -rf "../snapshot"
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" $LIBRARY
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cd ../boost-root
|
||||
cd boost-root
|
||||
mkdir __build__ && cd __build__
|
||||
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
|
||||
# Building tests on Mac OS using makefiles sometimes blocks until timeout, if multiple parallel build jobs are used. Use Ninja instead.
|
||||
cmake -G Ninja -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
|
||||
|
||||
- name: Build tests
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd boost-root/__build__
|
||||
cmake --build . --target tests -- -j $BUILD_JOBS
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd boost-root/__build__
|
||||
ctest --output-on-failure --no-tests=error
|
||||
|
||||
windows-cmake-subdir:
|
||||
@@ -716,10 +856,9 @@ jobs:
|
||||
- os: windows-2022
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Boost
|
||||
shell: cmd
|
||||
run: |
|
||||
@@ -733,17 +872,31 @@ jobs:
|
||||
set BOOST_BRANCH=develop
|
||||
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||
mkdir snapshot
|
||||
cd snapshot
|
||||
echo Downloading library snapshot: https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip
|
||||
curl -L --retry %NET_RETRY_COUNT% -o "%LIBRARY%-%GITHUB_SHA%.zip" "https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip"
|
||||
tar -xf "%LIBRARY%-%GITHUB_SHA%.zip"
|
||||
if not exist "%LIBRARY%-%GITHUB_SHA%\" (
|
||||
echo Library snapshot does not contain the library directory %LIBRARY%-%GITHUB_SHA%:
|
||||
dir
|
||||
exit /b 1
|
||||
)
|
||||
del /f "%LIBRARY%-%GITHUB_SHA%.zip"
|
||||
cd ..
|
||||
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||
if not exist "libs\" mkdir libs
|
||||
if exist "libs\%LIBRARY%\" rmdir /s /q "libs\%LIBRARY%"
|
||||
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
|
||||
rmdir /s /q "..\snapshot"
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
|
||||
|
||||
- name: Use library with add_subdirectory (Debug)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test
|
||||
cd boost-root/libs/%LIBRARY%/test/cmake_subdir_test
|
||||
mkdir __build__ && cd __build__
|
||||
cmake ..
|
||||
cmake --build . --config Debug
|
||||
@@ -752,7 +905,7 @@ jobs:
|
||||
- name: Use library with add_subdirectory (Release)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
|
||||
cd boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
|
||||
cmake --build . --config Release
|
||||
ctest --output-on-failure --no-tests=error -C Release
|
||||
|
||||
@@ -765,10 +918,9 @@ jobs:
|
||||
- os: windows-2022
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Boost
|
||||
shell: cmd
|
||||
run: |
|
||||
@@ -782,36 +934,50 @@ jobs:
|
||||
set BOOST_BRANCH=develop
|
||||
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||
mkdir snapshot
|
||||
cd snapshot
|
||||
echo Downloading library snapshot: https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip
|
||||
curl -L --retry %NET_RETRY_COUNT% -o "%LIBRARY%-%GITHUB_SHA%.zip" "https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip"
|
||||
tar -xf "%LIBRARY%-%GITHUB_SHA%.zip"
|
||||
if not exist "%LIBRARY%-%GITHUB_SHA%\" (
|
||||
echo Library snapshot does not contain the library directory %LIBRARY%-%GITHUB_SHA%:
|
||||
dir
|
||||
exit /b 1
|
||||
)
|
||||
del /f "%LIBRARY%-%GITHUB_SHA%.zip"
|
||||
cd ..
|
||||
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||
if not exist "libs\" mkdir libs
|
||||
if exist "libs\%LIBRARY%\" rmdir /s /q "libs\%LIBRARY%"
|
||||
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
|
||||
rmdir /s /q "..\snapshot"
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
|
||||
|
||||
- name: Configure
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root
|
||||
cd boost-root
|
||||
mkdir __build__ && cd __build__
|
||||
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
|
||||
|
||||
- name: Install (Debug)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd boost-root/__build__
|
||||
cmake --build . --target install --config Debug
|
||||
|
||||
- name: Install (Release)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd boost-root/__build__
|
||||
cmake --build . --target install --config Release
|
||||
|
||||
- name: Use the installed library (Debug)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||
cd boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
|
||||
cmake --build . --config Debug
|
||||
ctest --output-on-failure --no-tests=error -C Debug
|
||||
@@ -819,7 +985,7 @@ jobs:
|
||||
- name: Use the installed library (Release)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
|
||||
cd boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
|
||||
cmake --build . --config Release
|
||||
ctest --output-on-failure --no-tests=error -C Release
|
||||
|
||||
@@ -832,10 +998,9 @@ jobs:
|
||||
- os: windows-2022
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 20
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Boost
|
||||
shell: cmd
|
||||
run: |
|
||||
@@ -849,40 +1014,54 @@ jobs:
|
||||
set BOOST_BRANCH=develop
|
||||
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||
mkdir snapshot
|
||||
cd snapshot
|
||||
echo Downloading library snapshot: https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip
|
||||
curl -L --retry %NET_RETRY_COUNT% -o "%LIBRARY%-%GITHUB_SHA%.zip" "https://github.com/%GITHUB_REPOSITORY%/archive/%GITHUB_SHA%.zip"
|
||||
tar -xf "%LIBRARY%-%GITHUB_SHA%.zip"
|
||||
if not exist "%LIBRARY%-%GITHUB_SHA%\" (
|
||||
echo Library snapshot does not contain the library directory %LIBRARY%-%GITHUB_SHA%:
|
||||
dir
|
||||
exit /b 1
|
||||
)
|
||||
del /f "%LIBRARY%-%GITHUB_SHA%.zip"
|
||||
cd ..
|
||||
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||
if not exist "libs\" mkdir libs
|
||||
if exist "libs\%LIBRARY%\" rmdir /s /q "libs\%LIBRARY%"
|
||||
move /Y "..\snapshot\%LIBRARY%-%GITHUB_SHA%" "libs\%LIBRARY%"
|
||||
rmdir /s /q "..\snapshot"
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
|
||||
|
||||
- name: Configure
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root
|
||||
cd boost-root
|
||||
mkdir __build__ && cd __build__
|
||||
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_TESTING=ON ..
|
||||
|
||||
- name: Build tests (Debug)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd boost-root/__build__
|
||||
cmake --build . --target tests --config Debug
|
||||
|
||||
- name: Run tests (Debug)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd boost-root/__build__
|
||||
ctest --output-on-failure --no-tests=error -C Debug
|
||||
|
||||
- name: Build tests (Release)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd boost-root/__build__
|
||||
cmake --build . --target tests --config Release
|
||||
|
||||
- name: Run tests (Release)
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root/__build__
|
||||
cd boost-root/__build__
|
||||
ctest --output-on-failure --no-tests=error -C Release
|
||||
|
||||
23
build.jam
Normal file
23
build.jam
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2023-2024 René Ferdinand Rivera Morell
|
||||
# Copyright 2024 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
require-b2 5.2 ;
|
||||
|
||||
constant boost_dependencies :
|
||||
/boost/assert//boost_assert
|
||||
/boost/config//boost_config
|
||||
/boost/static_assert//boost_static_assert
|
||||
/boost/throw_exception//boost_throw_exception
|
||||
;
|
||||
|
||||
project /boost/core ;
|
||||
|
||||
explicit
|
||||
[ alias boost_core : : : : <include>include <library>$(boost_dependencies) ]
|
||||
[ alias all : boost_core test ]
|
||||
;
|
||||
|
||||
call-if : boost-library core
|
||||
;
|
||||
@@ -9,7 +9,7 @@ import project ;
|
||||
import doxygen ;
|
||||
import quickbook ;
|
||||
|
||||
path-constant INCLUDES : ../../.. ;
|
||||
path-constant INCLUDES : ../include ;
|
||||
|
||||
doxygen ref_reference
|
||||
:
|
||||
|
||||
@@ -1,12 +1,57 @@
|
||||
[/
|
||||
Copyright 2021 Peter Dimov
|
||||
Copyright 2022 Andrey Semashev
|
||||
Copyright 2022-2024 Andrey Semashev
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
https://boost.org/LICENSE_1_0.txt)
|
||||
]
|
||||
|
||||
[section Revision History]
|
||||
|
||||
[section Changes in 1.86.0]
|
||||
|
||||
* Added a [link core.pointer_in_range `boost/core/pointer_in_range.hpp`] header with a `pointer_in_range`
|
||||
function template to check if a pointer is within a given range.
|
||||
* Fixed `type_name` for abstract classes. ([github_issue 172])
|
||||
* Fixed `boost/core/type_name.hpp` compilation error with MSVC with disabled native `wchar_t` type.
|
||||
([github_issue 173])
|
||||
* Added a workaround for an MSVC [@https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025 bug]
|
||||
causing `empty_value` compilation errors when it is used with a nested class. ([github_pr 175])
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Changes in 1.85.0]
|
||||
|
||||
* Added a new [link core.functor `boost/core/functor.hpp`] header with a `functor` class template
|
||||
for wrapping a raw function into a function object class.
|
||||
* Changed [link core.null_deleter `null_deleter`], [link core.fclose_deleter `fclose_deleter`]
|
||||
and [link core.checked_delete checked deleter] definitions so that they don't bring namespace `boost`
|
||||
into argument-dependent lookup in cases like this:
|
||||
```
|
||||
std::unique_ptr< std::FILE, boost::fclose_deleter > p1, p2;
|
||||
swap(p1, p2); // no longer looks for boost::swap as part of ADL
|
||||
```
|
||||
Users may need to either explicitly qualify the namespace of the called function or add a
|
||||
`using`-declaration.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Changes in 1.84.0]
|
||||
|
||||
* `boost::swap` utility function has been renamed to `boost::core::invoke_swap` to
|
||||
avoid forming a potential infinite recursion when the arguments are not swappable.
|
||||
The new function is defined in `boost/core/invoke_swap.hpp` and is functionally equivalent
|
||||
to `boost::swap`. The old `boost::swap` name is preserved for backward compatibility
|
||||
but deprecated and will be removed in a future release. Its `noexcept` specification
|
||||
has been removed to avoid compile errors caused by compile-time recursion.
|
||||
`BOOST_ALLOW_DEPRECATED_SYMBOLS` or `BOOST_ALLOW_DEPRECATED` can be defined to suppress
|
||||
deprecation warnings for the transition period. ([@https://github.com/boostorg/core/issues/148 #148])
|
||||
* Headers `boost/swap.hpp`, `boost/utility/swap.hpp` and `boost/core/swap.hpp` are
|
||||
deprecated and will be removed. Please, switch to `boost/core/invoke_swap.hpp`.
|
||||
`BOOST_ALLOW_DEPRECATED_HEADERS` or `BOOST_ALLOW_DEPRECATED` can be defined to suppress
|
||||
deprecation warnings.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Changes in 1.83.0]
|
||||
|
||||
* Added support for incomplete types to [link core.type_name `boost::core::type_name`].
|
||||
|
||||
@@ -20,6 +20,9 @@ or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
]
|
||||
]
|
||||
|
||||
[template github_issue[key]'''<ulink url="https://github.com/boostorg/core/issues/'''[key]'''">#'''[key]'''</ulink>''']
|
||||
[template github_pr[key]'''<ulink url="https://github.com/boostorg/core/pull/'''[key]'''">PR#'''[key]'''</ulink>''']
|
||||
|
||||
[template simplesect[title]
|
||||
[block '''<simplesect><title>'''[title]'''</title>''']]
|
||||
|
||||
@@ -55,6 +58,7 @@ criteria for inclusion is that the utility component be:
|
||||
[include exchange.qbk]
|
||||
[include explicit_operator_bool.qbk]
|
||||
[include first_scalar.qbk]
|
||||
[include functor.qbk]
|
||||
[include identity.qbk]
|
||||
[include ignore_unused.qbk]
|
||||
[include is_same.qbk]
|
||||
@@ -69,6 +73,7 @@ criteria for inclusion is that the utility component be:
|
||||
[include null_deleter.qbk]
|
||||
[include fclose_deleter.qbk]
|
||||
[include nvp.qbk]
|
||||
[include pointer_in_range.qbk]
|
||||
[include pointer_traits.qbk]
|
||||
[include quick_exit.qbk]
|
||||
[include ref.qbk]
|
||||
|
||||
101
doc/functor.qbk
Normal file
101
doc/functor.qbk
Normal file
@@ -0,0 +1,101 @@
|
||||
[/
|
||||
/ Copyright (c) 2024 Andrey Semashev
|
||||
/
|
||||
/ 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)
|
||||
/]
|
||||
|
||||
[section:functor functor]
|
||||
|
||||
[simplesect Authors]
|
||||
|
||||
* Andrey Semashev
|
||||
|
||||
[endsimplesect]
|
||||
|
||||
[section Header <boost/core/functor.hpp>]
|
||||
|
||||
[note This component requires a compiler supporting C++17 or newer.]
|
||||
|
||||
The header `<boost/core/functor.hpp>` defines the `boost::core::functor` class template
|
||||
that wraps a raw function specified in its template parameter into a function object class.
|
||||
The function object forwards any arguments passed to it to the wrapped function and returns
|
||||
the result of the call.
|
||||
|
||||
The `functor` wrapper can be useful in cases when a function object class type is required,
|
||||
for example, for use with smart pointers such as `std::unique_ptr`, where the actual logic
|
||||
of the function object is already implemented as a raw function, possibly provided by a
|
||||
third party library. Since `functor` is default-constructible and does not store a pointer
|
||||
to the wrapped function internally, using `functor` is less error-prone and more efficient
|
||||
than using the pointer to function instead. For example, with `std::unique_ptr` you don't
|
||||
need to pass a pointer to the deleter function in the `std::unique_ptr` constructor, and
|
||||
the `std::unique_ptr` object does not store and invoke a pointer to the deleter function.
|
||||
With `functor`, the deleter function becomes part of the `std::unique_ptr` type, which
|
||||
prevents mixing pointers with incompatible deleters.
|
||||
|
||||
```
|
||||
void my_deleter(void* p);
|
||||
|
||||
using malloc_ptr = std::unique_ptr< char, boost::core::functor< std::free > >;
|
||||
using my_ptr = std::unique_ptr< char, boost::core::functor< my_deleter > >;
|
||||
|
||||
my_ptr create_string(std::size_t size);
|
||||
void consume_string(my_ptr&& str);
|
||||
|
||||
malloc_ptr ptr1(static_cast< char* >(std::malloc(size)));
|
||||
// ptr1 = allocate_string(size); // error, cannot convert my_ptr to malloc_ptr
|
||||
my_ptr ptr2 = create_string(size); // ok
|
||||
|
||||
// consume_string(std::move(ptr1)); // error, cannot convert malloc_ptr&& to my_ptr
|
||||
consume_string(std::move(ptr2)); // ok
|
||||
```
|
||||
|
||||
Using `functor` may also be beneficial for reducing generated code sizes. For example, in
|
||||
order to avoid storing and invoking a pointer to the deleter function in `std::shared_ptr`,
|
||||
one may be inclined to use lambda functions to wrap the deleter function call like this:
|
||||
|
||||
```
|
||||
std::shared_ptr< int > ptr(static_cast< int* >(std::malloc(sizeof(int))), [](int* p) { std::free(p); });
|
||||
```
|
||||
|
||||
The problem is that every lambda function declaration introduces a unique type, even if
|
||||
the lambda function definition matches exactly one of the previously declared lambda
|
||||
functions. Thus, if `std::shared_ptr` objects like the one above are created in multiple
|
||||
places in the program, the definition of the shared pointer counter and associated code
|
||||
and data (e.g. virtual function table) will be duplicated for each instance.
|
||||
|
||||
Replacing the lambda function with `functor` solves this problem without sacrificing
|
||||
readability or efficiency:
|
||||
|
||||
```
|
||||
std::shared_ptr< int > ptr(static_cast< int* >(std::malloc(sizeof(int))), boost::core::functor< std::free >());
|
||||
```
|
||||
|
||||
[section Synopsis]
|
||||
|
||||
```
|
||||
namespace boost::core {
|
||||
|
||||
template< auto Function >
|
||||
struct functor
|
||||
{
|
||||
template< typename... Args >
|
||||
decltype(auto) operator() (Args&&... args) const noexcept(...);
|
||||
};
|
||||
|
||||
} // namespace boost::core
|
||||
```
|
||||
|
||||
[endsect]
|
||||
|
||||
[section `template< typename... Args > decltype(auto) operator() (Args&&... args) const noexcept(...);`]
|
||||
|
||||
* *Effects:* `return Function(std::forward< Args >(args)...)`.
|
||||
* *Throws:* Nothing, unless invoking `Function` throws.
|
||||
* *Note:* This function only participates in overload resolution if `Function(std::forward< Args >(args)...)` is a valid call expression.
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
81
doc/pointer_in_range.qbk
Normal file
81
doc/pointer_in_range.qbk
Normal file
@@ -0,0 +1,81 @@
|
||||
[/
|
||||
Copyright 2024 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
]
|
||||
|
||||
[section:pointer_in_range pointer_in_range]
|
||||
|
||||
[simplesect Authors]
|
||||
|
||||
* Glen Fernandes
|
||||
|
||||
[endsimplesect]
|
||||
|
||||
[section Overview]
|
||||
|
||||
The header <boost/core/pointer_in_range.hpp> provides the function template
|
||||
`boost::pointer_in_range` to check if a pointer is in a given range. This
|
||||
can be used in constant expressions in C++14 or higher when the compiler has a
|
||||
builtin to support `std::is_constant_evaluated`.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Examples]
|
||||
|
||||
The following is an example of an allocator's deallocation function that does
|
||||
nothing if the pointer falls within a small automatically allocated buffer.
|
||||
|
||||
```
|
||||
template<class T, class N>
|
||||
void
|
||||
Allocator<T, N>::deallocate(pointer ptr, size_type)
|
||||
{
|
||||
if (!boost::pointer_in_range(ptr, buffer_, buffer_ + N)) {
|
||||
::operator delete(ptr);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Reference]
|
||||
|
||||
```
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
constexpr bool pointer_in_range(const T* ptr, const T* begin, const T* end);
|
||||
|
||||
} /* boost */
|
||||
```
|
||||
|
||||
[section Functions]
|
||||
|
||||
[variablelist
|
||||
[[`template<class T> constexpr bool pointer_in_range(const T* ptr,
|
||||
const T* begin, const T* end);`]
|
||||
[[variablelist
|
||||
[[Requires][`[begin,end)` is a valid range.]]
|
||||
[[Returns][`true` if `ptr` is in range `[begin,end)`, otherwise `false`.]]]]]]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Notes]
|
||||
|
||||
If `boost::pointer_in_range` is not usable in constant expressions the macro
|
||||
`BOOST_CORE_NO_CONSTEXPR_POINTER_IN_RANGE` is defined.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section History]
|
||||
|
||||
Glen Fernandes implemented `pointer_in_range`.
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
35
doc/swap.qbk
35
doc/swap.qbk
@@ -20,17 +20,17 @@
|
||||
|
||||
[endsimplesect]
|
||||
|
||||
[section Header <boost/core/swap.hpp>]
|
||||
[section Header <boost/core/invoke_swap.hpp>]
|
||||
|
||||
[^template<class T> void swap(T& left, T& right) noexcept(['see below]);]
|
||||
[^template<class T> void invoke_swap(T& left, T& right) noexcept(['see below]);]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Introduction]
|
||||
|
||||
The template function `boost::swap` allows the values of two
|
||||
variables to be swapped, using argument dependent lookup to
|
||||
select a specialized swap function if available. If no
|
||||
The template function `boost::core::invoke_swap` allows the
|
||||
values of two variables to be swapped, using argument dependent
|
||||
lookup to select a specialized swap function if available. If no
|
||||
specialized swap function is available, `std::swap` is used.
|
||||
|
||||
[endsect]
|
||||
@@ -56,9 +56,9 @@ Although this is legal C++, no Boost libraries use this method,
|
||||
whereas many Boost libraries provide specialized swap functions
|
||||
in their own namespaces.
|
||||
|
||||
`boost::swap` also supports swapping built-in arrays. Note that
|
||||
`std::swap` originally did not do so, but a request to add an
|
||||
overload of `std::swap` for built-in arrays has been accepted
|
||||
`boost::core::invoke_swap` also supports swapping built-in arrays.
|
||||
Note that `std::swap` originally did not do so, but a request to
|
||||
add an overload of `std::swap` for built-in arrays has been accepted
|
||||
by the C++ Standards Committee[footnote
|
||||
[@http://open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#809
|
||||
LWG Defect Report 809: std::swap should be overloaded for array
|
||||
@@ -68,14 +68,15 @@ by the C++ Standards Committee[footnote
|
||||
|
||||
[section Exception Safety]
|
||||
|
||||
`boost::swap` provides the same exception guarantee as the
|
||||
underlying swap function used, with one exception; for an array
|
||||
`boost::core::invoke_swap` provides the same exception guarantee as
|
||||
the underlying swap function used, with one exception; for an array
|
||||
of type `T[n]`, where `n > 1` and the underlying swap function
|
||||
for `T` provides the strong exception guarantee, `boost::swap`
|
||||
provides only the basic exception guarantee.
|
||||
for `T` provides the strong exception guarantee,
|
||||
`boost::core::invoke_swap` provides only the basic exception guarantee.
|
||||
|
||||
In C++11 and later, `boost::swap` propagates the same `noexcept`
|
||||
specification as the one specified in the underlying swap function.
|
||||
In C++11 and later, `boost::core::invoke_swap` propagates the same
|
||||
`noexcept` specification as the one specified in the underlying swap
|
||||
function.
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -104,7 +105,7 @@ Or:
|
||||
[section Portability]
|
||||
|
||||
Several older compilers do not support argument dependent
|
||||
lookup. On these compilers `boost::swap` will call
|
||||
lookup. On these compilers `boost::core::invoke_swap` will call
|
||||
`std::swap`, ignoring any specialized swap functions that
|
||||
could be found as a result of argument dependent lookup.
|
||||
|
||||
@@ -118,7 +119,9 @@ could be found as a result of argument dependent lookup.
|
||||
tests, and documentation
|
||||
* *Steven Watanabe* - for the idea to make `boost::swap` less
|
||||
specialized than `std::swap`, thereby allowing the function
|
||||
to have the name 'swap' without introducing ambiguity
|
||||
to have the name 'swap' without introducing ambiguity. However,
|
||||
later the function was renamed to `boost::core::invoke_swap`
|
||||
to avoid potential infinite recursion.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
@@ -43,9 +43,17 @@ _LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
#if defined(_STL_DISABLE_DEPRECATED_WARNING)
|
||||
_STL_DISABLE_DEPRECATED_WARNING
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
#if defined(__clang__) && defined(__has_warning)
|
||||
# if __has_warning("-Wdeprecated-declarations")
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4996)
|
||||
#elif defined(BOOST_GCC) && BOOST_GCC >= 40600
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
@@ -807,9 +815,15 @@ using allocator_rebind_t = typename allocator_rebind<A, T>::type;
|
||||
|
||||
} /* boost */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#if defined(__clang__) && defined(__has_warning)
|
||||
# if __has_warning("-Wdeprecated-declarations")
|
||||
# pragma clang diagnostic pop
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#elif defined(BOOST_GCC) && BOOST_GCC >= 40600
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
#if defined(_STL_RESTORE_DEPRECATED_WARNING)
|
||||
_STL_RESTORE_DEPRECATED_WARNING
|
||||
#endif
|
||||
|
||||
@@ -47,12 +47,19 @@
|
||||
# if __has_builtin(__builtin_bit_cast)
|
||||
# define BOOST_CORE_HAS_BUILTIN_BIT_CAST
|
||||
# endif
|
||||
# if __has_builtin(__builtin_bswap16)
|
||||
# define BOOST_CORE_HAS_BUILTIN_BSWAP16
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC >= 1926
|
||||
#if !defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST) && (defined(BOOST_MSVC) && BOOST_MSVC >= 1926)
|
||||
# define BOOST_CORE_HAS_BUILTIN_BIT_CAST
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_CORE_HAS_BUILTIN_BSWAP16) && (defined(BOOST_GCC) && BOOST_GCC >= 40800)
|
||||
# define BOOST_CORE_HAS_BUILTIN_BSWAP16
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace core
|
||||
@@ -825,11 +832,22 @@ BOOST_CONSTEXPR inline boost::uint8_t byteswap_impl( boost::uint8_t x ) BOOST_NO
|
||||
return x;
|
||||
}
|
||||
|
||||
#if defined(BOOST_CORE_HAS_BUILTIN_BSWAP16)
|
||||
|
||||
BOOST_CONSTEXPR inline boost::uint16_t byteswap_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
||||
{
|
||||
return __builtin_bswap16( x );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOST_CONSTEXPR inline boost::uint16_t byteswap_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast<boost::uint16_t>( x << 8 | x >> 8 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||
|
||||
@@ -60,6 +60,10 @@ template<class T> inline void checked_array_delete(T * x) BOOST_NOEXCEPT
|
||||
delete [] x;
|
||||
}
|
||||
|
||||
// Block unintended ADL
|
||||
namespace checked_deleters
|
||||
{
|
||||
|
||||
template<class T> struct checked_deleter
|
||||
{
|
||||
typedef void result_type;
|
||||
@@ -83,6 +87,11 @@ template<class T> struct checked_array_deleter
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace checked_deleters
|
||||
|
||||
using checked_deleters::checked_deleter;
|
||||
using checked_deleters::checked_array_deleter;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_CORE_CHECKED_DELETE_HPP
|
||||
|
||||
58
include/boost/core/detail/minstd_rand.hpp
Normal file
58
include/boost/core/detail/minstd_rand.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
|
||||
#define BOOST_CORE_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_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(__has_builtin)
|
||||
# if __has_builtin(__builtin_ia32_pause) && !defined(_INTEL_COMPILER)
|
||||
# if __has_builtin(__builtin_ia32_pause) && !defined(__INTEL_COMPILER)
|
||||
# define BOOST_CORE_HAS_BUILTIN_IA32_PAUSE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -41,9 +41,6 @@ namespace boost
|
||||
// forward declaration of boost::basic_string_view from Utility
|
||||
template<class Ch, class Tr> class basic_string_view;
|
||||
|
||||
// forward declaration of boost::hash_range from ContainerHash
|
||||
template<class It> std::size_t hash_range( It, It );
|
||||
|
||||
namespace core
|
||||
{
|
||||
namespace detail
|
||||
@@ -74,7 +71,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_of( Ch const* p_
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@@ -91,7 +88,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_of( Ch const* p_
|
||||
{
|
||||
for( std::size_t i = pos; i < n_; ++i )
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
if( ch >= 0 && ch < 256 && table[ ch ] ) return i;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +126,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_of( Ch const* p_,
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@@ -150,7 +147,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_of( Ch const* p_,
|
||||
{
|
||||
do
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 && table[ ch ] ) return i;
|
||||
|
||||
@@ -199,7 +196,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_not_of( Ch const
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@@ -216,7 +213,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_not_of( Ch const
|
||||
{
|
||||
for( std::size_t i = pos; i < n_; ++i )
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
if( !( ch >= 0 && ch < 256 && table[ ch ] ) ) return i;
|
||||
}
|
||||
}
|
||||
@@ -262,7 +259,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_not_of( Ch const*
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@@ -283,7 +280,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_not_of( Ch const*
|
||||
{
|
||||
do
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
|
||||
if( !( ch >= 0 && ch < 256 && table[ ch ] ) ) return i;
|
||||
|
||||
@@ -381,7 +378,7 @@ public:
|
||||
}
|
||||
|
||||
template<class End> BOOST_CXX14_CONSTEXPR basic_string_view( Ch const* first, End last,
|
||||
typename boost::enable_if<boost::core::detail::is_same<End, Ch const*> >::type* = 0 ) BOOST_NOEXCEPT: p_( first ), n_( last - first )
|
||||
typename boost::enable_if<boost::core::detail::is_same<End, Ch const*> >::type* = 0 ) BOOST_NOEXCEPT: p_( first ), n_( static_cast<size_type>( last - first ) )
|
||||
{
|
||||
BOOST_ASSERT( last - first >= 0 );
|
||||
}
|
||||
@@ -392,7 +389,7 @@ public:
|
||||
|
||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||
|
||||
basic_string_view( std::basic_string_view<Ch, std::char_traits<Ch> > const& str ) BOOST_NOEXCEPT: p_( str.data() ), n_( str.size() )
|
||||
BOOST_CONSTEXPR basic_string_view( std::basic_string_view<Ch, std::char_traits<Ch> > const& str ) BOOST_NOEXCEPT: p_( str.data() ), n_( str.size() )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -681,7 +678,7 @@ public:
|
||||
|
||||
Ch const* r = traits_type::find( data() + pos, size() - pos, c );
|
||||
|
||||
return r? r - data(): npos;
|
||||
return r? static_cast<size_type>( r - data() ): npos;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR size_type find( Ch const* s, size_type pos, size_type n ) const BOOST_NOEXCEPT
|
||||
@@ -696,11 +693,11 @@ public:
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
p = traits_type::find( p, last - p, s[0] );
|
||||
p = traits_type::find( p, static_cast<size_type>( last - p ), s[0] );
|
||||
|
||||
if( p == 0 ) break;
|
||||
|
||||
if( traits_type::compare( p + 1, s + 1, n - 1 ) == 0 ) return p - data();
|
||||
if( traits_type::compare( p + 1, s + 1, n - 1 ) == 0 ) return static_cast<size_type>( p - data() );
|
||||
|
||||
++p;
|
||||
}
|
||||
@@ -1181,11 +1178,6 @@ public:
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline friend std::size_t hash_value( basic_string_view const& sv )
|
||||
{
|
||||
return boost::hash_range( sv.begin(), sv.end() );
|
||||
}
|
||||
};
|
||||
|
||||
// stream inserter
|
||||
@@ -1193,7 +1185,7 @@ public:
|
||||
template<class Ch> std::basic_ostream<Ch>& operator<<( std::basic_ostream<Ch>& os, basic_string_view<Ch> str )
|
||||
{
|
||||
Ch const* p = str.data();
|
||||
std::streamsize n = str.size();
|
||||
std::streamsize n = static_cast<std::streamsize>( str.size() );
|
||||
|
||||
std::streamsize m = os.width();
|
||||
|
||||
|
||||
@@ -95,9 +95,57 @@ private:
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
#if defined(BOOST_MSVC)
|
||||
/*
|
||||
This is a workaround to an MSVC bug when T is a nested class:
|
||||
https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025
|
||||
*/
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
class empty_value_base
|
||||
: public T {
|
||||
public:
|
||||
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
||||
empty_value_base() = default;
|
||||
#else
|
||||
BOOST_CONSTEXPR empty_value_base() { }
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class U, class... Args>
|
||||
BOOST_CONSTEXPR empty_value_base(U&& value, Args&&... args)
|
||||
: T(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value_base(U&& value)
|
||||
: T(std::forward<U>(value)) { }
|
||||
#endif
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value_base(const U& value)
|
||||
: T(value) { }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value_base(U& value)
|
||||
: T(value) { }
|
||||
#endif
|
||||
};
|
||||
|
||||
} /* detail */
|
||||
#endif
|
||||
|
||||
template<class T, unsigned N>
|
||||
class empty_value<T, N, true>
|
||||
#if defined(BOOST_MSVC)
|
||||
: detail::empty_value_base<T> {
|
||||
typedef detail::empty_value_base<T> empty_base_;
|
||||
#else
|
||||
: T {
|
||||
typedef T empty_base_;
|
||||
#endif
|
||||
|
||||
public:
|
||||
typedef T type;
|
||||
|
||||
@@ -108,26 +156,26 @@ public:
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t)
|
||||
: T() { }
|
||||
: empty_base_() { }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class U, class... Args>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args)
|
||||
: T(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||
: empty_base_(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value)
|
||||
: T(std::forward<U>(value)) { }
|
||||
: empty_base_(std::forward<U>(value)) { }
|
||||
#endif
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value)
|
||||
: T(value) { }
|
||||
: empty_base_(value) { }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value)
|
||||
: T(value) { }
|
||||
: empty_base_(value) { }
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT {
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
// Block unintended ADL
|
||||
namespace fclose_deleter_ns {
|
||||
|
||||
//! A function object that closes a file
|
||||
struct fclose_deleter
|
||||
{
|
||||
@@ -41,6 +44,10 @@ struct fclose_deleter
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace fclose_deleter_ns
|
||||
|
||||
using fclose_deleter_ns::fclose_deleter;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_CORE_FCLOSE_DELETER_HPP
|
||||
|
||||
41
include/boost/core/functor.hpp
Normal file
41
include/boost/core/functor.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2024.
|
||||
* 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 functor.hpp
|
||||
* \author Andrey Semashev
|
||||
* \date 2024-01-23
|
||||
*
|
||||
* This header contains a \c functor implementation. This is a function object
|
||||
* that invokes a function that is specified as its template parameter.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_CORE_FUNCTOR_HPP
|
||||
#define BOOST_CORE_FUNCTOR_HPP
|
||||
|
||||
namespace boost::core {
|
||||
|
||||
// Block unintended ADL
|
||||
namespace functor_ns {
|
||||
|
||||
//! A function object that invokes a function specified as its template parameter
|
||||
template< auto Function >
|
||||
struct functor
|
||||
{
|
||||
template< typename... Args >
|
||||
auto operator() (Args&&... args) const noexcept(noexcept(Function(static_cast< Args&& >(args)...))) -> decltype(Function(static_cast< Args&& >(args)...))
|
||||
{
|
||||
return Function(static_cast< Args&& >(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace functor_ns
|
||||
|
||||
using functor_ns::functor;
|
||||
|
||||
} // namespace boost::core
|
||||
|
||||
#endif // BOOST_CORE_FUNCTOR_HPP
|
||||
93
include/boost/core/invoke_swap.hpp
Normal file
93
include/boost/core/invoke_swap.hpp
Normal file
@@ -0,0 +1,93 @@
|
||||
// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker
|
||||
// Copyright (C) 2023 Andrey Semashev
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// For more information, see http://www.boost.org
|
||||
|
||||
#ifndef BOOST_CORE_INVOKE_SWAP_HPP
|
||||
#define BOOST_CORE_INVOKE_SWAP_HPP
|
||||
|
||||
// Note: the implementation of this utility contains various workarounds:
|
||||
// - invoke_swap_impl is put outside the boost namespace, to avoid infinite
|
||||
// recursion (causing stack overflow) when swapping objects of a primitive
|
||||
// type.
|
||||
// - std::swap is imported with a using-directive, rather than
|
||||
// a using-declaration, because some compilers (including MSVC 7.1,
|
||||
// Borland 5.9.3, and Intel 8.1) don't do argument-dependent lookup
|
||||
// when it has a using-declaration instead.
|
||||
// - The main entry function is called invoke_swap rather than swap
|
||||
// to avoid forming an infinite recursion when the arguments are not
|
||||
// swappable.
|
||||
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB)
|
||||
#include <utility> // for std::swap (C++11)
|
||||
#else
|
||||
#include <algorithm> // for std::swap (C++98)
|
||||
#endif
|
||||
#include <cstddef> // for std::size_t
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC < 40700)
|
||||
// gcc 4.6 ICEs on noexcept specifications below
|
||||
#define BOOST_CORE_SWAP_NOEXCEPT_IF(x)
|
||||
#else
|
||||
#define BOOST_CORE_SWAP_NOEXCEPT_IF(x) BOOST_NOEXCEPT_IF(x)
|
||||
#endif
|
||||
|
||||
namespace boost_swap_impl {
|
||||
|
||||
// we can't use type_traits here
|
||||
|
||||
template<class T> struct is_const { enum _vt { value = 0 }; };
|
||||
template<class T> struct is_const<T const> { enum _vt { value = 1 }; };
|
||||
|
||||
// Use std::swap if argument dependent lookup fails.
|
||||
// We need to have this at namespace scope to be able to use unqualified swap() call
|
||||
// in noexcept specification.
|
||||
using namespace std;
|
||||
|
||||
template<class T>
|
||||
BOOST_GPU_ENABLED
|
||||
inline void invoke_swap_impl(T& left, T& right) BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(swap(left, right)))
|
||||
{
|
||||
swap(left, right);
|
||||
}
|
||||
|
||||
template<class T, std::size_t N>
|
||||
BOOST_GPU_ENABLED
|
||||
inline void invoke_swap_impl(T (& left)[N], T (& right)[N])
|
||||
BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::invoke_swap_impl(left[0], right[0])))
|
||||
{
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
{
|
||||
::boost_swap_impl::invoke_swap_impl(left[i], right[i]);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace boost_swap_impl
|
||||
|
||||
namespace boost {
|
||||
namespace core {
|
||||
|
||||
template<class T>
|
||||
BOOST_GPU_ENABLED
|
||||
inline typename enable_if_c< !::boost_swap_impl::is_const<T>::value >::type
|
||||
invoke_swap(T& left, T& right)
|
||||
BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::invoke_swap_impl(left, right)))
|
||||
{
|
||||
::boost_swap_impl::invoke_swap_impl(left, right);
|
||||
}
|
||||
|
||||
} // namespace core
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_CORE_SWAP_NOEXCEPT_IF
|
||||
|
||||
#endif // BOOST_CORE_INVOKE_SWAP_HPP
|
||||
@@ -11,14 +11,28 @@
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(__has_builtin)
|
||||
# if __has_builtin(__builtin_launder)
|
||||
# define BOOST_CORE_HAS_BUILTIN_LAUNDER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && !defined(BOOST_CORE_HAS_BUILTIN_LAUNDER)
|
||||
# include <new>
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC < 1920
|
||||
|
||||
// msvc-14.1 suffers from internal compiler errors when using std::launder
|
||||
// https://github.com/boostorg/core/issues/160
|
||||
// https://github.com/boostorg/optional/issues/122
|
||||
|
||||
#elif (BOOST_CXX_VERSION >= 201703L) && !defined(BOOST_CORE_HAS_BUILTIN_LAUNDER)
|
||||
|
||||
#include <new>
|
||||
|
||||
#if defined(__cpp_lib_launder)
|
||||
# define BOOST_CORE_HAS_STD_LAUNDER
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
@@ -33,7 +47,7 @@ template<class T> T* launder( T* p )
|
||||
return __builtin_launder( p );
|
||||
}
|
||||
|
||||
#elif (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && defined(__cpp_lib_launder)
|
||||
#elif defined(BOOST_CORE_HAS_STD_LAUNDER)
|
||||
|
||||
template<class T> T* launder( T* p )
|
||||
{
|
||||
|
||||
@@ -153,6 +153,7 @@ inline void no_throw_failed_impl(const char* expr, const char* what, const char*
|
||||
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
# pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
|
||||
// specialize test output for char pointers to avoid printing as cstring
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
// Block unintended ADL
|
||||
namespace null_deleter_ns {
|
||||
|
||||
//! A function object that does nothing and can be used as an empty deleter for \c shared_ptr
|
||||
struct null_deleter
|
||||
{
|
||||
@@ -39,6 +42,10 @@ struct null_deleter
|
||||
void operator() (T*) const BOOST_NOEXCEPT {}
|
||||
};
|
||||
|
||||
} // namespace null_deleter_ns
|
||||
|
||||
using null_deleter_ns::null_deleter;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_CORE_NULL_DELETER_HPP
|
||||
|
||||
49
include/boost/core/pointer_in_range.hpp
Normal file
49
include/boost/core/pointer_in_range.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright 2024 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_CORE_POINTER_IN_RANGE_HPP
|
||||
#define BOOST_CORE_POINTER_IN_RANGE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <functional>
|
||||
|
||||
#if !defined(BOOST_NO_CXX14_CONSTEXPR)
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC >= 1925
|
||||
#define BOOST_CORE_DETAIL_HAS_IS_CONSTEVAL
|
||||
#elif defined(__has_builtin)
|
||||
#if __has_builtin(__builtin_is_constant_evaluated)
|
||||
#define BOOST_CORE_DETAIL_HAS_IS_CONSTEVAL
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_CORE_DETAIL_HAS_IS_CONSTEVAL)
|
||||
#define BOOST_CORE_NO_CONSTEXPR_POINTER_IN_RANGE
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T>
|
||||
inline BOOST_CONSTEXPR bool
|
||||
pointer_in_range(const T* p, const T* b, const T* e)
|
||||
{
|
||||
#if defined(BOOST_CORE_DETAIL_HAS_IS_CONSTEVAL)
|
||||
if ( __builtin_is_constant_evaluated()) {
|
||||
for (; b != e; ++b) {
|
||||
if (b == p) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return std::less_equal<const T*>()(b, p) && std::less<const T*>()(p, e);
|
||||
}
|
||||
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
@@ -351,8 +351,10 @@ private:
|
||||
detail::span_store<T, E> s_;
|
||||
};
|
||||
|
||||
#if defined(BOOST_NO_CXX17_INLINE_VARIABLES)
|
||||
template<class T, std::size_t E>
|
||||
constexpr std::size_t span<T, E>::extent;
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_deduction_guides
|
||||
template<class I, class L>
|
||||
|
||||
@@ -10,80 +10,31 @@
|
||||
#define BOOST_CORE_SWAP_HPP
|
||||
|
||||
// Note: the implementation of this utility contains various workarounds:
|
||||
// - swap_impl is put outside the boost namespace, to avoid infinite
|
||||
// recursion (causing stack overflow) when swapping objects of a primitive
|
||||
// type.
|
||||
// - std::swap is imported with a using-directive, rather than
|
||||
// a using-declaration, because some compilers (including MSVC 7.1,
|
||||
// Borland 5.9.3, and Intel 8.1) don't do argument-dependent lookup
|
||||
// when it has a using-declaration instead.
|
||||
// - boost::swap has two template arguments, instead of one, to
|
||||
// avoid ambiguity when swapping objects of a Boost type that does
|
||||
// not have its own boost::swap overload.
|
||||
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB)
|
||||
#include <utility> // for std::swap (C++11)
|
||||
#else
|
||||
#include <algorithm> // for std::swap (C++98)
|
||||
#endif
|
||||
#include <cstddef> // for std::size_t
|
||||
#include <boost/config/header_deprecated.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC < 40700)
|
||||
// gcc 4.6 ICEs on noexcept specifications below
|
||||
#define BOOST_CORE_SWAP_NOEXCEPT_IF(x)
|
||||
#else
|
||||
#define BOOST_CORE_SWAP_NOEXCEPT_IF(x) BOOST_NOEXCEPT_IF(x)
|
||||
#endif
|
||||
|
||||
namespace boost_swap_impl
|
||||
{
|
||||
// we can't use type_traits here
|
||||
|
||||
template<class T> struct is_const { enum _vt { value = 0 }; };
|
||||
template<class T> struct is_const<T const> { enum _vt { value = 1 }; };
|
||||
|
||||
// Use std::swap if argument dependent lookup fails.
|
||||
// We need to have this at namespace scope to be able to use unqualified swap() call
|
||||
// in noexcept specification.
|
||||
using namespace std;
|
||||
|
||||
template<class T>
|
||||
BOOST_GPU_ENABLED
|
||||
void swap_impl(T& left, T& right) BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(swap(left, right)))
|
||||
{
|
||||
swap(left, right);
|
||||
}
|
||||
|
||||
template<class T, std::size_t N>
|
||||
BOOST_GPU_ENABLED
|
||||
void swap_impl(T (& left)[N], T (& right)[N])
|
||||
BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::swap_impl(left[0], right[0])))
|
||||
{
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
{
|
||||
::boost_swap_impl::swap_impl(left[i], right[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp")
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class T1, class T2>
|
||||
BOOST_GPU_ENABLED
|
||||
typename enable_if_c< !boost_swap_impl::is_const<T1>::value && !boost_swap_impl::is_const<T2>::value >::type
|
||||
BOOST_DEPRECATED("This function is deprecated, use boost::core::invoke_swap instead.")
|
||||
inline typename enable_if_c< !boost_swap_impl::is_const<T1>::value && !boost_swap_impl::is_const<T2>::value >::type
|
||||
swap(T1& left, T2& right)
|
||||
BOOST_CORE_SWAP_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(::boost_swap_impl::swap_impl(left, right)))
|
||||
{
|
||||
::boost_swap_impl::swap_impl(left, right);
|
||||
boost::core::invoke_swap(left, right);
|
||||
}
|
||||
}
|
||||
|
||||
#undef BOOST_CORE_SWAP_NOEXCEPT_IF
|
||||
|
||||
#endif // BOOST_CORE_SWAP_HPP
|
||||
|
||||
@@ -103,7 +103,8 @@ inline std::string fix_typeid_name( char const* n )
|
||||
}
|
||||
|
||||
// class types can be incomplete
|
||||
template<class T> std::string typeid_name_impl( int T::* )
|
||||
// but also abstract (T[1] doesn't form)
|
||||
template<class T> std::string typeid_name_impl( int T::*, T(*)[1] )
|
||||
{
|
||||
std::string r = fix_typeid_name( typeid(T[1]).name() );
|
||||
return r.substr( 0, r.size() - 4 ); // remove ' [1]' suffix
|
||||
@@ -116,7 +117,7 @@ template<class T> std::string typeid_name_impl( ... )
|
||||
|
||||
template<class T> std::string typeid_name()
|
||||
{
|
||||
return typeid_name_impl<T>( 0 );
|
||||
return typeid_name_impl<T>( 0, 0 );
|
||||
}
|
||||
|
||||
// template names
|
||||
@@ -345,6 +346,8 @@ template<> struct tn_holder<boost::uint128_type>
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
|
||||
template<> struct tn_holder<wchar_t>
|
||||
{
|
||||
static std::string type_name( std::string const& suffix )
|
||||
@@ -353,6 +356,8 @@ template<> struct tn_holder<wchar_t>
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
|
||||
template<> struct tn_holder<char16_t>
|
||||
|
||||
@@ -10,8 +10,11 @@
|
||||
#define BOOST_SWAP_HPP
|
||||
|
||||
// The header file at this path is deprecated;
|
||||
// use boost/core/swap.hpp instead.
|
||||
// use boost/core/invoke_swap.hpp instead.
|
||||
|
||||
#include <boost/config/header_deprecated.hpp>
|
||||
#include <boost/core/swap.hpp>
|
||||
|
||||
BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp")
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,8 +10,11 @@
|
||||
#define BOOST_UTILITY_SWAP_HPP
|
||||
|
||||
// The header file at this path is deprecated;
|
||||
// use boost/core/swap.hpp instead.
|
||||
// use boost/core/invoke_swap.hpp instead.
|
||||
|
||||
#include <boost/config/header_deprecated.hpp>
|
||||
#include <boost/core/swap.hpp>
|
||||
|
||||
BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp")
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,17 +8,6 @@ if(HAVE_BOOST_TEST)
|
||||
|
||||
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::core Boost::static_assert Boost::type_traits)
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::type_traits)
|
||||
|
||||
boost_test(TYPE run SOURCES eif_constructors.cpp)
|
||||
boost_test(TYPE run SOURCES eif_dummy_arg_disambiguation.cpp)
|
||||
boost_test(TYPE run SOURCES eif_lazy.cpp)
|
||||
boost_test(TYPE run SOURCES eif_lazy_test.cpp)
|
||||
boost_test(TYPE run SOURCES eif_member_templates.cpp)
|
||||
boost_test(TYPE run SOURCES eif_namespace_disambiguation.cpp)
|
||||
boost_test(TYPE run SOURCES eif_no_disambiguation.cpp)
|
||||
boost_test(TYPE run SOURCES eif_partial_specializations.cpp)
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::throw_exception)
|
||||
|
||||
boost_test(TYPE run SOURCES no_exceptions_support_test.cpp)
|
||||
@@ -27,6 +16,10 @@ set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::utility)
|
||||
|
||||
boost_test(TYPE run SOURCES sv_conversion_test2.cpp)
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::container_hash)
|
||||
|
||||
boost_test(TYPE run SOURCES sv_hash_test.cpp)
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::config Boost::move Boost::smart_ptr)
|
||||
|
||||
boost_test(TYPE run SOURCES fclose_deleter_test.cpp)
|
||||
|
||||
202
test/Jamfile.v2
202
test/Jamfile.v2
@@ -6,22 +6,37 @@
|
||||
# See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
require-b2 5.0.1 ;
|
||||
import-search /boost/config/checks ;
|
||||
import config : requires ;
|
||||
import modules ;
|
||||
import testing ;
|
||||
|
||||
project : requirements
|
||||
|
||||
<library>/boost/core//boost_core
|
||||
<library>/boost/type_traits//boost_type_traits
|
||||
<warnings>extra
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>gcc-4.4:<cxxflags>-Wno-sign-compare ;
|
||||
|
||||
local warning-as-errors-off =
|
||||
local warnings-as-errors-off =
|
||||
"-<toolset>msvc:<warnings-as-errors>on"
|
||||
"-<toolset>gcc:<warnings-as-errors>on"
|
||||
"-<toolset>clang:<warnings-as-errors>on" ;
|
||||
|
||||
local pedantic-errors = <warnings>pedantic
|
||||
<toolset>gcc:<cxxflags>"-Wconversion"
|
||||
<toolset>gcc:<cxxflags>"-Wsign-conversion"
|
||||
<toolset>clang:<cxxflags>"-Wconversion"
|
||||
<toolset>clang:<cxxflags>"-Wsign-conversion"
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on ;
|
||||
|
||||
local CPP11 = [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_constexpr cxx11_noexcept cxx11_ref_qualifiers ] ;
|
||||
|
||||
# quick test (for CI)
|
||||
run quick.cpp ;
|
||||
|
||||
@@ -32,61 +47,66 @@ run addressof_np_test.cpp ;
|
||||
run addressof_fn_test.cpp ;
|
||||
compile addressof_constexpr_test.cpp ;
|
||||
compile-fail addressof_fail_rvalue.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
run checked_delete_test.cpp ;
|
||||
run checked_delete_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
compile-fail checked_delete_fail.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail checked_delete_fail2.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail checked_deleter_compile_fail_adl.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail checked_array_deleter_compile_fail_adl.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
compile ref_ct_test.cpp ;
|
||||
run ref_test.cpp ;
|
||||
run ref_ref_test.cpp ;
|
||||
run ref_fn_test.cpp ;
|
||||
compile-fail ref_rv_fail1.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail ref_rv_fail2.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail ref_rv_fail3.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail ref_rv_fail4.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail ref_rv_fail5.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail ref_implicit_fail.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail ref_implicit_fail2.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail ref_implicit_fail3.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail ref_implicit_fail4.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
run ref_cv_test.cpp ;
|
||||
run ref_conversion_test.cpp ;
|
||||
|
||||
run eif_constructors.cpp : ;
|
||||
run eif_dummy_arg_disambiguation.cpp : ;
|
||||
run eif_lazy.cpp : ;
|
||||
run eif_lazy_test.cpp : ;
|
||||
run eif_member_templates.cpp : ;
|
||||
run eif_namespace_disambiguation.cpp : ;
|
||||
run eif_no_disambiguation.cpp : ;
|
||||
run eif_partial_specializations.cpp : ;
|
||||
run eif_constructors.cpp ;
|
||||
run eif_dummy_arg_disambiguation.cpp ;
|
||||
run eif_lazy.cpp ;
|
||||
run eif_lazy_test.cpp ;
|
||||
run eif_member_templates.cpp ;
|
||||
run eif_namespace_disambiguation.cpp ;
|
||||
run eif_no_disambiguation.cpp ;
|
||||
run eif_partial_specializations.cpp ;
|
||||
|
||||
compile-fail noncopyable_compile_fail.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
run explicit_operator_bool.cpp ;
|
||||
run explicit_operator_bool_noexcept.cpp ;
|
||||
compile-fail explicit_operator_bool_compile_fail_conv_int.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail explicit_operator_bool_compile_fail_conv_pvoid.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail explicit_operator_bool_compile_fail_delete.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail explicit_operator_bool_compile_fail_shift.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
compile ignore_unused_test.cpp ;
|
||||
|
||||
@@ -97,13 +117,6 @@ run visit_each_test.cpp ;
|
||||
|
||||
run get_pointer_test.cpp ;
|
||||
|
||||
local pedantic-errors = <warnings>pedantic
|
||||
<toolset>gcc:<cxxflags>"-Wconversion"
|
||||
<toolset>clang:<cxxflags>"-Wconversion"
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on ;
|
||||
|
||||
run lightweight_test_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run lightweight_test_test.cpp : : :
|
||||
@@ -181,13 +194,28 @@ run demangled_name_test.cpp : : : <rtti>off <test-info>always_show_run_output :
|
||||
|
||||
run scoped_enum.cpp ;
|
||||
compile-fail scoped_enum_compile_fail_conv_from_int.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail scoped_enum_compile_fail_conv_to_int.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
run underlying_type.cpp ;
|
||||
|
||||
run fclose_deleter_test.cpp : : : <target-os>windows:<define>_CRT_SECURE_NO_WARNINGS <target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE ;
|
||||
compile-fail null_deleter_compile_fail_adl.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
run fclose_deleter_test.cpp : : :
|
||||
$(CPP11)
|
||||
<library>/boost/move//boost_move
|
||||
<library>/boost/smart_ptr//boost_smart_ptr
|
||||
<target-os>windows:<define>_CRT_SECURE_NO_WARNINGS
|
||||
<target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE ;
|
||||
|
||||
compile-fail fclose_deleter_compile_fail_adl.cpp
|
||||
: <target-os>windows:<define>_CRT_SECURE_NO_WARNINGS <target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE $(warnings-as-errors-off) ;
|
||||
|
||||
run functor_test.cpp ;
|
||||
compile-fail functor_compile_fail_adl.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
run pointer_traits_pointer_test.cpp ;
|
||||
run pointer_traits_element_type_test.cpp ;
|
||||
@@ -209,6 +237,8 @@ run empty_value_test.cpp ;
|
||||
run empty_value_size_test.cpp ;
|
||||
run empty_value_final_test.cpp ;
|
||||
run empty_value_constexpr_test.cpp ;
|
||||
compile empty_value_nested_test.cpp ;
|
||||
compile-fail empty_value_compile_fail_casting.cpp ;
|
||||
|
||||
run quick_exit_test.cpp ;
|
||||
run-fail quick_exit_fail.cpp ;
|
||||
@@ -251,6 +281,7 @@ run allocator_destroy_test.cpp ;
|
||||
run allocator_construct_n_test.cpp ;
|
||||
run allocator_destroy_n_test.cpp ;
|
||||
run allocator_traits_test.cpp ;
|
||||
compile allocator_pmr_test.cpp ;
|
||||
|
||||
lib lib_typeid : lib_typeid.cpp : <link>shared:<define>LIB_TYPEID_DYN_LINK=1 ;
|
||||
|
||||
@@ -319,37 +350,60 @@ run type_name_test.cpp ;
|
||||
|
||||
run snprintf_test.cpp ;
|
||||
|
||||
run sv_types_test.cpp ;
|
||||
run sv_construct_test.cpp ;
|
||||
run sv_iteration_test.cpp ;
|
||||
run sv_element_access_test.cpp ;
|
||||
run sv_modifiers_test.cpp ;
|
||||
run sv_copy_test.cpp ;
|
||||
run sv_substr_test.cpp ;
|
||||
run sv_compare_test.cpp ;
|
||||
run sv_starts_with_test.cpp ;
|
||||
run sv_ends_with_test.cpp ;
|
||||
run sv_find_test.cpp ;
|
||||
run sv_rfind_test.cpp ;
|
||||
run sv_types_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_construct_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_iteration_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_element_access_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_modifiers_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_copy_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_substr_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_compare_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_starts_with_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_ends_with_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_find_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_rfind_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_find_first_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_find_last_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_find_first_not_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_find_last_not_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_contains_test.cpp ;
|
||||
run sv_eq_test.cpp ;
|
||||
run sv_lt_test.cpp ;
|
||||
run sv_stream_insert_test.cpp ;
|
||||
run sv_conversion_test.cpp ;
|
||||
run sv_conversion_test2.cpp : ;
|
||||
run sv_common_reference_test.cpp ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_contains_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_eq_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_lt_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_stream_insert_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_conversion_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_conversion_test2.cpp : : : <library>/boost/utility//boost_utility ;
|
||||
run sv_common_reference_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
compile sv_common_reference_test2.cpp ;
|
||||
compile sv_windows_h_test.cpp ;
|
||||
compile-fail sv_nullptr_fail.cpp
|
||||
: $(warning-as-errors-off) ;
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
compile sv_construct_test_cx.cpp ;
|
||||
compile sv_construct_test_cx2.cpp ;
|
||||
|
||||
run sv_hash_test.cpp : : : $(CPP11) <library>/boost/container_hash//boost_container_hash ;
|
||||
|
||||
run span_test.cpp ;
|
||||
run span_types_test.cpp ;
|
||||
@@ -378,10 +432,20 @@ run memory_resource_test.cpp ;
|
||||
run data_test.cpp ;
|
||||
run size_test.cpp ;
|
||||
|
||||
run serialization_nvp_test.cpp : : : <library>/boost//serialization/<warnings>off <undefined-sanitizer>norecover:<build>no ;
|
||||
run serialization_split_free_test.cpp : : : <library>/boost//serialization/<warnings>off <undefined-sanitizer>norecover:<link>static ;
|
||||
run serialization_split_member_test.cpp : : : <library>/boost//serialization/<warnings>off <undefined-sanitizer>norecover:<link>static ;
|
||||
run serialization_construct_data_test.cpp : : : <library>/boost//serialization/<warnings>off <undefined-sanitizer>norecover:<link>static ;
|
||||
local with-serialization =
|
||||
<library>/boost/serialization//boost_serialization/<warnings>off
|
||||
$(warnings-as-errors-off)
|
||||
<undefined-sanitizer>norecover:<link>static
|
||||
$(CPP11)
|
||||
# Serialization no longer builds under classic MinGW
|
||||
# and <toolset>gcc,<target-os>windows,<address-model>32 fails for some reason
|
||||
<toolset>gcc,<target-os>windows:<build>no
|
||||
;
|
||||
|
||||
run serialization_nvp_test.cpp : : : $(with-serialization) <undefined-sanitizer>norecover:<build>no ;
|
||||
run serialization_split_free_test.cpp : : : $(with-serialization) ;
|
||||
run serialization_split_member_test.cpp : : : $(with-serialization) ;
|
||||
run serialization_construct_data_test.cpp : : : $(with-serialization) ;
|
||||
|
||||
run identity_test.cpp ;
|
||||
run identity_rvalue_test.cpp ;
|
||||
@@ -392,5 +456,11 @@ run sp_thread_sleep_test.cpp ;
|
||||
run yield_prim_windows_h_test.cpp ;
|
||||
run yield_prim_pthread_cancel_test.cpp : ;
|
||||
|
||||
run pointer_in_range_test.cpp ;
|
||||
compile pointer_in_range_constexpr_test.cpp ;
|
||||
|
||||
run minstd_rand_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
|
||||
use-project /boost/core/swap : ./swap ;
|
||||
build-project ./swap ;
|
||||
|
||||
22
test/allocator_pmr_test.cpp
Normal file
22
test/allocator_pmr_test.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Testing stdlib polymorphic allocators
|
||||
//
|
||||
// Copyright 2024 Braden Ganetsky
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CXX17_HDR_MEMORY_RESOURCE
|
||||
#include <memory_resource>
|
||||
|
||||
void pmr_allocator_destroy_compiles(std::pmr::polymorphic_allocator<int>& alloc, int* p)
|
||||
{
|
||||
boost::allocator_destroy(alloc, p);
|
||||
}
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
|
||||
30
test/checked_array_deleter_compile_fail_adl.cpp
Normal file
30
test/checked_array_deleter_compile_fail_adl.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2024.
|
||||
* 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 checked_array_deleter_compile_fail_adl.cpp
|
||||
* \author Andrey Semashev
|
||||
* \date 07.02.2024
|
||||
*
|
||||
* This file tests that \c boost::checked_array_deleter doesn't bring namespace
|
||||
* \c boost into ADL.
|
||||
*/
|
||||
|
||||
#include <boost/core/checked_delete.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
void check_adl(checked_array_deleter< int > const&)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
int main()
|
||||
{
|
||||
// Must not find boost::check_adl
|
||||
check_adl(boost::checked_array_deleter< int >());
|
||||
}
|
||||
30
test/checked_deleter_compile_fail_adl.cpp
Normal file
30
test/checked_deleter_compile_fail_adl.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2024.
|
||||
* 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 checked_deleter_compile_fail_adl.cpp
|
||||
* \author Andrey Semashev
|
||||
* \date 07.02.2024
|
||||
*
|
||||
* This file tests that \c boost::checked_deleter doesn't bring namespace
|
||||
* \c boost into ADL.
|
||||
*/
|
||||
|
||||
#include <boost/core/checked_delete.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
void check_adl(checked_deleter< int > const&)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
int main()
|
||||
{
|
||||
// Must not find boost::check_adl
|
||||
check_adl(boost::checked_deleter< int >());
|
||||
}
|
||||
@@ -14,4 +14,4 @@ target_link_libraries(quick Boost::core)
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
||||
@@ -18,4 +18,4 @@ target_link_libraries(quick Boost::core)
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
||||
20
test/empty_value_compile_fail_casting.cpp
Normal file
20
test/empty_value_compile_fail_casting.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright 2024 Braden Ganetsky
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/empty_value.hpp>
|
||||
|
||||
struct empty {};
|
||||
|
||||
// This test ensures private inheritance of `boost::empty_value<T>` for empty `T`.
|
||||
// With public inheritance, `boost::empty_value<empty>*` could cast to `empty*`.
|
||||
void test_empty_not_convertible_to_base()
|
||||
{
|
||||
const boost::empty_value<empty> x(boost::empty_init);
|
||||
const empty* x2 = static_cast<const empty*>(&x);
|
||||
(void)x2;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
||||
45
test/empty_value_nested_test.cpp
Normal file
45
test/empty_value_nested_test.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright 2024 Braden Ganetsky
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#include <boost/core/empty_value.hpp>
|
||||
|
||||
/*
|
||||
Tests workaround for MSVC bug:
|
||||
https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025
|
||||
*/
|
||||
template<class T>
|
||||
struct derived
|
||||
: boost::empty_value<T> {
|
||||
typedef typename boost::empty_value<T>::type type;
|
||||
derived(boost::empty_init_t e)
|
||||
: boost::empty_value<T>(e) { }
|
||||
};
|
||||
|
||||
struct outer {
|
||||
struct inner_empty { };
|
||||
struct inner_non_empty {
|
||||
inner_non_empty()
|
||||
: value() { }
|
||||
int value;
|
||||
};
|
||||
};
|
||||
|
||||
void test()
|
||||
{
|
||||
const boost::empty_value<outer> x1(boost::empty_init);
|
||||
(void)x1;
|
||||
const boost::empty_value<outer::inner_empty> x2(boost::empty_init);
|
||||
(void)x2;
|
||||
const boost::empty_value<outer::inner_non_empty> x3(boost::empty_init);
|
||||
(void)x3;
|
||||
const derived<outer> x4(boost::empty_init);
|
||||
(void)x4;
|
||||
const derived<outer::inner_empty> x5(boost::empty_init);
|
||||
(void)x5;
|
||||
const derived<outer::inner_non_empty> x6(boost::empty_init);
|
||||
(void)x6;
|
||||
}
|
||||
30
test/fclose_deleter_compile_fail_adl.cpp
Normal file
30
test/fclose_deleter_compile_fail_adl.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2024.
|
||||
* 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 fclose_deleter_compile_fail_adl.cpp
|
||||
* \author Andrey Semashev
|
||||
* \date 02.02.2024
|
||||
*
|
||||
* This file tests that \c boost::fclose_deleter doesn't bring namespace
|
||||
* \c boost into ADL.
|
||||
*/
|
||||
|
||||
#include <boost/core/fclose_deleter.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
void check_adl(fclose_deleter const&)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
int main()
|
||||
{
|
||||
// Must not find boost::check_adl
|
||||
check_adl(boost::fclose_deleter());
|
||||
}
|
||||
32
test/functor_compile_fail_adl.cpp
Normal file
32
test/functor_compile_fail_adl.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2024.
|
||||
* 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 functor_compile_fail_adl.cpp
|
||||
* \author Andrey Semashev
|
||||
* \date 02.02.2024
|
||||
*
|
||||
* This file tests that \c boost::core::functor doesn't bring namespace
|
||||
* \c boost::core into ADL.
|
||||
*/
|
||||
|
||||
#include <boost/core/functor.hpp>
|
||||
|
||||
void func() {}
|
||||
|
||||
namespace boost::core {
|
||||
|
||||
void check_adl(functor< ::func > const&)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace boost::core
|
||||
|
||||
int main()
|
||||
{
|
||||
// Must not find boost::check_adl
|
||||
check_adl(boost::core::functor< ::func >());
|
||||
}
|
||||
202
test/functor_test.cpp
Normal file
202
test/functor_test.cpp
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2024.
|
||||
* 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 functor_test.cpp
|
||||
* \author Andrey Semashev
|
||||
* \date 2024-01-23
|
||||
*
|
||||
* This file contains tests for \c boost::core::functor.
|
||||
*/
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS)
|
||||
|
||||
#include <boost/core/functor.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
#if (defined(__cpp_lib_is_invocable) && (__cpp_lib_is_invocable >= 201703l)) || \
|
||||
(defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION >= 140) && (BOOST_CXX_VERSION >= 201703l))
|
||||
|
||||
namespace test {
|
||||
|
||||
using std::is_invocable;
|
||||
|
||||
} // namespace test
|
||||
|
||||
#else
|
||||
|
||||
namespace test {
|
||||
|
||||
// A simplified implementation that does not support member function pointers
|
||||
template< typename Func, typename... Args >
|
||||
struct is_invocable_impl
|
||||
{
|
||||
template< typename F = Func, typename = decltype(std::declval< F >()(std::declval< Args >()...)) >
|
||||
static std::true_type _check_invocable(int);
|
||||
static std::false_type _check_invocable(...);
|
||||
|
||||
typedef decltype(is_invocable_impl::_check_invocable(0)) type;
|
||||
};
|
||||
|
||||
template< typename Func, typename... Args >
|
||||
struct is_invocable : public is_invocable_impl< Func, Args... >::type { };
|
||||
|
||||
} // namespace test
|
||||
|
||||
#endif
|
||||
|
||||
int g_n = 0;
|
||||
|
||||
void void_func()
|
||||
{
|
||||
++g_n;
|
||||
}
|
||||
|
||||
int int_func()
|
||||
{
|
||||
return ++g_n;
|
||||
}
|
||||
|
||||
int& int_ref_func()
|
||||
{
|
||||
++g_n;
|
||||
return g_n;
|
||||
}
|
||||
|
||||
void void_add1(int x)
|
||||
{
|
||||
g_n += x;
|
||||
}
|
||||
|
||||
int add2(int x, int y)
|
||||
{
|
||||
return x + y;
|
||||
}
|
||||
|
||||
namespace test_ns {
|
||||
|
||||
int add3(int x, int y, int z)
|
||||
{
|
||||
return x + y + z;
|
||||
}
|
||||
|
||||
} // namespace test_ns
|
||||
|
||||
int int_func_noexcept() noexcept
|
||||
{
|
||||
return ++g_n;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::core::functor< void_func > fun;
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< void_func >& >));
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< void_func > const& >));
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< void_func > const&, int >));
|
||||
BOOST_TEST_EQ(noexcept(fun()), false);
|
||||
fun();
|
||||
BOOST_TEST_EQ(g_n, 1);
|
||||
fun();
|
||||
BOOST_TEST_EQ(g_n, 2);
|
||||
}
|
||||
|
||||
g_n = 0;
|
||||
{
|
||||
boost::core::functor< int_func > fun;
|
||||
int res = fun();
|
||||
BOOST_TEST_EQ(res, 1);
|
||||
BOOST_TEST_EQ(g_n, 1);
|
||||
res = fun();
|
||||
BOOST_TEST_EQ(res, 2);
|
||||
BOOST_TEST_EQ(g_n, 2);
|
||||
}
|
||||
|
||||
g_n = 0;
|
||||
{
|
||||
boost::core::functor< int_ref_func > fun;
|
||||
int& res1 = fun();
|
||||
BOOST_TEST_EQ(&res1, &g_n);
|
||||
BOOST_TEST_EQ(res1, 1);
|
||||
int& res2 = fun();
|
||||
BOOST_TEST_EQ(&res2, &g_n);
|
||||
BOOST_TEST_EQ(res2, 2);
|
||||
}
|
||||
|
||||
g_n = 0;
|
||||
{
|
||||
boost::core::functor< void_add1 > fun;
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< void_add1 >& >));
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< void_add1 > const& >));
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< void_add1 >&, int >));
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< void_add1 > const&, int >));
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< void_add1 >&, short int >));
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< void_add1 > const&, short int >));
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< void_add1 > const&, int, int >));
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< void_add1 > const&, const char* >));
|
||||
fun(10);
|
||||
BOOST_TEST_EQ(g_n, 10);
|
||||
fun(20);
|
||||
BOOST_TEST_EQ(g_n, 30);
|
||||
}
|
||||
|
||||
{
|
||||
boost::core::functor< add2 > fun;
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< add2 >& >));
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< add2 > const& >));
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< add2 >&, int >));
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< add2 > const&, int >));
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< add2 >&, int, int >));
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< add2 > const&, int, int >));
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< add2 >&, short int, signed char >));
|
||||
BOOST_TEST_TRAIT_TRUE((test::is_invocable< boost::core::functor< add2 > const&, short int, signed char >));
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< add2 > const&, const char* >));
|
||||
BOOST_TEST_TRAIT_FALSE((test::is_invocable< boost::core::functor< add2 > const&, const char*, float >));
|
||||
int res = fun(10, 20);
|
||||
BOOST_TEST_EQ(res, 30);
|
||||
res = fun(30, 40);
|
||||
BOOST_TEST_EQ(res, 70);
|
||||
}
|
||||
|
||||
{
|
||||
boost::core::functor< test_ns::add3 > fun;
|
||||
int res = fun(10, 20, 30);
|
||||
BOOST_TEST_EQ(res, 60);
|
||||
res = fun(40, 50, 60);
|
||||
BOOST_TEST_EQ(res, 150);
|
||||
}
|
||||
|
||||
g_n = 0;
|
||||
{
|
||||
boost::core::functor< int_func_noexcept > fun;
|
||||
BOOST_TEST_EQ(noexcept(fun()), true);
|
||||
int res = fun();
|
||||
BOOST_TEST_EQ(res, 1);
|
||||
BOOST_TEST_EQ(g_n, 1);
|
||||
res = fun();
|
||||
BOOST_TEST_EQ(res, 2);
|
||||
BOOST_TEST_EQ(g_n, 2);
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#else // !defined(BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS)
|
||||
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
|
||||
BOOST_PRAGMA_MESSAGE("Test skipped because C++17 auto non-type template parameters are not supported")
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS)
|
||||
38
test/minstd_rand_test.cpp
Normal file
38
test/minstd_rand_test.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// Test for boost/core/detail/minstd_rand.hpp
|
||||
//
|
||||
// Copyright 2022, 2024 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/detail/minstd_rand.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::detail::minstd_rand rng;
|
||||
|
||||
boost::uint_least32_t r1 = rng(), x1 = 48271;
|
||||
BOOST_TEST_EQ( r1, x1 );
|
||||
|
||||
for( int i = 0; i < 1000; ++i ) rng();
|
||||
|
||||
boost::uint_least32_t r2 = rng(), x2 = 2076422031;
|
||||
BOOST_TEST_EQ( r2, x2 );
|
||||
}
|
||||
|
||||
{
|
||||
boost::detail::minstd_rand rng( 12345 );
|
||||
|
||||
boost::uint_least32_t r1 = rng(), x1 = 595905495;
|
||||
BOOST_TEST_EQ( r1, x1 );
|
||||
|
||||
for( int i = 0; i < 1000; ++i ) rng();
|
||||
|
||||
boost::uint_least32_t r2 = rng(), x2 = 1065162103;
|
||||
BOOST_TEST_EQ( r2, x2 );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
30
test/null_deleter_compile_fail_adl.cpp
Normal file
30
test/null_deleter_compile_fail_adl.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2024.
|
||||
* 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 fclose_deleter_compile_fail_adl.cpp
|
||||
* \author Andrey Semashev
|
||||
* \date 02.02.2024
|
||||
*
|
||||
* This file tests that \c boost::null_deleter doesn't bring namespace
|
||||
* \c boost into ADL.
|
||||
*/
|
||||
|
||||
#include <boost/core/null_deleter.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
void check_adl(null_deleter const&)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
int main()
|
||||
{
|
||||
// Must not find boost::check_adl
|
||||
check_adl(boost::null_deleter());
|
||||
}
|
||||
31
test/pointer_in_range_constexpr_test.cpp
Normal file
31
test/pointer_in_range_constexpr_test.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright 2024 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#include <boost/core/pointer_in_range.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#if !defined(BOOST_CORE_NO_CONSTEXPR_POINTER_IN_RANGE)
|
||||
int a[4] = { 0, 0, 0, 0 };
|
||||
int n = 0;
|
||||
const int b[4] = { 0, 0, 0, 0 };
|
||||
const int m = 0;
|
||||
|
||||
BOOST_STATIC_ASSERT(!boost::pointer_in_range(&a[0], &a[1], a + 4));
|
||||
BOOST_STATIC_ASSERT(boost::pointer_in_range(&a[1], &a[1], a + 4));
|
||||
BOOST_STATIC_ASSERT(boost::pointer_in_range(&a[2], &a[1], a + 4));
|
||||
BOOST_STATIC_ASSERT(boost::pointer_in_range(&a[3], &a[1], a + 4));
|
||||
BOOST_STATIC_ASSERT(!boost::pointer_in_range(a + 4, &a[1], a + 4));
|
||||
BOOST_STATIC_ASSERT(!boost::pointer_in_range(&n, &a[0], &a[3]));
|
||||
BOOST_STATIC_ASSERT(!boost::pointer_in_range(&m, &a[0], &a[3]));
|
||||
BOOST_STATIC_ASSERT(!boost::pointer_in_range(&b[0], &b[1], b + 4));
|
||||
BOOST_STATIC_ASSERT(boost::pointer_in_range(&b[1], &b[1], b + 4));
|
||||
BOOST_STATIC_ASSERT(boost::pointer_in_range(&b[2], &b[1], b + 4));
|
||||
BOOST_STATIC_ASSERT(boost::pointer_in_range(&b[3], &b[1], b + 4));
|
||||
BOOST_STATIC_ASSERT(!boost::pointer_in_range(b + 4, &b[1], b + 4));
|
||||
BOOST_STATIC_ASSERT(!boost::pointer_in_range(&n, &b[0], &b[3]));
|
||||
BOOST_STATIC_ASSERT(!boost::pointer_in_range(&m, &b[0], &b[3]));
|
||||
#endif
|
||||
32
test/pointer_in_range_test.cpp
Normal file
32
test/pointer_in_range_test.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
Copyright 2024 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#include <boost/core/pointer_in_range.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int a[4] = { 0, 0, 0, 0 };
|
||||
int n = 0;
|
||||
const int b[4] = { 0, 0, 0, 0 };
|
||||
const int m = 0;
|
||||
BOOST_TEST(!boost::pointer_in_range(&a[0], &a[1], a + 4));
|
||||
BOOST_TEST(boost::pointer_in_range(&a[1], &a[1], a + 4));
|
||||
BOOST_TEST(boost::pointer_in_range(&a[2], &a[1], a + 4));
|
||||
BOOST_TEST(boost::pointer_in_range(&a[3], &a[1], a + 4));
|
||||
BOOST_TEST(!boost::pointer_in_range(a + 4, &a[1], a + 4));
|
||||
BOOST_TEST(!boost::pointer_in_range(&n, &a[0], &a[3]));
|
||||
BOOST_TEST(!boost::pointer_in_range(&m, &a[0], &a[3]));
|
||||
BOOST_TEST(!boost::pointer_in_range(&b[0], &b[1], b + 4));
|
||||
BOOST_TEST(boost::pointer_in_range(&b[1], &b[1], b + 4));
|
||||
BOOST_TEST(boost::pointer_in_range(&b[2], &b[1], b + 4));
|
||||
BOOST_TEST(boost::pointer_in_range(&b[3], &b[1], b + 4));
|
||||
BOOST_TEST(!boost::pointer_in_range(b + 4, &b[1], b + 4));
|
||||
BOOST_TEST(!boost::pointer_in_range(&n, &b[0], &b[3]));
|
||||
BOOST_TEST(!boost::pointer_in_range(&m, &b[0], &b[3]));
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -4,6 +4,18 @@
|
||||
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
|
||||
# if defined(__apple_build_version__)
|
||||
// Under macOS, it's possible for the header
|
||||
// <memory_resource> to be present, but for
|
||||
// libc++.dylib to not have support for it.
|
||||
// https://github.com/boostorg/core/issues/162
|
||||
# define BOOST_NO_CXX17_HDR_MEMORY_RESOURCE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||
|
||||
147
test/sv_construct_test_cx.cpp
Normal file
147
test/sv_construct_test_cx.cpp
Normal file
@@ -0,0 +1,147 @@
|
||||
// Copyright 2021, 2024 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX14_CONSTEXPR)
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_NO_CXX14_CONSTEXPR is defined" )
|
||||
int main() {}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||
# include <string_view>
|
||||
#endif
|
||||
|
||||
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
constexpr boost::core::string_view sv;
|
||||
|
||||
STATIC_ASSERT( sv.data() == nullptr );
|
||||
STATIC_ASSERT( sv.size() == 0 );
|
||||
|
||||
STATIC_ASSERT( sv.begin() == sv.data() );
|
||||
STATIC_ASSERT( sv.end() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.cbegin() == sv.data() );
|
||||
STATIC_ASSERT( sv.cend() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.length() == sv.size() );
|
||||
STATIC_ASSERT( sv.empty() == ( sv.size() == 0 ) );
|
||||
|
||||
STATIC_ASSERT( sv.max_size() == boost::core::string_view::npos );
|
||||
}
|
||||
|
||||
{
|
||||
constexpr char const* s = "123";
|
||||
|
||||
constexpr boost::core::string_view sv( s, 0 );
|
||||
|
||||
STATIC_ASSERT( sv.data() == s );
|
||||
STATIC_ASSERT( sv.size() == 0 );
|
||||
|
||||
STATIC_ASSERT( sv.begin() == sv.data() );
|
||||
STATIC_ASSERT( sv.end() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.cbegin() == sv.data() );
|
||||
STATIC_ASSERT( sv.cend() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.length() == sv.size() );
|
||||
STATIC_ASSERT( sv.empty() == ( sv.size() == 0 ) );
|
||||
|
||||
STATIC_ASSERT( sv.max_size() == boost::core::string_view::npos );
|
||||
}
|
||||
|
||||
{
|
||||
constexpr char const* s = "123";
|
||||
|
||||
constexpr boost::core::string_view sv( s, 2 );
|
||||
|
||||
STATIC_ASSERT( sv.data() == s );
|
||||
STATIC_ASSERT( sv.size() == 2 );
|
||||
|
||||
STATIC_ASSERT( sv.begin() == sv.data() );
|
||||
STATIC_ASSERT( sv.end() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.cbegin() == sv.data() );
|
||||
STATIC_ASSERT( sv.cend() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.length() == sv.size() );
|
||||
STATIC_ASSERT( sv.empty() == ( sv.size() == 0 ) );
|
||||
|
||||
STATIC_ASSERT( sv.max_size() == boost::core::string_view::npos );
|
||||
}
|
||||
|
||||
{
|
||||
constexpr char const* s = "123";
|
||||
|
||||
constexpr boost::core::string_view sv( s, s );
|
||||
|
||||
STATIC_ASSERT( sv.data() == s );
|
||||
STATIC_ASSERT( sv.size() == 0 );
|
||||
|
||||
STATIC_ASSERT( sv.begin() == sv.data() );
|
||||
STATIC_ASSERT( sv.end() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.cbegin() == sv.data() );
|
||||
STATIC_ASSERT( sv.cend() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.length() == sv.size() );
|
||||
STATIC_ASSERT( sv.empty() == ( sv.size() == 0 ) );
|
||||
|
||||
STATIC_ASSERT( sv.max_size() == boost::core::string_view::npos );
|
||||
}
|
||||
|
||||
{
|
||||
constexpr char const* s = "123";
|
||||
|
||||
constexpr boost::core::string_view sv( s, s + 2 );
|
||||
|
||||
STATIC_ASSERT( sv.data() == s );
|
||||
STATIC_ASSERT( sv.size() == 2 );
|
||||
|
||||
STATIC_ASSERT( sv.begin() == sv.data() );
|
||||
STATIC_ASSERT( sv.end() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.cbegin() == sv.data() );
|
||||
STATIC_ASSERT( sv.cend() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.length() == sv.size() );
|
||||
STATIC_ASSERT( sv.empty() == ( sv.size() == 0 ) );
|
||||
|
||||
STATIC_ASSERT( sv.max_size() == boost::core::string_view::npos );
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||
|
||||
{
|
||||
constexpr std::string_view str( "123", 3 );
|
||||
|
||||
constexpr boost::core::string_view sv( str );
|
||||
|
||||
STATIC_ASSERT( sv.data() == str.data() );
|
||||
STATIC_ASSERT( sv.size() == str.size() );
|
||||
|
||||
STATIC_ASSERT( sv.begin() == sv.data() );
|
||||
STATIC_ASSERT( sv.end() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.cbegin() == sv.data() );
|
||||
STATIC_ASSERT( sv.cend() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.length() == sv.size() );
|
||||
STATIC_ASSERT( sv.empty() == ( sv.size() == 0 ) );
|
||||
|
||||
STATIC_ASSERT( sv.max_size() == boost::core::string_view::npos );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
75
test/sv_construct_test_cx2.cpp
Normal file
75
test/sv_construct_test_cx2.cpp
Normal file
@@ -0,0 +1,75 @@
|
||||
// Copyright 2021, 2024 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX14_CONSTEXPR)
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_NO_CXX14_CONSTEXPR is defined" )
|
||||
int main() {}
|
||||
|
||||
#elif BOOST_CXX_VERSION < 201703L
|
||||
|
||||
// std::char_traits is not constexpr in C++14
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_CXX_VERSION < 201703L" )
|
||||
int main() {}
|
||||
|
||||
#elif defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 70300
|
||||
|
||||
// std::char_traits is not constexpr in libstdc++ 7.2
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_LIBSTDCXX_VERSION < 70300" )
|
||||
int main() {}
|
||||
|
||||
#else
|
||||
|
||||
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
constexpr char const* s = "";
|
||||
|
||||
constexpr boost::core::string_view sv( s );
|
||||
|
||||
STATIC_ASSERT( sv.data() == s );
|
||||
STATIC_ASSERT( sv.size() == 0 );
|
||||
|
||||
STATIC_ASSERT( sv.begin() == sv.data() );
|
||||
STATIC_ASSERT( sv.end() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.cbegin() == sv.data() );
|
||||
STATIC_ASSERT( sv.cend() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.length() == sv.size() );
|
||||
STATIC_ASSERT( sv.empty() == ( sv.size() == 0 ) );
|
||||
|
||||
STATIC_ASSERT( sv.max_size() == boost::core::string_view::npos );
|
||||
}
|
||||
|
||||
{
|
||||
constexpr char const* s = "123";
|
||||
|
||||
constexpr boost::core::string_view sv( s );
|
||||
|
||||
STATIC_ASSERT( sv.data() == s );
|
||||
STATIC_ASSERT( sv.size() == 3 );
|
||||
|
||||
STATIC_ASSERT( sv.begin() == sv.data() );
|
||||
STATIC_ASSERT( sv.end() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.cbegin() == sv.data() );
|
||||
STATIC_ASSERT( sv.cend() == sv.data() + sv.size() );
|
||||
|
||||
STATIC_ASSERT( sv.length() == sv.size() );
|
||||
STATIC_ASSERT( sv.empty() == ( sv.size() == 0 ) );
|
||||
|
||||
STATIC_ASSERT( sv.max_size() == boost::core::string_view::npos );
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -4,6 +4,18 @@
|
||||
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
|
||||
# if defined(__apple_build_version__)
|
||||
// Under macOS, it's possible for the header
|
||||
// <memory_resource> to be present, but for
|
||||
// libc++.dylib to not have support for it.
|
||||
// https://github.com/boostorg/core/issues/162
|
||||
# define BOOST_NO_CXX17_HDR_MEMORY_RESOURCE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||
# include <string_view>
|
||||
|
||||
@@ -4,6 +4,18 @@
|
||||
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
|
||||
# if defined(__apple_build_version__)
|
||||
// Under macOS, it's possible for the header
|
||||
// <memory_resource> to be present, but for
|
||||
// libc++.dylib to not have support for it.
|
||||
// https://github.com/boostorg/core/issues/162
|
||||
# define BOOST_NO_CXX17_HDR_MEMORY_RESOURCE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||
# include <string_view>
|
||||
|
||||
@@ -494,7 +494,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
@@ -503,22 +503,22 @@ int main()
|
||||
|
||||
std::string str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i );
|
||||
}
|
||||
@@ -538,22 +538,22 @@ int main()
|
||||
|
||||
std::wstring str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i );
|
||||
}
|
||||
|
||||
@@ -426,14 +426,14 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_first_of( needle ), i );
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_first_of( needle ), 255 - i );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
@@ -503,22 +503,22 @@ int main()
|
||||
|
||||
std::string str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_last_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_last_not_of( str3 ), 255 - i );
|
||||
}
|
||||
@@ -538,22 +538,22 @@ int main()
|
||||
|
||||
std::wstring str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i );
|
||||
}
|
||||
|
||||
@@ -444,14 +444,14 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_last_of( needle ), i );
|
||||
}
|
||||
|
||||
@@ -459,7 +459,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_last_of( needle ), 255 - i );
|
||||
}
|
||||
}
|
||||
|
||||
48
test/sv_hash_test.cpp
Normal file
48
test/sv_hash_test.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright 2021-2024 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <string>
|
||||
|
||||
template<class T> std::size_t hv( T const& t )
|
||||
{
|
||||
return boost::hash<T>()( t );
|
||||
}
|
||||
|
||||
template<class Ch> void test( Ch const* p )
|
||||
{
|
||||
std::basic_string<Ch> s( p );
|
||||
boost::core::basic_string_view<Ch> sv( s );
|
||||
|
||||
BOOST_TEST_EQ( hv( s ), hv( sv ) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test( "123" );
|
||||
test( L"123" );
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
|
||||
test( u"123" );
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR32_T)
|
||||
|
||||
test( U"123" );
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
|
||||
|
||||
test( u8"123" );
|
||||
|
||||
#endif
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -4,6 +4,18 @@
|
||||
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)
|
||||
# if defined(__apple_build_version__)
|
||||
// Under macOS, it's possible for the header
|
||||
// <memory_resource> to be present, but for
|
||||
// libc++.dylib to not have support for it.
|
||||
// https://github.com/boostorg/core/issues/162
|
||||
# define BOOST_NO_CXX17_HDR_MEMORY_RESOURCE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||
# include <string_view>
|
||||
|
||||
@@ -7,12 +7,8 @@
|
||||
# bring in rules for testing
|
||||
import testing ;
|
||||
|
||||
compile swap_root_header_1.cpp ;
|
||||
compile swap_root_header_2.cpp ;
|
||||
compile swap_lib_header_1.cpp ;
|
||||
compile swap_lib_header_2.cpp ;
|
||||
compile swap_mixed_headers_1.cpp ;
|
||||
compile swap_mixed_headers_2.cpp ;
|
||||
compile swap_noexcept.cpp ;
|
||||
|
||||
compile-fail swap_const_wrapper_fail.cpp ;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::swap.
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::core::invoke_swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -59,7 +59,7 @@ int main()
|
||||
ptr2[i].set_data( static_cast<int>(i + number_of_elements) );
|
||||
}
|
||||
|
||||
boost::swap(array1, array2);
|
||||
boost::core::invoke_swap(array1, array2);
|
||||
|
||||
for (std::size_t i = 0; i < number_of_elements; ++i)
|
||||
{
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of arrays of integers by means of boost::swap.
|
||||
// Tests swapping an array of arrays of integers by means of boost::core::invoke_swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -32,7 +32,7 @@ int main()
|
||||
ptr2[i] = static_cast<int>(i + number_of_elements);
|
||||
}
|
||||
|
||||
boost::swap(array1, array2);
|
||||
boost::core::invoke_swap(array1, array2);
|
||||
|
||||
for (std::size_t i = 0; i < number_of_elements; ++i)
|
||||
{
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::swap.
|
||||
// Tests swapping an array of arrays of swap_test_class objects by means of boost::core::invoke_swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -54,7 +54,7 @@ int main()
|
||||
std::copy(initial_array2, initial_array2 + array_size, array2);
|
||||
|
||||
swap_test_class::reset();
|
||||
boost::swap(array1, array2);
|
||||
boost::core::invoke_swap(array1, array2);
|
||||
|
||||
BOOST_CHECK(std::equal(array1, array1 + array_size, initial_array2));
|
||||
BOOST_CHECK(std::equal(array2, array2 + array_size, initial_array1));
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of integers by means of boost::swap.
|
||||
// Tests swapping an array of integers by means of boost::core::invoke_swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -27,7 +27,7 @@ int main()
|
||||
std::copy(initial_array1, initial_array1 + array_size, array1);
|
||||
std::copy(initial_array2, initial_array2 + array_size, array2);
|
||||
|
||||
boost::swap(array1, array2);
|
||||
boost::core::invoke_swap(array1, array2);
|
||||
|
||||
BOOST_CHECK(std::equal(array1, array1 + array_size, initial_array2));
|
||||
BOOST_CHECK(std::equal(array2, array2 + array_size, initial_array1));
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping an array of swap_test_template<int> objects by means of boost::swap.
|
||||
// Tests swapping an array of swap_test_template<int> objects by means of boost::core::invoke_swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -60,7 +60,7 @@ int main()
|
||||
std::copy(initial_array2, initial_array2 + array_size, array2);
|
||||
|
||||
swap_test_class::reset();
|
||||
boost::swap(array1, array2);
|
||||
boost::core::invoke_swap(array1, array2);
|
||||
|
||||
BOOST_CHECK(std::equal(array1, array1 + array_size, initial_array2));
|
||||
BOOST_CHECK(std::equal(array2, array2 + array_size, initial_array1));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2018 Andrzej Krzemieński
|
||||
// Copyright 2018 Andrzej Krzemieński
|
||||
// Copyright 2018 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/core/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -14,7 +14,7 @@ template<class T> struct Wrapper
|
||||
|
||||
template<class T> inline void swap( Wrapper<T> & w, Wrapper<T> & v )
|
||||
{
|
||||
boost::swap( w, v );
|
||||
boost::core::invoke_swap( w, v );
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
|
||||
// Tests that the swap header compiles as a standalone translation unit
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
// Tests that the swap header include guards work correctly
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// 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)
|
||||
|
||||
// Tests that the swap headers work when both are included
|
||||
|
||||
#include <boost/swap.hpp>
|
||||
#include <boost/utility/swap.hpp>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// 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)
|
||||
|
||||
// Tests that the swap headers work when both are included
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// boost::swap internally does an unqualified function call to swap.
|
||||
// boost::core::invoke_swap internally does an unqualified function call to swap.
|
||||
// This could have led to ambiguity or infinite recursion, when the
|
||||
// objects to be swapped would themselves be from the boost namespace.
|
||||
// If so, boost::swap itself might be found by argument dependent lookup.
|
||||
// The implementation of boost::swap resolves this issue by giving
|
||||
// boost::swap two template argumetns, thereby making it less specialized
|
||||
// If so, boost::core::invoke_swap itself might be found by argument dependent lookup.
|
||||
// The implementation of boost::core::invoke_swap resolves this issue by giving
|
||||
// boost::core::invoke_swap two template argumetns, thereby making it less specialized
|
||||
// than std::swap.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -33,7 +33,7 @@ int main()
|
||||
boost::swap_test_class object2 = initial_value2;
|
||||
|
||||
boost::swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests that boost::swap propagates noexcept specification correctly
|
||||
// Tests that boost::core::invoke_swap propagates noexcept specification correctly
|
||||
|
||||
#include <boost/core/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_CXX11_STATIC_ASSERT) && \
|
||||
@@ -34,9 +34,9 @@ struct class_with_except_swap
|
||||
|
||||
} // namespace test_ns
|
||||
|
||||
static_assert(noexcept(boost::swap(test_ns::class_with_noexcept_swap::instance(), test_ns::class_with_noexcept_swap::instance())),
|
||||
"boost::swap for class_with_noexcept_swap should have noexcept specification");
|
||||
static_assert(!noexcept(boost::swap(test_ns::class_with_except_swap::instance(), test_ns::class_with_except_swap::instance())),
|
||||
"boost::swap for class_with_except_swap should not have noexcept specification");
|
||||
static_assert(noexcept(boost::core::invoke_swap(test_ns::class_with_noexcept_swap::instance(), test_ns::class_with_noexcept_swap::instance())),
|
||||
"boost::core::invoke_swap for class_with_noexcept_swap should have noexcept specification");
|
||||
static_assert(!noexcept(boost::core::invoke_swap(test_ns::class_with_except_swap::instance(), test_ns::class_with_except_swap::instance())),
|
||||
"boost::core::invoke_swap for class_with_except_swap should not have noexcept specification");
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_CXX11_STATIC_ASSERT) ...
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -14,7 +14,7 @@ int main()
|
||||
int object1 = 1;
|
||||
int object2 = 2;
|
||||
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1,2);
|
||||
BOOST_CHECK_EQUAL(object2,1);
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// 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)
|
||||
|
||||
// Tests that the swap header compiles as a standalone translation unit
|
||||
|
||||
#include <boost/swap.hpp>
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
// Copyright (c) 2007 Joseph Gauterin
|
||||
//
|
||||
// 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)
|
||||
|
||||
// Tests that the swap header include guards work correctly
|
||||
|
||||
#include <boost/swap.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -33,7 +33,7 @@ int main()
|
||||
boost::swap_test_class object2 = initial_value2;
|
||||
|
||||
boost::swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// properly swapped, when both boost and the other namespace have a custom
|
||||
// swap function for that class. Note that it shouldn't be necessary for a class
|
||||
// in an other namespace to have a custom swap function in boost, because the
|
||||
// boost::swap utility should find the swap function in the other namespace, by
|
||||
// argument dependent lookup (ADL). Unfortunately ADL isn't fully implemented
|
||||
// by some specific compiler versions, including Intel C++ 8.1, MSVC 7.1, and
|
||||
// Borland 5.9.3. Users of those compilers might consider adding a swap overload
|
||||
// boost::core::invoke_swap utility should find the swap function in the other
|
||||
// namespace, by argument dependent lookup (ADL). Unfortunately ADL isn't fully
|
||||
// implemented by some specific compiler versions, including Intel C++ 8.1, MSVC 7.1,
|
||||
// and Borland 5.9.3. Users of those compilers might consider adding a swap overload
|
||||
// to the boost namespace.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -52,7 +52,7 @@ int main()
|
||||
other::swap_test_class object2 = initial_value2;
|
||||
|
||||
other::swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -27,7 +27,7 @@ int main()
|
||||
swap_test_class object2 = initial_value2;
|
||||
|
||||
swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -33,7 +33,7 @@ int main()
|
||||
other::swap_test_class object2 = initial_value2;
|
||||
|
||||
other::swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -32,7 +32,7 @@ int main()
|
||||
swap_test_class object2 = initial_value2;
|
||||
|
||||
swap_test_class::reset();
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK(object1 == initial_value2);
|
||||
BOOST_CHECK(object2 == initial_value1);
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::bitset<T> objects by means of boost::swap.
|
||||
// Tests swapping std::bitset<T> objects by means of boost::core::invoke_swap.
|
||||
// Unlike most other Standard C++ Library template classes,
|
||||
// std::bitset<T> does not have its own std::swap overload.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -24,7 +24,7 @@ int main()
|
||||
bitset_type object1 = initial_value1;
|
||||
bitset_type object2 = initial_value2;
|
||||
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::time_base::dateorder objects by means of boost::swap.
|
||||
// Tests swapping std::time_base::dateorder objects by means of boost::core::invoke_swap.
|
||||
// std::time_base::dateorder is an enumerated type. It does not have an
|
||||
// std::swap overload or template specialization.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -23,7 +23,7 @@ int main()
|
||||
std::time_base::dateorder object1 = initial_value1;
|
||||
std::time_base::dateorder object2 = initial_value2;
|
||||
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::string objects by means of boost::swap.
|
||||
// Tests swapping std::string objects by means of boost::core::invoke_swap.
|
||||
// std::string has its own std::swap overload.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -22,7 +22,7 @@ int main()
|
||||
std::string object1 = initial_value1;
|
||||
std::string object2 = initial_value2;
|
||||
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(object2,initial_value1);
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::type_info pointers by means of boost::swap.
|
||||
// Tests swapping std::type_info pointers by means of boost::core::invoke_swap.
|
||||
// There is no std::swap overload or template specialization
|
||||
// for std::type_info pointers.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -23,7 +23,7 @@ int main()
|
||||
const std::type_info * ptr1 = initial_value1;
|
||||
const std::type_info * ptr2 = initial_value2;
|
||||
|
||||
boost::swap(ptr1,ptr2);
|
||||
boost::core::invoke_swap(ptr1,ptr2);
|
||||
|
||||
BOOST_CHECK_EQUAL(ptr1,initial_value2);
|
||||
BOOST_CHECK_EQUAL(ptr2,initial_value1);
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::vector objects by means of boost::swap,
|
||||
// Tests swapping std::vector objects by means of boost::core::invoke_swap,
|
||||
// having boost::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -45,7 +45,7 @@ int main()
|
||||
|
||||
swap_test_class_type::reset();
|
||||
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1.size(),initial_size2);
|
||||
BOOST_CHECK_EQUAL(object2.size(),initial_size1);
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::vector objects by means of boost::swap,
|
||||
// Tests swapping std::vector objects by means of boost::core::invoke_swap,
|
||||
// having ::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -38,7 +38,7 @@ int main()
|
||||
|
||||
swap_test_class::reset();
|
||||
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1.size(),initial_size2);
|
||||
BOOST_CHECK_EQUAL(object2.size(),initial_size1);
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Tests swapping std::vector objects by means of boost::swap,
|
||||
// Tests swapping std::vector objects by means of boost::core::invoke_swap,
|
||||
// having other::swap_test_class as vector element type.
|
||||
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#define BOOST_CHECK BOOST_TEST
|
||||
#define BOOST_CHECK_EQUAL BOOST_TEST_EQ
|
||||
@@ -45,7 +45,7 @@ int main()
|
||||
|
||||
swap_test_class_type::reset();
|
||||
|
||||
boost::swap(object1,object2);
|
||||
boost::core::invoke_swap(object1,object2);
|
||||
|
||||
BOOST_CHECK_EQUAL(object1.size(),initial_size2);
|
||||
BOOST_CHECK_EQUAL(object2.size(),initial_size1);
|
||||
|
||||
@@ -55,6 +55,13 @@ template<class T1, class T2> struct X
|
||||
|
||||
template<class T1, class T2> struct Y;
|
||||
|
||||
class W
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void f() = 0;
|
||||
};
|
||||
|
||||
enum E1
|
||||
{
|
||||
e1
|
||||
@@ -122,6 +129,7 @@ int main()
|
||||
TEST(A);
|
||||
TEST(B);
|
||||
TEST(C);
|
||||
TEST(W);
|
||||
|
||||
TEST(E1);
|
||||
|
||||
@@ -143,6 +151,9 @@ int main()
|
||||
TEST(C&);
|
||||
TEST(C const&);
|
||||
|
||||
TEST(W const);
|
||||
TEST(W&);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
TEST(B&&);
|
||||
@@ -156,6 +167,8 @@ int main()
|
||||
TEST(C*);
|
||||
TEST(C const* volatile*);
|
||||
|
||||
TEST(W volatile*);
|
||||
|
||||
TEST(void*);
|
||||
TEST(void const* volatile*);
|
||||
|
||||
@@ -307,6 +320,8 @@ int main()
|
||||
|
||||
TEST(std::pair<C, C>);
|
||||
|
||||
TEST(std::pair<W, W>);
|
||||
|
||||
TEST(std::pair<void, void>);
|
||||
TEST(std::pair<std::pair<void, void>, void>);
|
||||
|
||||
@@ -336,9 +351,11 @@ int main()
|
||||
TEST(X<A const&, B&> volatile&);
|
||||
|
||||
TEST(X<C, C>);
|
||||
TEST(X<W, W>);
|
||||
|
||||
TEST(Y<A, B>);
|
||||
TEST(Y<C, C>);
|
||||
TEST(Y<W, W>);
|
||||
|
||||
TEST(X<std::pair<void, void>, void>);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user