forked from boostorg/core
Compare commits
158 Commits
develop
...
feature/pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c95750f37 | ||
|
|
a9f1407d84 | ||
|
|
db0fd77af1 | ||
|
|
7cbbb08e7b | ||
|
|
ba6360e8ed | ||
|
|
2a70a0f239 | ||
|
|
31a2f7fb6b | ||
|
|
0120dbfe65 | ||
|
|
5f6fe65eb2 | ||
|
|
c7134904e2 | ||
|
|
9fc2a2f1ac | ||
|
|
216999e552 | ||
|
|
66890c3f3d | ||
|
|
8d6d20059a | ||
|
|
ee596e3d37 | ||
|
|
de8fe4fad7 | ||
|
|
d4db3eccec | ||
|
|
3b96d237c0 | ||
|
|
0e71b6158d | ||
|
|
23ef6d3531 | ||
|
|
e088fb8929 | ||
|
|
57151ab82e | ||
|
|
992326b1c8 | ||
|
|
4e769d1cdd | ||
|
|
bf17035a2d | ||
|
|
5a3b4df5de | ||
|
|
85527c4045 | ||
|
|
7ab05d5de0 | ||
|
|
266fbe6449 | ||
|
|
fd0de5f538 | ||
|
|
350526f7c7 | ||
|
|
06fef712c9 | ||
|
|
b7f7eb4f90 | ||
|
|
f41b8f38c4 | ||
|
|
b591214103 | ||
|
|
6b9f0cbf57 | ||
|
|
ecee9257d5 | ||
|
|
6c7edac9b1 | ||
|
|
049d3447ca | ||
|
|
b2fe98edf8 | ||
|
|
42c8898d24 | ||
|
|
f2eab6d6ff | ||
|
|
36fa78f53c | ||
|
|
97606908b7 | ||
|
|
5eb54d1d36 | ||
|
|
c91f8fabff | ||
|
|
5904fb5636 | ||
|
|
39978bde2b | ||
|
|
d5fa9ae50f | ||
|
|
2814b4ca1c | ||
|
|
c4e420f69d | ||
|
|
94628cb2f9 | ||
|
|
19f9aa93e1 | ||
|
|
2691efd1ca | ||
|
|
b6b1498275 | ||
|
|
379899ef15 | ||
|
|
3ab949d321 | ||
|
|
dbf0ea98b9 | ||
|
|
5afc91d52d | ||
|
|
f2a1532105 | ||
|
|
64e59db1f6 | ||
|
|
ceb4fff8fc | ||
|
|
0be25e19cc | ||
|
|
6debbeb377 | ||
|
|
4b859e3d39 | ||
|
|
38037b45f1 | ||
|
|
7664d7ab7e | ||
|
|
20d89b69db | ||
|
|
89c5a78129 | ||
|
|
249c5bece2 | ||
|
|
8977da6f50 | ||
|
|
edc0d935c0 | ||
|
|
7736b0b8ce | ||
|
|
90231ed7e0 | ||
|
|
1aa287e413 | ||
|
|
8c65a5b0e8 | ||
|
|
99515c341e | ||
|
|
42b3a3f111 | ||
|
|
c092532a71 | ||
|
|
f6193acbdf | ||
|
|
a504b356d4 | ||
|
|
bd1835f92f | ||
|
|
bfad92e307 | ||
|
|
ce93055f03 | ||
|
|
39cf1e65a3 | ||
|
|
3edd3aa982 | ||
|
|
c704d8b630 | ||
|
|
579a658129 | ||
|
|
4c7f35613e | ||
|
|
642a0cf70e | ||
|
|
ece7a9ad9c | ||
|
|
5632ee0367 | ||
|
|
8052abb15c | ||
|
|
d3ed836f75 | ||
|
|
c4777c309e | ||
|
|
2b3b97c633 | ||
|
|
ab455ab2f8 | ||
|
|
116c6830e0 | ||
|
|
d8cfc71073 | ||
|
|
dd85ed565e | ||
|
|
58fd395c51 | ||
|
|
992824c50b | ||
|
|
9d443cb094 | ||
|
|
7d67301bba | ||
|
|
e487fec094 | ||
|
|
0890785fec | ||
|
|
eda68d4086 | ||
|
|
8a8738a981 | ||
|
|
99f9654f18 | ||
|
|
1e84baeea3 | ||
|
|
1825265014 | ||
|
|
8caca51c4d | ||
|
|
2d302c1666 | ||
|
|
6299da9273 | ||
|
|
843e0f7bb0 | ||
|
|
ddc6cc25a9 | ||
|
|
86bf1d4aec | ||
|
|
75c765cc13 | ||
|
|
2286749f97 | ||
|
|
23fa5d30f3 | ||
|
|
d428335758 | ||
|
|
be8790115c | ||
|
|
2778c5cca6 | ||
|
|
d5b7c3c0dc | ||
|
|
db916e4673 | ||
|
|
3eaba7afc0 | ||
|
|
ad20fadde7 | ||
|
|
a67ec1f75c | ||
|
|
5e95d28eb6 | ||
|
|
65377a2e13 | ||
|
|
b407b5d87d | ||
|
|
013c7856ce | ||
|
|
1c79871f0f | ||
|
|
09f2aa123a | ||
|
|
9cbf3ac420 | ||
|
|
fd615f3bfe | ||
|
|
a7f76af262 | ||
|
|
860eed6baf | ||
|
|
66a742f41e | ||
|
|
2cc3e23447 | ||
|
|
00f4f11f14 | ||
|
|
3510f6244b | ||
|
|
89852794ca | ||
|
|
0ac87736f8 | ||
|
|
1fa592c9ec | ||
|
|
162a4e1d24 | ||
|
|
68f8f36b04 | ||
|
|
6fb57488a2 | ||
|
|
414dfb4668 | ||
|
|
1b3a907394 | ||
|
|
ab23246301 | ||
|
|
48bc47cce2 | ||
|
|
e3745b2072 | ||
|
|
4162dbed57 | ||
|
|
38937b0fa3 | ||
|
|
8503c536dc | ||
|
|
7100c05490 | ||
|
|
003c7365bc |
390
.drone.jsonnet
Normal file
390
.drone.jsonnet
Normal file
@@ -0,0 +1,390 @@
|
|||||||
|
# Copyright 2022 Peter Dimov
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
local library = "core";
|
||||||
|
|
||||||
|
local triggers =
|
||||||
|
{
|
||||||
|
branch: [ "master", "develop", "feature/*" ]
|
||||||
|
};
|
||||||
|
|
||||||
|
local ubsan = { UBSAN: '1', UBSAN_OPTIONS: 'print_stacktrace=1' };
|
||||||
|
local asan = { ASAN: '1' };
|
||||||
|
|
||||||
|
local linux_pipeline(name, image, environment, packages = "", sources = [], arch = "amd64") =
|
||||||
|
{
|
||||||
|
name: name,
|
||||||
|
kind: "pipeline",
|
||||||
|
type: "docker",
|
||||||
|
trigger: triggers,
|
||||||
|
platform:
|
||||||
|
{
|
||||||
|
os: "linux",
|
||||||
|
arch: arch
|
||||||
|
},
|
||||||
|
steps:
|
||||||
|
[
|
||||||
|
{
|
||||||
|
name: "everything",
|
||||||
|
image: image,
|
||||||
|
environment: environment,
|
||||||
|
commands:
|
||||||
|
[
|
||||||
|
'set -e',
|
||||||
|
'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 []) +
|
||||||
|
(if packages != "" then [ 'apt-get update', 'apt-get -y install ' + packages ] else []) +
|
||||||
|
[
|
||||||
|
'export LIBRARY=' + library,
|
||||||
|
'./.drone/drone.sh',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
local macos_pipeline(name, environment, xcode_version = "12.2", osx_version = "catalina", arch = "amd64") =
|
||||||
|
{
|
||||||
|
name: name,
|
||||||
|
kind: "pipeline",
|
||||||
|
type: "exec",
|
||||||
|
trigger: triggers,
|
||||||
|
platform: {
|
||||||
|
"os": "darwin",
|
||||||
|
"arch": arch
|
||||||
|
},
|
||||||
|
node: {
|
||||||
|
"os": osx_version
|
||||||
|
},
|
||||||
|
steps: [
|
||||||
|
{
|
||||||
|
name: "everything",
|
||||||
|
environment: environment + { "DEVELOPER_DIR": "/Applications/Xcode-" + xcode_version + ".app/Contents/Developer" },
|
||||||
|
commands:
|
||||||
|
[
|
||||||
|
'export LIBRARY=' + library,
|
||||||
|
'./.drone/drone.sh',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||||
|
{
|
||||||
|
name: name,
|
||||||
|
kind: "pipeline",
|
||||||
|
type: "docker",
|
||||||
|
trigger: triggers,
|
||||||
|
platform:
|
||||||
|
{
|
||||||
|
os: "windows",
|
||||||
|
arch: arch
|
||||||
|
},
|
||||||
|
"steps":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
name: "everything",
|
||||||
|
image: image,
|
||||||
|
environment: environment,
|
||||||
|
commands:
|
||||||
|
[
|
||||||
|
'cmd /C .drone\\\\drone.bat ' + library,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
[
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 14.04 GCC 4.4",
|
||||||
|
"cppalliance/droneubuntu1404: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",
|
||||||
|
{ 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",
|
||||||
|
{ 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",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11', ADDRMD: '32,64' },
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 14.04 GCC 4.9 32/64",
|
||||||
|
"cppalliance/droneubuntu1404:1",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++-4.9', CXXSTD: '03,11', ADDRMD: '32,64' },
|
||||||
|
"g++-4.9-multilib",
|
||||||
|
[ "ppa:ubuntu-toolchain-r/test" ],
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 16.04 GCC 5* 32/64",
|
||||||
|
"cppalliance/droneubuntu1604:1",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14', ADDRMD: '32,64' },
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 18.04 GCC 6 32/64",
|
||||||
|
"cppalliance/droneubuntu1804:1",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++-6', CXXSTD: '03,11,14', ADDRMD: '32,64' },
|
||||||
|
"g++-6-multilib",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 18.04 GCC 7* 32/64",
|
||||||
|
"cppalliance/droneubuntu1804:1",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17', ADDRMD: '32,64' },
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 18.04 GCC 8 32/64",
|
||||||
|
"cppalliance/droneubuntu1804:1",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++-8', CXXSTD: '03,11,14,17', ADDRMD: '32,64' },
|
||||||
|
"g++-8-multilib",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 GCC 9* 32/64",
|
||||||
|
"cppalliance/droneubuntu2004:1",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a', ADDRMD: '32,64' },
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 GCC 9* ARM64",
|
||||||
|
"cppalliance/droneubuntu2004:multiarch",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a' },
|
||||||
|
arch="arm64",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 GCC 9* S390x",
|
||||||
|
"cppalliance/droneubuntu2004:multiarch",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a' },
|
||||||
|
arch="s390x",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 GCC 10 32/64",
|
||||||
|
"cppalliance/droneubuntu2004:1",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++-10', CXXSTD: '03,11,14,17,20', ADDRMD: '32,64' },
|
||||||
|
"g++-10-multilib",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 22.04 GCC 11* 32/64",
|
||||||
|
"cppalliance/droneubuntu2204:1",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a', ADDRMD: '32,64' },
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 22.04 GCC 12 32 ASAN",
|
||||||
|
"cppalliance/droneubuntu2204:1",
|
||||||
|
{ TOOLSET: 'gcc', COMPILER: 'g++-12', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan,
|
||||||
|
"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_pipeline(
|
||||||
|
"Linux 16.04 Clang 3.5",
|
||||||
|
"cppalliance/droneubuntu1604:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-3.5', CXXSTD: '03,11' },
|
||||||
|
"clang-3.5",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 16.04 Clang 3.6",
|
||||||
|
"cppalliance/droneubuntu1604:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-3.6', CXXSTD: '03,11,14' },
|
||||||
|
"clang-3.6",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 16.04 Clang 3.7",
|
||||||
|
"cppalliance/droneubuntu1604:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-3.7', CXXSTD: '03,11,14' },
|
||||||
|
"clang-3.7",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 16.04 Clang 3.8",
|
||||||
|
"cppalliance/droneubuntu1604:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-3.8', CXXSTD: '03,11,14' },
|
||||||
|
"clang-3.8",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 18.04 Clang 3.9",
|
||||||
|
"cppalliance/droneubuntu1804:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-3.9', CXXSTD: '03,11,14' },
|
||||||
|
"clang-3.9",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 18.04 Clang 4.0",
|
||||||
|
"cppalliance/droneubuntu1804:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-4.0', CXXSTD: '03,11,14' },
|
||||||
|
"clang-4.0",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 18.04 Clang 5.0",
|
||||||
|
"cppalliance/droneubuntu1804:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-5.0', CXXSTD: '03,11,14,1z' },
|
||||||
|
"clang-5.0",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 18.04 Clang 6.0",
|
||||||
|
"cppalliance/droneubuntu1804:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-6.0', CXXSTD: '03,11,14,17' },
|
||||||
|
"clang-6.0",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 Clang 7",
|
||||||
|
"cppalliance/droneubuntu2004:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-7', CXXSTD: '03,11,14,17' },
|
||||||
|
"clang-7",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 Clang 8",
|
||||||
|
"cppalliance/droneubuntu2004:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-8', CXXSTD: '03,11,14,17' },
|
||||||
|
"clang-8",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 Clang 9",
|
||||||
|
"cppalliance/droneubuntu2004:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-9', CXXSTD: '03,11,14,17,2a' },
|
||||||
|
"clang-9",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 Clang 10",
|
||||||
|
"cppalliance/droneubuntu2004:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-10', CXXSTD: '03,11,14,17,2a' },
|
||||||
|
"clang-10",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 Clang 11",
|
||||||
|
"cppalliance/droneubuntu2004:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-11', CXXSTD: '03,11,14,17,2a' },
|
||||||
|
"clang-11",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 20.04 Clang 12",
|
||||||
|
"cppalliance/droneubuntu2004:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-12', CXXSTD: '03,11,14,17,2a' },
|
||||||
|
"clang-12",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 22.04 Clang 13",
|
||||||
|
"cppalliance/droneubuntu2204:1",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++-13', CXXSTD: '03,11,14,17,20' },
|
||||||
|
"clang-13",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 22.04 Clang 14 UBSAN",
|
||||||
|
"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,
|
||||||
|
"clang-14",
|
||||||
|
),
|
||||||
|
|
||||||
|
linux_pipeline(
|
||||||
|
"Linux 22.04 Clang 15",
|
||||||
|
"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",
|
||||||
|
{ 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"],
|
||||||
|
),
|
||||||
|
|
||||||
|
macos_pipeline(
|
||||||
|
"MacOS 10.15 Xcode 12.2 UBSAN",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,1z' } + ubsan,
|
||||||
|
),
|
||||||
|
|
||||||
|
macos_pipeline(
|
||||||
|
"MacOS 10.15 Xcode 12.2 ASAN",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,1z' } + asan,
|
||||||
|
),
|
||||||
|
|
||||||
|
macos_pipeline(
|
||||||
|
"MacOS 12.4 Xcode 13.4.1 UBSAN",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
|
||||||
|
xcode_version = "13.4.1", osx_version = "monterey", arch = "arm64",
|
||||||
|
),
|
||||||
|
|
||||||
|
macos_pipeline(
|
||||||
|
"MacOS 12.4 Xcode 13.4.1 ASAN",
|
||||||
|
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + asan,
|
||||||
|
xcode_version = "13.4.1", osx_version = "monterey", arch = "arm64",
|
||||||
|
),
|
||||||
|
|
||||||
|
windows_pipeline(
|
||||||
|
"Windows VS2015 msvc-14.0",
|
||||||
|
"cppalliance/dronevs2015",
|
||||||
|
{ TOOLSET: 'msvc-14.0', CXXSTD: '14,latest', ADDRMD: '32,64' },
|
||||||
|
),
|
||||||
|
|
||||||
|
windows_pipeline(
|
||||||
|
"Windows VS2017 msvc-14.1",
|
||||||
|
"cppalliance/dronevs2017",
|
||||||
|
{ TOOLSET: 'msvc-14.1', CXXSTD: '14,17,latest', ADDRMD: '32,64' },
|
||||||
|
),
|
||||||
|
|
||||||
|
windows_pipeline(
|
||||||
|
"Windows VS2019 msvc-14.2",
|
||||||
|
"cppalliance/dronevs2019",
|
||||||
|
{ TOOLSET: 'msvc-14.2', CXXSTD: '14,17,20,latest', ADDRMD: '32,64' },
|
||||||
|
),
|
||||||
|
|
||||||
|
windows_pipeline(
|
||||||
|
"Windows VS2022 msvc-14.3",
|
||||||
|
"cppalliance/dronevs2022:1",
|
||||||
|
{ TOOLSET: 'msvc-14.3', CXXSTD: '14,17,20,latest', ADDRMD: '32,64' },
|
||||||
|
),
|
||||||
|
]
|
||||||
23
.drone/drone.bat
Normal file
23
.drone/drone.bat
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
@REM Copyright 2022 Peter Dimov
|
||||||
|
@REM Distributed under the Boost Software License, Version 1.0.
|
||||||
|
@REM https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
@ECHO ON
|
||||||
|
|
||||||
|
set LIBRARY=%1
|
||||||
|
set DRONE_BUILD_DIR=%CD%
|
||||||
|
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
if "%DRONE_BRANCH%" == "master" set BOOST_BRANCH=master
|
||||||
|
cd ..
|
||||||
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
xcopy /s /e /q %DRONE_BUILD_DIR% libs\%LIBRARY%\
|
||||||
|
python tools/boostdep/depinst/depinst.py -I examples %LIBRARY%
|
||||||
|
cmd /c bootstrap
|
||||||
|
b2 -d0 headers
|
||||||
|
|
||||||
|
if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
||||||
|
if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
|
||||||
|
b2 -j3 libs/%LIBRARY%/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release embed-manifest-via=linker
|
||||||
25
.drone/drone.sh
Executable file
25
.drone/drone.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2022 Peter Dimov
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
export PATH=~/.local/bin:/usr/local/bin:$PATH
|
||||||
|
|
||||||
|
DRONE_BUILD_DIR=$(pwd)
|
||||||
|
|
||||||
|
BOOST_BRANCH=develop
|
||||||
|
if [ "$DRONE_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
cp -r $DRONE_BUILD_DIR/* libs/$LIBRARY
|
||||||
|
python tools/boostdep/depinst/depinst.py -I examples $LIBRARY
|
||||||
|
./bootstrap.sh
|
||||||
|
./b2 -d0 headers
|
||||||
|
|
||||||
|
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
|
||||||
|
./b2 -j3 libs/$LIBRARY/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${ADDRMD:+address-model=$ADDRMD} ${UBSAN:+undefined-sanitizer=norecover debug-symbols=on} ${ASAN:+address-sanitizer=norecover debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
|
||||||
472
.github/workflows/ci.yml
vendored
472
.github/workflows/ci.yml
vendored
@@ -1,5 +1,5 @@
|
|||||||
# Copyright 2020-2021 Peter Dimov
|
# Copyright 2020-2021 Peter Dimov
|
||||||
# Copyright 2021 Andrey Semashev
|
# Copyright 2021-2022 Andrey Semashev
|
||||||
#
|
#
|
||||||
# Distributed under the Boost Software License, Version 1.0.
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
@@ -32,81 +32,105 @@ jobs:
|
|||||||
# Linux, gcc
|
# Linux, gcc
|
||||||
- toolset: gcc-4.4
|
- toolset: gcc-4.4
|
||||||
cxxstd: "98,0x"
|
cxxstd: "98,0x"
|
||||||
os: ubuntu-20.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-latest
|
||||||
container: ubuntu:16.04
|
container: ubuntu:16.04
|
||||||
install:
|
install:
|
||||||
- g++-4.4
|
- g++-4.4-multilib
|
||||||
sources:
|
sources:
|
||||||
- "ppa:ubuntu-toolchain-r/test"
|
- "ppa:ubuntu-toolchain-r/test"
|
||||||
- toolset: gcc-4.6
|
- toolset: gcc-4.6
|
||||||
cxxstd: "03,0x"
|
cxxstd: "03,0x"
|
||||||
os: ubuntu-20.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-latest
|
||||||
container: ubuntu:16.04
|
container: ubuntu:16.04
|
||||||
install:
|
install:
|
||||||
- g++-4.6
|
- g++-4.6-multilib
|
||||||
sources:
|
sources:
|
||||||
- "ppa:ubuntu-toolchain-r/test"
|
- "ppa:ubuntu-toolchain-r/test"
|
||||||
- toolset: gcc-4.7
|
- toolset: gcc-4.7
|
||||||
cxxstd: "03,11"
|
cxxstd: "03,11"
|
||||||
os: ubuntu-20.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-latest
|
||||||
container: ubuntu:16.04
|
container: ubuntu:16.04
|
||||||
install:
|
install:
|
||||||
- g++-4.7
|
- g++-4.7-multilib
|
||||||
- toolset: gcc-4.8
|
- toolset: gcc-4.8
|
||||||
cxxstd: "03,11"
|
cxxstd: "03,11"
|
||||||
os: ubuntu-18.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- g++-4.8
|
- g++-4.8-multilib
|
||||||
- toolset: gcc-4.9
|
- toolset: gcc-4.9
|
||||||
cxxstd: "03,11"
|
cxxstd: "03,11"
|
||||||
os: ubuntu-20.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-latest
|
||||||
container: ubuntu:16.04
|
container: ubuntu:16.04
|
||||||
install:
|
install:
|
||||||
- g++-4.9
|
- g++-4.9-multilib
|
||||||
- toolset: gcc-5
|
- toolset: gcc-5
|
||||||
cxxstd: "03,11,14,1z"
|
cxxstd: "03,11,14,1z"
|
||||||
os: ubuntu-20.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-latest
|
||||||
container: ubuntu:16.04
|
container: ubuntu:16.04
|
||||||
install:
|
install:
|
||||||
- g++-5
|
- g++-5-multilib
|
||||||
- toolset: gcc-6
|
- toolset: gcc-6
|
||||||
cxxstd: "03,11,14,1z"
|
cxxstd: "03,11,14,1z"
|
||||||
os: ubuntu-18.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- g++-6
|
- g++-6-multilib
|
||||||
- toolset: gcc-7
|
- toolset: gcc-7
|
||||||
cxxstd: "03,11,14,17"
|
cxxstd: "03,11,14,17"
|
||||||
os: ubuntu-18.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- g++-7
|
- g++-7-multilib
|
||||||
- toolset: gcc-8
|
- toolset: gcc-8
|
||||||
cxxstd: "03,11,14,17,2a"
|
cxxstd: "03,11,14,17,2a"
|
||||||
os: ubuntu-18.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- g++-8
|
- g++-8-multilib
|
||||||
- toolset: gcc-9
|
- toolset: gcc-9
|
||||||
cxxstd: "03,11,14,17,2a"
|
cxxstd: "03,11,14,17,2a"
|
||||||
os: ubuntu-18.04
|
address-model: 32,64
|
||||||
|
os: ubuntu-20.04
|
||||||
install:
|
install:
|
||||||
- g++-9
|
- g++-9-multilib
|
||||||
- toolset: gcc-10
|
- toolset: gcc-10
|
||||||
cxxstd: "03,11,14,17,20"
|
cxxstd: "03,11,14,17,20"
|
||||||
|
address-model: 32,64
|
||||||
os: ubuntu-20.04
|
os: ubuntu-20.04
|
||||||
install:
|
install:
|
||||||
- g++-10
|
- g++-10-multilib
|
||||||
- toolset: gcc-11
|
- toolset: gcc-11
|
||||||
cxxstd: "03,11,14,17,20"
|
cxxstd: "03,11,14,17,20,23"
|
||||||
os: ubuntu-20.04
|
address-model: 32,64
|
||||||
install:
|
|
||||||
- g++-11
|
|
||||||
- toolset: gcc-12
|
|
||||||
cxxstd: "03,11,14,17,20"
|
|
||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
install:
|
install:
|
||||||
- g++-12
|
- g++-11-multilib
|
||||||
|
- toolset: gcc-12
|
||||||
|
cxxstd: "03,11,14,17,20,23"
|
||||||
|
address-model: 32,64
|
||||||
|
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
|
||||||
- name: UBSAN
|
- name: UBSAN
|
||||||
toolset: gcc-12
|
toolset: gcc-12
|
||||||
cxxstd: "03,11,14,17,20"
|
cxxstd: "03,11,14,17,20,23"
|
||||||
ubsan: 1
|
ubsan: 1
|
||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
install:
|
install:
|
||||||
@@ -116,66 +140,72 @@ jobs:
|
|||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-3.5
|
compiler: clang++-3.5
|
||||||
cxxstd: "03,11"
|
cxxstd: "03,11"
|
||||||
os: ubuntu-20.04
|
os: ubuntu-latest
|
||||||
container: ubuntu:16.04
|
container: ubuntu:16.04
|
||||||
install:
|
install:
|
||||||
- clang-3.5
|
- clang-3.5
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-3.6
|
compiler: clang++-3.6
|
||||||
cxxstd: "03,11,14"
|
cxxstd: "03,11,14"
|
||||||
os: ubuntu-20.04
|
os: ubuntu-latest
|
||||||
container: ubuntu:16.04
|
container: ubuntu:16.04
|
||||||
install:
|
install:
|
||||||
- clang-3.6
|
- clang-3.6
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-3.7
|
compiler: clang++-3.7
|
||||||
cxxstd: "03,11,14"
|
cxxstd: "03,11,14"
|
||||||
os: ubuntu-20.04
|
os: ubuntu-latest
|
||||||
container: ubuntu:16.04
|
container: ubuntu:16.04
|
||||||
install:
|
install:
|
||||||
- clang-3.7
|
- clang-3.7
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-3.8
|
compiler: clang++-3.8
|
||||||
cxxstd: "03,11,14"
|
cxxstd: "03,11,14"
|
||||||
os: ubuntu-20.04
|
os: ubuntu-latest
|
||||||
container: ubuntu:16.04
|
container: ubuntu:16.04
|
||||||
install:
|
install:
|
||||||
- clang-3.8
|
- clang-3.8
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-3.9
|
compiler: clang++-3.9
|
||||||
cxxstd: "03,11,14"
|
cxxstd: "03,11,14"
|
||||||
os: ubuntu-18.04
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- clang-3.9
|
- clang-3.9
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-4.0
|
compiler: clang++-4.0
|
||||||
cxxstd: "03,11,14"
|
cxxstd: "03,11,14"
|
||||||
os: ubuntu-18.04
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- clang-4.0
|
- clang-4.0
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-5.0
|
compiler: clang++-5.0
|
||||||
cxxstd: "03,11,14,1z"
|
cxxstd: "03,11,14,1z"
|
||||||
os: ubuntu-18.04
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- clang-5.0
|
- clang-5.0
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-6.0
|
compiler: clang++-6.0
|
||||||
cxxstd: "03,11,14,17"
|
cxxstd: "03,11,14,17"
|
||||||
os: ubuntu-18.04
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- clang-6.0
|
- clang-6.0
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-7
|
compiler: clang++-7
|
||||||
cxxstd: "03,11,14,17"
|
cxxstd: "03,11,14,17"
|
||||||
os: ubuntu-18.04
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- clang-7
|
- clang-7
|
||||||
# Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode
|
# Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-8
|
compiler: clang++-8
|
||||||
cxxstd: "03,11,14,17,2a"
|
cxxstd: "03,11,14,17,2a"
|
||||||
os: ubuntu-18.04
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:18.04
|
||||||
install:
|
install:
|
||||||
- clang-8
|
- clang-8
|
||||||
- g++-7
|
- g++-7
|
||||||
@@ -195,67 +225,100 @@ jobs:
|
|||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-11
|
compiler: clang++-11
|
||||||
cxxstd: "03,11,14,17,20"
|
cxxstd: "03,11,14,17,20"
|
||||||
os: ubuntu-20.04
|
os: ubuntu-22.04
|
||||||
install:
|
install:
|
||||||
- clang-11
|
- clang-11
|
||||||
|
- g++-11
|
||||||
|
gcc_toolchain: 11
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-12
|
compiler: clang++-12
|
||||||
cxxstd: "03,11,14,17,20"
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
os: ubuntu-20.04
|
os: ubuntu-22.04
|
||||||
install:
|
install:
|
||||||
- clang-12
|
- clang-12
|
||||||
- toolset: clang
|
- g++-11
|
||||||
compiler: clang++-12
|
gcc_toolchain: 11
|
||||||
cxxstd: "03,11,14,17,20"
|
|
||||||
cxxflags: -stdlib=libc++
|
|
||||||
linkflags: -stdlib=libc++
|
|
||||||
os: ubuntu-20.04
|
|
||||||
install:
|
|
||||||
- clang-12
|
|
||||||
- libc++-12-dev
|
|
||||||
- libc++abi-12-dev
|
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-13
|
compiler: clang++-13
|
||||||
cxxstd: "03,11,14,17,20"
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
install:
|
install:
|
||||||
- clang-13
|
- clang-13
|
||||||
|
- g++-11
|
||||||
|
gcc_toolchain: 11
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-14
|
compiler: clang++-14
|
||||||
cxxstd: "03,11,14,17,20"
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
os: ubuntu-22.04
|
os: ubuntu-22.04
|
||||||
install:
|
install:
|
||||||
- clang-14
|
- clang-14
|
||||||
|
- g++-11
|
||||||
|
gcc_toolchain: 11
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-13
|
compiler: clang++-15
|
||||||
cxxstd: "03,11,14,17,20"
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
os: ubuntu-20.04
|
os: ubuntu-22.04
|
||||||
install:
|
install:
|
||||||
- clang-13
|
- clang-15
|
||||||
- libc++-13-dev
|
- g++-11
|
||||||
- libc++abi-13-dev
|
gcc_toolchain: 11
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-15
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: ubuntu-22.04
|
||||||
|
install:
|
||||||
|
- clang-15
|
||||||
|
- libc++-15-dev
|
||||||
|
- libc++abi-15-dev
|
||||||
|
cxxflags: -stdlib=libc++
|
||||||
|
linkflags: -stdlib=libc++
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-16
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:23.04
|
||||||
|
install:
|
||||||
|
- clang-16
|
||||||
|
- libc++-16-dev
|
||||||
|
- libc++abi-16-dev
|
||||||
|
cxxflags: -stdlib=libc++
|
||||||
|
linkflags: -stdlib=libc++
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-17
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: ubuntu-22.04
|
||||||
|
install:
|
||||||
|
- clang-17
|
||||||
|
- libc++-17-dev
|
||||||
|
- libc++abi-17-dev
|
||||||
sources:
|
sources:
|
||||||
- "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main"
|
- "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
|
||||||
source_keys:
|
source_keys:
|
||||||
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
|
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
|
||||||
cxxflags: -stdlib=libc++
|
cxxflags: -stdlib=libc++
|
||||||
linkflags: -stdlib=libc++
|
linkflags: -stdlib=libc++
|
||||||
- name: UBSAN
|
- name: UBSAN
|
||||||
toolset: clang
|
toolset: clang
|
||||||
compiler: clang++-12
|
compiler: clang++-15
|
||||||
cxxstd: "03,11,14,17,20"
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
cxxflags: -stdlib=libc++
|
cxxflags: -stdlib=libc++
|
||||||
linkflags: -stdlib=libc++
|
linkflags: -stdlib=libc++
|
||||||
ubsan: 1
|
ubsan: 1
|
||||||
os: ubuntu-20.04
|
os: ubuntu-22.04
|
||||||
install:
|
install:
|
||||||
- clang-12
|
- clang-15
|
||||||
- libc++-12-dev
|
- libc++-15-dev
|
||||||
- libc++abi-12-dev
|
- libc++abi-15-dev
|
||||||
|
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
cxxstd: "03,11,14,17,2a"
|
cxxstd: "03,11,14,17,2a"
|
||||||
os: macos-10.15
|
os: macos-11
|
||||||
|
- toolset: clang
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: macos-12
|
||||||
|
- toolset: clang
|
||||||
|
cxxstd: "03,11,14,17,20,2b"
|
||||||
|
os: macos-13
|
||||||
|
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
@@ -275,12 +338,18 @@ jobs:
|
|||||||
if [ -f "/etc/debian_version" ]
|
if [ -f "/etc/debian_version" ]
|
||||||
then
|
then
|
||||||
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
|
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
|
||||||
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ python python3 perl git cmake
|
if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ]
|
||||||
|
then
|
||||||
|
PYTHON_PACKAGE="python-is-python3"
|
||||||
|
else
|
||||||
|
PYTHON_PACKAGE="python"
|
||||||
|
fi
|
||||||
|
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
git config --global pack.threads 0
|
git config --global pack.threads 0
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
if: matrix.install
|
if: matrix.install
|
||||||
@@ -367,6 +436,7 @@ jobs:
|
|||||||
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
|
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
|
||||||
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
|
echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
|
||||||
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
|
echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
|
||||||
|
DEPINST_ARGS=()
|
||||||
GIT_VERSION="$(git --version | sed -e 's/git version //')"
|
GIT_VERSION="$(git --version | sed -e 's/git version //')"
|
||||||
GIT_HAS_JOBS=1
|
GIT_HAS_JOBS=1
|
||||||
if [ -f "/etc/debian_version" ]
|
if [ -f "/etc/debian_version" ]
|
||||||
@@ -393,25 +463,16 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
if [ "$GIT_HAS_JOBS" -ne 0 ]
|
if [ "$GIT_HAS_JOBS" -ne 0 ]
|
||||||
then
|
then
|
||||||
GIT_ARGS="--jobs $GIT_FETCH_JOBS"
|
DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS")
|
||||||
fi
|
fi
|
||||||
cd ..
|
cd ..
|
||||||
git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root"
|
git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root"
|
||||||
cd boost-root
|
cd boost-root
|
||||||
mkdir -p libs/$LIBRARY
|
mkdir -p libs/$LIBRARY
|
||||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
git submodule init tools/boost_install
|
git submodule update --init tools/boostdep
|
||||||
git submodule init libs/headers
|
DEPINST_ARGS+=("$LIBRARY")
|
||||||
git submodule init tools/build
|
python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}"
|
||||||
git submodule init tools/cmake
|
|
||||||
git submodule init libs/assert
|
|
||||||
git submodule init libs/config
|
|
||||||
git submodule init libs/static_assert
|
|
||||||
git submodule init libs/throw_exception
|
|
||||||
git submodule init libs/type_traits
|
|
||||||
git submodule init libs/utility
|
|
||||||
git submodule init libs/io
|
|
||||||
git submodule update $GIT_ARGS
|
|
||||||
./bootstrap.sh
|
./bootstrap.sh
|
||||||
./b2 headers
|
./b2 headers
|
||||||
if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ]
|
if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ]
|
||||||
@@ -442,12 +503,16 @@ jobs:
|
|||||||
if [ -n "${{matrix.ubsan}}" ]
|
if [ -n "${{matrix.ubsan}}" ]
|
||||||
then
|
then
|
||||||
export UBSAN_OPTIONS="print_stacktrace=1"
|
export UBSAN_OPTIONS="print_stacktrace=1"
|
||||||
B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global")
|
B2_ARGS+=("undefined-sanitizer=norecover" "linkflags=-fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global")
|
||||||
fi
|
fi
|
||||||
if [ -n "${{matrix.cxxflags}}" ]
|
if [ -n "${{matrix.cxxflags}}" ]
|
||||||
then
|
then
|
||||||
B2_ARGS+=("cxxflags=${{matrix.cxxflags}}")
|
B2_ARGS+=("cxxflags=${{matrix.cxxflags}}")
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${{matrix.address-model}}" ]
|
||||||
|
then
|
||||||
|
B2_ARGS+=("address-model=${{matrix.address-model}}")
|
||||||
|
fi
|
||||||
if [ -n "${{matrix.linkflags}}" ]
|
if [ -n "${{matrix.linkflags}}" ]
|
||||||
then
|
then
|
||||||
B2_ARGS+=("linkflags=${{matrix.linkflags}}")
|
B2_ARGS+=("linkflags=${{matrix.linkflags}}")
|
||||||
@@ -484,7 +549,7 @@ jobs:
|
|||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup Boost
|
- name: Setup Boost
|
||||||
shell: cmd
|
shell: cmd
|
||||||
@@ -503,18 +568,8 @@ jobs:
|
|||||||
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
cd boost-root
|
cd boost-root
|
||||||
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||||
git submodule init tools/boost_install
|
git submodule update --init tools/boostdep
|
||||||
git submodule init libs/headers
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
|
||||||
git submodule init tools/build
|
|
||||||
git submodule init tools/cmake
|
|
||||||
git submodule init libs/assert
|
|
||||||
git submodule init libs/config
|
|
||||||
git submodule init libs/static_assert
|
|
||||||
git submodule init libs/throw_exception
|
|
||||||
git submodule init libs/type_traits
|
|
||||||
git submodule init libs/utility
|
|
||||||
git submodule init libs/io
|
|
||||||
git submodule update --jobs %GIT_FETCH_JOBS%
|
|
||||||
cmd /c bootstrap
|
cmd /c bootstrap
|
||||||
b2 -d0 headers
|
b2 -d0 headers
|
||||||
|
|
||||||
@@ -529,15 +584,16 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-18.04
|
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
- os: macos-10.15
|
- os: macos-11
|
||||||
|
- os: macos-12
|
||||||
|
- os: macos-13
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
if: matrix.install
|
if: matrix.install
|
||||||
@@ -554,21 +610,21 @@ jobs:
|
|||||||
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
REF=${REF#refs/heads/}
|
REF=${REF#refs/heads/}
|
||||||
echo REF: $REF
|
echo REF: $REF
|
||||||
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
|
||||||
echo BOOST_BRANCH: $BOOST_BRANCH
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
cd ..
|
cd ..
|
||||||
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
cd boost-root
|
cd boost-root
|
||||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
git submodule update --init tools/boostdep
|
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
|
- name: Use library with add_subdirectory
|
||||||
run: |
|
run: |
|
||||||
cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
|
cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
|
||||||
mkdir __build__ && cd __build__
|
mkdir __build__ && cd __build__
|
||||||
cmake ..
|
cmake ..
|
||||||
cmake --build .
|
cmake --build . -- -j $BUILD_JOBS
|
||||||
ctest --output-on-failure --no-tests=error
|
ctest --output-on-failure --no-tests=error
|
||||||
|
|
||||||
posix-cmake-install:
|
posix-cmake-install:
|
||||||
@@ -576,15 +632,16 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-18.04
|
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
- os: macos-10.15
|
- os: macos-11
|
||||||
|
- os: macos-12
|
||||||
|
- os: macos-13
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
if: matrix.install
|
if: matrix.install
|
||||||
@@ -601,14 +658,14 @@ jobs:
|
|||||||
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
REF=${REF#refs/heads/}
|
REF=${REF#refs/heads/}
|
||||||
echo REF: $REF
|
echo REF: $REF
|
||||||
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
|
||||||
echo BOOST_BRANCH: $BOOST_BRANCH
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
cd ..
|
cd ..
|
||||||
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
cd boost-root
|
cd boost-root
|
||||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
git submodule update --init tools/boostdep
|
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
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
@@ -619,13 +676,13 @@ jobs:
|
|||||||
- name: Install
|
- name: Install
|
||||||
run: |
|
run: |
|
||||||
cd ../boost-root/__build__
|
cd ../boost-root/__build__
|
||||||
cmake --build . --target install
|
cmake --build . --target install -- -j $BUILD_JOBS
|
||||||
|
|
||||||
- name: Use the installed library
|
- name: Use the installed library
|
||||||
run: |
|
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 -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||||
cmake --build .
|
cmake --build . -- -j $BUILD_JOBS
|
||||||
ctest --output-on-failure --no-tests=error
|
ctest --output-on-failure --no-tests=error
|
||||||
|
|
||||||
posix-cmake-test:
|
posix-cmake-test:
|
||||||
@@ -633,15 +690,16 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-18.04
|
|
||||||
- os: ubuntu-20.04
|
- os: ubuntu-20.04
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
- os: macos-10.15
|
- os: macos-11
|
||||||
|
- os: macos-12
|
||||||
|
- os: macos-13
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
if: matrix.install
|
if: matrix.install
|
||||||
@@ -658,14 +716,14 @@ jobs:
|
|||||||
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
REF=${REF#refs/heads/}
|
REF=${REF#refs/heads/}
|
||||||
echo REF: $REF
|
echo REF: $REF
|
||||||
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true
|
||||||
echo BOOST_BRANCH: $BOOST_BRANCH
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
cd ..
|
cd ..
|
||||||
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
cd boost-root
|
cd boost-root
|
||||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
git submodule update --init tools/boostdep
|
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
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
@@ -676,9 +734,189 @@ jobs:
|
|||||||
- name: Build tests
|
- name: Build tests
|
||||||
run: |
|
run: |
|
||||||
cd ../boost-root/__build__
|
cd ../boost-root/__build__
|
||||||
cmake --build . --target tests
|
cmake --build . --target tests -- -j $BUILD_JOBS
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
cd ../boost-root/__build__
|
cd ../boost-root/__build__
|
||||||
ctest --output-on-failure --no-tests=error
|
ctest --output-on-failure --no-tests=error
|
||||||
|
|
||||||
|
windows-cmake-subdir:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-2019
|
||||||
|
- os: windows-2022
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
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%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
|
||||||
|
- name: Use library with add_subdirectory (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake ..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
ctest --output-on-failure --no-tests=error -C Debug
|
||||||
|
|
||||||
|
- name: Use library with add_subdirectory (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
|
||||||
|
cmake --build . --config Release
|
||||||
|
ctest --output-on-failure --no-tests=error -C Release
|
||||||
|
|
||||||
|
windows-cmake-install:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-2019
|
||||||
|
- os: windows-2022
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
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%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
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__
|
||||||
|
cmake --build . --target install --config Debug
|
||||||
|
|
||||||
|
- name: Install (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
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__
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
ctest --output-on-failure --no-tests=error -C Debug
|
||||||
|
|
||||||
|
- name: Use the installed library (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
|
||||||
|
cmake --build . --config Release
|
||||||
|
ctest --output-on-failure --no-tests=error -C Release
|
||||||
|
|
||||||
|
windows-cmake-test:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-2019
|
||||||
|
- os: windows-2022
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
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%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
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__
|
||||||
|
cmake --build . --target tests --config Debug
|
||||||
|
|
||||||
|
- name: Run tests (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
ctest --output-on-failure --no-tests=error -C Debug
|
||||||
|
|
||||||
|
- name: Build tests (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target tests --config Release
|
||||||
|
|
||||||
|
- name: Run tests (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
ctest --output-on-failure --no-tests=error -C Release
|
||||||
|
|||||||
@@ -20,6 +20,15 @@ target_link_libraries(boost_core
|
|||||||
Boost::throw_exception
|
Boost::throw_exception
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER 3.18 AND CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||||
|
|
||||||
|
file(GLOB_RECURSE boost_core_IDEFILES CONFIGURE_DEPENDS include/*.hpp)
|
||||||
|
source_group(TREE ${PROJECT_SOURCE_DIR}/include FILES ${boost_core_IDEFILES} PREFIX "Header Files")
|
||||||
|
list(APPEND boost_core_IDEFILES extra/boost_core.natvis)
|
||||||
|
target_sources(boost_core PRIVATE ${boost_core_IDEFILES})
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
|
||||||
|
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|||||||
54
appveyor.yml
54
appveyor.yml
@@ -29,6 +29,11 @@ environment:
|
|||||||
|
|
||||||
# clang-win 32 bit fails to link with "unable to load mspdbcore.dll (error code: 126)"
|
# clang-win 32 bit fails to link with "unable to load mspdbcore.dll (error code: 126)"
|
||||||
|
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
TOOLSET: clang-win
|
||||||
|
ADDRMD: 64
|
||||||
|
CXXSTD: 14,17,latest
|
||||||
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||||
TOOLSET: clang-win
|
TOOLSET: clang-win
|
||||||
ADDRMD: 64
|
ADDRMD: 64
|
||||||
@@ -59,27 +64,25 @@ environment:
|
|||||||
TOOLSET: gcc
|
TOOLSET: gcc
|
||||||
CXXSTD: 03,11,14,1z
|
CXXSTD: 03,11,14,1z
|
||||||
|
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
CMAKE: 1
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
|
CMAKE_SUBDIR: 1
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||||
|
CMAKE_INSTALL: 1
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- set GIT_FETCH_JOBS=8
|
||||||
- set BOOST_BRANCH=develop
|
- set BOOST_BRANCH=develop
|
||||||
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
|
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
|
||||||
- cd ..
|
- cd ..
|
||||||
- git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost-root
|
- git clone -b %BOOST_BRANCH% https://github.com/boostorg/boost.git boost-root
|
||||||
- cd boost-root
|
- cd boost-root
|
||||||
- git submodule init libs/headers
|
- git submodule update --init tools/boostdep
|
||||||
- git submodule init libs/assert
|
|
||||||
- git submodule init libs/config
|
|
||||||
- git submodule init libs/predef
|
|
||||||
- git submodule init libs/static_assert
|
|
||||||
- git submodule init libs/throw_exception
|
|
||||||
- git submodule init libs/type_traits
|
|
||||||
- git submodule init libs/utility
|
|
||||||
- git submodule init libs/io
|
|
||||||
- git submodule init tools/build
|
|
||||||
- git submodule init tools/boost_install
|
|
||||||
- git submodule update --jobs 4
|
|
||||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\core\
|
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\core\
|
||||||
|
- python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" core
|
||||||
- cmd /c bootstrap
|
- cmd /c bootstrap
|
||||||
- b2 headers
|
- b2 -d0 headers
|
||||||
|
|
||||||
build: off
|
build: off
|
||||||
|
|
||||||
@@ -87,4 +90,27 @@ test_script:
|
|||||||
- PATH=%ADDPATH%%PATH%
|
- PATH=%ADDPATH%%PATH%
|
||||||
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
||||||
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
|
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
|
||||||
- b2 -j %NUMBER_OF_PROCESSORS% libs/core/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release embed-manifest-via=linker
|
- if "%CMAKE%%CMAKE_SUBDIR%%CMAKE_INSTALL%" == "" b2 -j %NUMBER_OF_PROCESSORS% libs/core/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release embed-manifest-via=linker
|
||||||
|
|
||||||
|
- if not "%CMAKE%" == "" mkdir __build__ && cd __build__
|
||||||
|
- if not "%CMAKE%" == "" cmake -DBUILD_TESTING=ON -DBOOST_INCLUDE_LIBRARIES=core ..
|
||||||
|
- if not "%CMAKE%" == "" cmake --build . --target tests -j 3 --config Debug & ctest --output-on-failure --no-tests=error -j 3 -C Debug
|
||||||
|
- if not "%CMAKE%" == "" cmake --build . --target tests -j 3 --config Release & ctest --output-on-failure --no-tests=error -j 3 -C Release
|
||||||
|
- if not "%CMAKE%" == "" cmake --build . --target tests -j 3 --config MinSizeRel & ctest --output-on-failure --no-tests=error -j 3 -C MinSizeRel
|
||||||
|
- if not "%CMAKE%" == "" cmake --build . --target tests -j 3 --config RelWithDebInfo & ctest --output-on-failure --no-tests=error -j 3 -C RelWithDebInfo
|
||||||
|
|
||||||
|
- if not "%CMAKE_SUBDIR%" == "" cd libs/core/test/cmake_subdir_test && mkdir __build__ && cd __build__
|
||||||
|
- if not "%CMAKE_SUBDIR%" == "" cmake ..
|
||||||
|
- if not "%CMAKE_SUBDIR%" == "" cmake --build . --config Debug && cmake --build . --target check --config Debug
|
||||||
|
- if not "%CMAKE_SUBDIR%" == "" cmake --build . --config Release && cmake --build . --target check --config Release
|
||||||
|
- if not "%CMAKE_SUBDIR%" == "" cmake --build . --config MinSizeRel && cmake --build . --target check --config MinSizeRel
|
||||||
|
- if not "%CMAKE_SUBDIR%" == "" cmake --build . --config RelWithDebInfo && cmake --build . --target check --config RelWithDebInfo
|
||||||
|
|
||||||
|
- if not "%CMAKE_INSTALL%" == "" mkdir __build__ && cd __build__
|
||||||
|
- if not "%CMAKE_INSTALL%" == "" cmake -DBOOST_INCLUDE_LIBRARIES=core -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
|
||||||
|
- if not "%CMAKE_INSTALL%" == "" cmake --build . --target install --config Debug
|
||||||
|
- if not "%CMAKE_INSTALL%" == "" cmake --build . --target install --config Release
|
||||||
|
- if not "%CMAKE_INSTALL%" == "" cd ../libs/core/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||||
|
- if not "%CMAKE_INSTALL%" == "" cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
|
||||||
|
- if not "%CMAKE_INSTALL%" == "" cmake --build . --config Debug && cmake --build . --target check --config Debug
|
||||||
|
- if not "%CMAKE_INSTALL%" == "" cmake --build . --config Release && cmake --build . --target check --config Release
|
||||||
|
|||||||
33
doc/alignof.qbk
Normal file
33
doc/alignof.qbk
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2023 Peter Dimov
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
https://boost.org/LICENSE_1_0.txt
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:alignof alignof]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Peter Dimov
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Header <boost/core/alignof.hpp>]
|
||||||
|
|
||||||
|
The header `<boost/core/alignof.hpp>` defines the macro `BOOST_CORE_ALIGNOF`,
|
||||||
|
a portable equivalent of the `alignof` operator from C++11.
|
||||||
|
|
||||||
|
[section Example]
|
||||||
|
|
||||||
|
``
|
||||||
|
#include <boost/core/alignof.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
constexpr std::size_t alignment_of_double = BOOST_CORE_ALIGNOF(double);
|
||||||
|
``
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
@@ -293,7 +293,7 @@ returns `a`.]]]
|
|||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Acknowledgments]
|
[section Acknowledgements]
|
||||||
|
|
||||||
Glen Fernandes implemented the allocator access utilities.
|
Glen Fernandes implemented the allocator access utilities.
|
||||||
|
|
||||||
|
|||||||
20
doc/bit.qbk
20
doc/bit.qbk
@@ -33,6 +33,11 @@ namespace core
|
|||||||
template<class To, class From>
|
template<class To, class From>
|
||||||
To bit_cast(From const& from) noexcept;
|
To bit_cast(From const& from) noexcept;
|
||||||
|
|
||||||
|
// byteswap
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
constexpr T byteswap(T x) noexcept;
|
||||||
|
|
||||||
// Integral powers of 2
|
// Integral powers of 2
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -45,7 +50,7 @@ template<class T>
|
|||||||
constexpr T bit_floor(T x) noexcept;
|
constexpr T bit_floor(T x) noexcept;
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
constexpr T bit_width(T x) noexcept;
|
constexpr int bit_width(T x) noexcept;
|
||||||
|
|
||||||
// Rotating
|
// Rotating
|
||||||
|
|
||||||
@@ -102,6 +107,17 @@ constant expression context.
|
|||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
[section byteswap]
|
||||||
|
|
||||||
|
`template<class T> constexpr T byteswap(T x) noexcept;`
|
||||||
|
|
||||||
|
* *Requires:* `T` must be an integer type (i.e. one of `char`, `signed char`,
|
||||||
|
`unsigned char`, `short`, `unsigned short`, `int`, `unsigned int`, `long`,
|
||||||
|
`unsigned long`, `long long`, `unsigned long long`) without padding bits.
|
||||||
|
* *Returns:* `x` with the storage bytes reversed.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
[section Integral powers of 2]
|
[section Integral powers of 2]
|
||||||
|
|
||||||
`template<class T> constexpr bool has_single_bit(T x) noexcept;`
|
`template<class T> constexpr bool has_single_bit(T x) noexcept;`
|
||||||
@@ -119,7 +135,7 @@ constant expression context.
|
|||||||
* *Requires:* `T` must be an unsigned integer type.
|
* *Requires:* `T` must be an unsigned integer type.
|
||||||
* *Returns:* If `x == 0`, 0; otherwise the maximal value `y` such that `has_single_bit(y)` is `true` and `y <= x`.
|
* *Returns:* If `x == 0`, 0; otherwise the maximal value `y` such that `has_single_bit(y)` is `true` and `y <= x`.
|
||||||
|
|
||||||
`template<class T> constexpr T bit_width(T x) noexcept;`
|
`template<class T> constexpr int bit_width(T x) noexcept;`
|
||||||
|
|
||||||
* *Requires:* `T` must be an unsigned integer type.
|
* *Requires:* `T` must be an unsigned integer type.
|
||||||
* *Returns:* If `x == 0`, 0; otherwise one plus the base-2 logarithm of `x`, with any fractional part discarded.
|
* *Returns:* If `x == 0`, 0; otherwise one plus the base-2 logarithm of `x`, with any fractional part discarded.
|
||||||
|
|||||||
@@ -1,16 +1,101 @@
|
|||||||
[/
|
[/
|
||||||
Copyright 2021 Peter Dimov
|
Copyright 2021 Peter Dimov
|
||||||
|
Copyright 2022-2023 Andrey Semashev
|
||||||
Distributed under the Boost Software License, Version 1.0.
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
https://boost.org/LICENSE_1_0.txt)
|
https://boost.org/LICENSE_1_0.txt)
|
||||||
]
|
]
|
||||||
|
|
||||||
[section Revision History]
|
[section Revision History]
|
||||||
|
|
||||||
|
[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`].
|
||||||
|
* Bit manipulation functions in [link core.bit `boost/core/bit.hpp`] are now
|
||||||
|
`constexpr` on recent MSVC versions (VS2019 update 5 and later.)
|
||||||
|
* Added `boost::core::byteswap` (an implementation of `std::byteswap` from
|
||||||
|
C++23) to [link core.bit `boost/core/bit.hpp`].
|
||||||
|
* Moved the yield primitives `sp_thread_pause`, `sp_thread_yield`, `sp_thread_sleep`
|
||||||
|
from SmartPtr implementation details to `boost/core/yield_primitives.hpp`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Changes in 1.82.0]
|
||||||
|
|
||||||
|
* Added [link core.snprintf `boost/core/snprintf.hpp`] header with portable definitions of `snprintf`, `vsnprintf` and
|
||||||
|
their `wchar_t` counterparts.
|
||||||
|
* Deprecated `boost/core/is_same.hpp` and `boost::core::is_same`. The header will be removed in a future release.
|
||||||
|
Users are advised to use [@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/index.html Boost.TypeTraits]
|
||||||
|
or C++ standard library type traits instead.
|
||||||
|
* Marked `boost::ref` member functions and associated methods with `noexcept`.
|
||||||
|
* Marked `boost::swap` function with `noexcept`, depending on whether the type supports a non-throwing swap operation.
|
||||||
|
* Added [link core.launder `boost::core::launder`], a portable implementation of `std::launder`.
|
||||||
|
* Added [link core.alignof `BOOST_CORE_ALIGNOF`], a portable implementation of `alignof`.
|
||||||
|
* Added [link core.max_align `boost::core::max_align_t`], a portable equivalent of `std::max_align_t`, and
|
||||||
|
`boost::core::max_align`, the alignment of `max_align_t`.
|
||||||
|
* Added [link core.memory_resource `boost::core::memory_resource`], a portable equivalent of `std::pmr::memory_resource`
|
||||||
|
from C++17.
|
||||||
|
* Added [link core.serialization `boost/core/serialization.hpp`], a collection of primitives allowing libraries to
|
||||||
|
implement Boost.Serialization support for their types without including a Serialization header and thereby making
|
||||||
|
their libraries depend on Serialization.
|
||||||
|
* Added [link core.data `boost::data`], an implementation of `std::data`.
|
||||||
|
* Added [link core.size `boost::size`], an implementation of `std::size`.
|
||||||
|
* Updated `boost::span` to use `boost::data` which adds support for range
|
||||||
|
construction from an `std::initializer_list`.
|
||||||
|
* Added [link core.identity `boost::identity`], an implementation of
|
||||||
|
`std::identity`. This facility has been moved from Boost.Functional.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Changes in 1.81.0]
|
||||||
|
|
||||||
|
* [link core.empty_value `empty_value`] members are now marked as `constexpr`.
|
||||||
|
* Added [link core.fclose_deleter `fclose_deleter`], a deleter that calls `std::fclose` on a pointer to `std::FILE`.
|
||||||
|
* Bit manipulation utilities in [link core.bit `boost/core/bit.hpp`] now explicitly require unsigned integers on input.
|
||||||
|
([@https://github.com/boostorg/core/issues/129 #129])
|
||||||
|
* `bit_width` now returns `int` instead of a value of the input argument type. This follows the
|
||||||
|
resolution of [@https://cplusplus.github.io/LWG/issue3656 LWG3656].
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Changes in 1.80.0]
|
||||||
|
|
||||||
|
* In [link core.allocator_access `boost/core/allocator_access.hpp`], added detection of `construct` and `destroy`
|
||||||
|
members of an allocator.
|
||||||
|
* `boost/core/alloc_construct.hpp` header is now deprecated and will be removed in a future release. Its functionality
|
||||||
|
was moved to [link core.allocator_access `boost/core/allocator_access.hpp`]. In particular, new methods
|
||||||
|
`allocator_construct_n` and `allocator_destroy_n` were added for allocating and destroying arrays.
|
||||||
|
* Worked around MSVC bug that failed to compile [link core.span `span`] in C++17 mode when Boost.Range headers were included.
|
||||||
|
([@https://github.com/boostorg/core/issues/105 #105], [@https://github.com/boostorg/core/pull/115 PR#115])
|
||||||
|
* Added support for 128-bit integer types in [link core.type_name `type_name`].
|
||||||
|
* In [link core.pointer_traits `pointer_traits`], pointer rebinding now supports C++03 compilers.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
[section Changes in 1.79.0]
|
[section Changes in 1.79.0]
|
||||||
|
|
||||||
* Added `boost::allocator_traits`, an implementation of `std::allocator_traits`.
|
* Added `boost::allocator_traits`, an implementation of `std::allocator_traits`.
|
||||||
* Made `boost::pointer_traits` SFINAE friendly.
|
* Made `boost::pointer_traits` SFINAE friendly.
|
||||||
* `boost/iterator.hpp` is deprecated and will be removed in a future release. The header defines `boost::iterator` template, which is equivalent to `std::iterator` in `<iterator>` header. However, since `std::iterator` is itself deprecated in C++17, users are advised to remove `boost::iterator` or `std::iterator` use from their code.
|
* `boost/iterator.hpp` is deprecated and will be removed in a future release. The header defines the
|
||||||
|
`boost::iterator` template, which is equivalent to `std::iterator` in the `<iterator>` header. However,
|
||||||
|
since `std::iterator` is itself deprecated in C++17, users are advised to remove the use of `boost::iterator`
|
||||||
|
or `std::iterator` from their code.
|
||||||
* Added `boost::core::verbose_terminate_handler`, a utility function intended
|
* Added `boost::core::verbose_terminate_handler`, a utility function intended
|
||||||
to be passed to `std::set_terminate` that prints information about the
|
to be passed to `std::set_terminate` that prints information about the
|
||||||
uncaught exception to `stderr`.
|
uncaught exception to `stderr`.
|
||||||
|
|||||||
12
doc/core.qbk
12
doc/core.qbk
@@ -41,11 +41,13 @@ criteria for inclusion is that the utility component be:
|
|||||||
[include changes.qbk]
|
[include changes.qbk]
|
||||||
|
|
||||||
[include addressof.qbk]
|
[include addressof.qbk]
|
||||||
|
[include alignof.qbk]
|
||||||
[include allocator_access.qbk]
|
[include allocator_access.qbk]
|
||||||
[include allocator_traits.qbk]
|
[include allocator_traits.qbk]
|
||||||
[include bit.qbk]
|
[include bit.qbk]
|
||||||
[include checked_delete.qbk]
|
[include checked_delete.qbk]
|
||||||
[include cmath.qbk]
|
[include cmath.qbk]
|
||||||
|
[include data.qbk]
|
||||||
[include default_allocator.qbk]
|
[include default_allocator.qbk]
|
||||||
[include demangle.qbk]
|
[include demangle.qbk]
|
||||||
[include empty_value.qbk]
|
[include empty_value.qbk]
|
||||||
@@ -53,22 +55,32 @@ criteria for inclusion is that the utility component be:
|
|||||||
[include exchange.qbk]
|
[include exchange.qbk]
|
||||||
[include explicit_operator_bool.qbk]
|
[include explicit_operator_bool.qbk]
|
||||||
[include first_scalar.qbk]
|
[include first_scalar.qbk]
|
||||||
|
[include identity.qbk]
|
||||||
[include ignore_unused.qbk]
|
[include ignore_unused.qbk]
|
||||||
[include is_same.qbk]
|
[include is_same.qbk]
|
||||||
|
[include launder.qbk]
|
||||||
[include lightweight_test.qbk]
|
[include lightweight_test.qbk]
|
||||||
|
[include make_span.qbk]
|
||||||
|
[include max_align.qbk]
|
||||||
|
[include memory_resource.qbk]
|
||||||
[include no_exceptions_support.qbk]
|
[include no_exceptions_support.qbk]
|
||||||
[include noinit_adaptor.qbk]
|
[include noinit_adaptor.qbk]
|
||||||
[include noncopyable.qbk]
|
[include noncopyable.qbk]
|
||||||
[include null_deleter.qbk]
|
[include null_deleter.qbk]
|
||||||
|
[include fclose_deleter.qbk]
|
||||||
[include nvp.qbk]
|
[include nvp.qbk]
|
||||||
[include pointer_traits.qbk]
|
[include pointer_traits.qbk]
|
||||||
[include quick_exit.qbk]
|
[include quick_exit.qbk]
|
||||||
[include ref.qbk]
|
[include ref.qbk]
|
||||||
[include scoped_enum.qbk]
|
[include scoped_enum.qbk]
|
||||||
|
[include serialization.qbk]
|
||||||
|
[include size.qbk]
|
||||||
[include span.qbk]
|
[include span.qbk]
|
||||||
[include swap.qbk]
|
[include swap.qbk]
|
||||||
[include typeinfo.qbk]
|
[include typeinfo.qbk]
|
||||||
[include type_name.qbk]
|
[include type_name.qbk]
|
||||||
|
[include snprintf.qbk]
|
||||||
[include uncaught_exceptions.qbk]
|
[include uncaught_exceptions.qbk]
|
||||||
[include use_default.qbk]
|
[include use_default.qbk]
|
||||||
[include verbose_terminate_handler.qbk]
|
[include verbose_terminate_handler.qbk]
|
||||||
|
[include yield_primitives.qbk]
|
||||||
|
|||||||
67
doc/data.qbk
Normal file
67
doc/data.qbk
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2023 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:data data]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Glen Fernandes
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Overview]
|
||||||
|
|
||||||
|
The header <boost/core/data.hpp> provides function templates `data`
|
||||||
|
to obtain the pointer to the first element in a range.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Reference]
|
||||||
|
|
||||||
|
```
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class C>
|
||||||
|
constexpr auto
|
||||||
|
data(C& c) noexcept(noexcept(c.data())) -> decltype(c.data());
|
||||||
|
|
||||||
|
template<class C>
|
||||||
|
constexpr auto
|
||||||
|
data(const C& c) noexcept(noexcept(c.data())) -> decltype(c.data());
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
constexpr T*
|
||||||
|
data(T(&a)[N]) noexcept;
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
constexpr const T*
|
||||||
|
data(std::initializer_list<T> l) noexcept;
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
```
|
||||||
|
|
||||||
|
[section Functions]
|
||||||
|
|
||||||
|
[variablelist
|
||||||
|
[[`template<class C> constexpr auto data(C& c) noexcept(noexcept(c.data())) ->
|
||||||
|
decltype(c.data());`]
|
||||||
|
[Returns `c.data()`.]]
|
||||||
|
[[`template<class C> constexpr auto data(const C& c)
|
||||||
|
noexcept(noexcept(c.data())) -> decltype(c.data());`]
|
||||||
|
[Returns `c.data()`.]]
|
||||||
|
[[`template<class T, std::size_t N> constexpr T* data(T(&a)[N]) noexcept;`]
|
||||||
|
[Returns `a`.]]
|
||||||
|
[[`template<class T> constexpr const T* data(std::initializer_list<T> l)
|
||||||
|
noexcept;`]
|
||||||
|
[Returns `l.begin()`.]]]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
@@ -125,7 +125,7 @@ return `nullptr` if demangling failed.
|
|||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Acknowledgments]
|
[section Acknowledgements]
|
||||||
|
|
||||||
The implementation of `core::demangle` was taken from
|
The implementation of `core::demangle` was taken from
|
||||||
`boost/exception/detail/type_info.hpp`, which in turn was adapted
|
`boost/exception/detail/type_info.hpp`, which in turn was adapted
|
||||||
|
|||||||
@@ -90,11 +90,11 @@ public:
|
|||||||
empty_value() = default;
|
empty_value() = default;
|
||||||
|
|
||||||
template<class... Args>
|
template<class... Args>
|
||||||
empty_value(empty_init_t, Args&&... args);
|
constepxr empty_value(empty_init_t, Args&&... args);
|
||||||
|
|
||||||
const T& get() const noexcept;
|
constepxr const T& get() const noexcept;
|
||||||
|
|
||||||
T& get() noexcept;
|
constepxr T& get() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr empty_init_t empty_init{ };
|
inline constexpr empty_init_t empty_init{ };
|
||||||
@@ -121,8 +121,9 @@ inline constexpr empty_init_t empty_init{ };
|
|||||||
[section Constructors]
|
[section Constructors]
|
||||||
|
|
||||||
[variablelist
|
[variablelist
|
||||||
[[`empty_value() = default;`][Default initialize the value]]
|
[[`constepxr empty_value() = default;`][Default initialize the value]]
|
||||||
[[`template<class... Args> empty_value(empty_init_t, Args&&... args);`]
|
[[`template<class... Args>
|
||||||
|
constepxr empty_value(empty_init_t, Args&&... args);`]
|
||||||
[Initialize the value with `std::forward<Args>(args)...`]]]
|
[Initialize the value with `std::forward<Args>(args)...`]]]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
@@ -130,8 +131,8 @@ inline constexpr empty_init_t empty_init{ };
|
|||||||
[section Member functions]
|
[section Member functions]
|
||||||
|
|
||||||
[variablelist
|
[variablelist
|
||||||
[[`const T& get() const noexcept;`][Returns the value]]
|
[[`constepxr const T& get() const noexcept;`][Returns the value]]
|
||||||
[[`T& get() noexcept;`][Returns the value]]]
|
[[`constepxr T& get() noexcept;`][Returns the value]]]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
|||||||
@@ -304,8 +304,8 @@ depends on the template arguments of the class. Note that
|
|||||||
again, the second argument to `enable_if` is not needed; the
|
again, the second argument to `enable_if` is not needed; the
|
||||||
default (`void`) is the correct value.
|
default (`void`) is the correct value.
|
||||||
|
|
||||||
The `enable_if_has_type` template is usable this scenario but instead of
|
The `enable_if_has_type` template is usable in this scenario but instead of
|
||||||
using a type traits to enable or disable a specialization, it use a
|
using a type trait to enable or disable a specialization, it uses a
|
||||||
SFINAE context to check for the existence of a dependent type inside
|
SFINAE context to check for the existence of a dependent type inside
|
||||||
its parameter. For example, the following structure extracts a dependent
|
its parameter. For example, the following structure extracts a dependent
|
||||||
`value_type` from T if and only if `T::value_type` exists.
|
`value_type` from T if and only if `T::value_type` exists.
|
||||||
|
|||||||
34
doc/fclose_deleter.qbk
Normal file
34
doc/fclose_deleter.qbk
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[/
|
||||||
|
/ Copyright (c) 2022 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:fclose_deleter fclose_deleter]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Andrey Semashev
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Header <boost/core/fclose_deleter.hpp>]
|
||||||
|
|
||||||
|
The header `<boost/core/fclose_deleter.hpp>` defines the `boost::fclose_deleter` function object,
|
||||||
|
which can be used as a deleter with smart pointers such as `unique_ptr` or `shared_ptr` pointing to `std::FILE`.
|
||||||
|
structures returned by `std::fopen` calls. The deleter calls `std::fclose` on the passed pointer, causing
|
||||||
|
the file stream to be flushed and closed.
|
||||||
|
|
||||||
|
[section Example]
|
||||||
|
``
|
||||||
|
std::unique_ptr< std::FILE, boost::fclose_deleter > make_file(const char* filename, const char* open_mode)
|
||||||
|
{
|
||||||
|
return { std::fopen(filename, open_mode) };
|
||||||
|
}
|
||||||
|
``
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
61
doc/identity.qbk
Normal file
61
doc/identity.qbk
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2021-2023 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:identity identity]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Glen Fernandes
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Overview]
|
||||||
|
|
||||||
|
The header <boost/functional/identity.hpp> provides the function object
|
||||||
|
`boost::identity` whose `operator()` returns its argument. It is an
|
||||||
|
implementation of C++20's `std::identity` that supports C++03 and above.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Example]
|
||||||
|
|
||||||
|
It is commonly used as the default projection in constrained algorithms.
|
||||||
|
|
||||||
|
```
|
||||||
|
template<class Range, class Projection = boost::identity>
|
||||||
|
void print(Range&& range, Projection projection = {});
|
||||||
|
```
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Reference]
|
||||||
|
|
||||||
|
```
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
struct identity {
|
||||||
|
using is_transparent = unspecified;
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
T&& operator()(T&& value) const noexcept;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
```
|
||||||
|
|
||||||
|
[section Operators]
|
||||||
|
|
||||||
|
[variablelist
|
||||||
|
[[`template<class T> T&& operator()(T&& value) const noexcept;`]
|
||||||
|
[Returns `std::forward<T>(value)`.]]]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
@@ -51,7 +51,7 @@ int fun( int foo, int bar )
|
|||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Acknowledgments]
|
[section Acknowledgements]
|
||||||
|
|
||||||
`boost::ignore_unused()` was contributed by Adam Wulkiewicz.
|
`boost::ignore_unused()` was contributed by Adam Wulkiewicz.
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,11 @@
|
|||||||
|
|
||||||
[section Header <boost/core/is_same.hpp>]
|
[section Header <boost/core/is_same.hpp>]
|
||||||
|
|
||||||
|
[warning This component is deprecated and will be removed in a future release.
|
||||||
|
Users are recommended to use `boost::is_same` from
|
||||||
|
[@http://www.boost.org/doc/libs/release/libs/type_traits/doc/html/index.html Boost.TypeTraits]
|
||||||
|
or `std::is_same` from C++ standard library `<type_traits>` instead.]
|
||||||
|
|
||||||
The header `<boost/core/is_same.hpp>` defines the class template
|
The header `<boost/core/is_same.hpp>` defines the class template
|
||||||
`boost::core::is_same<T1,T2>`. It defines a nested integral constant
|
`boost::core::is_same<T1,T2>`. It defines a nested integral constant
|
||||||
`value` which is `true` when `T1` and `T2` are the same type, and
|
`value` which is `true` when `T1` and `T2` are the same type, and
|
||||||
|
|||||||
39
doc/launder.qbk
Normal file
39
doc/launder.qbk
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2023 Peter Dimov
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
https://boost.org/LICENSE_1_0.txt
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:launder launder]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Peter Dimov
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Header <boost/core/launder.hpp>]
|
||||||
|
|
||||||
|
The header `<boost/core/launder.hpp>` defines the function
|
||||||
|
`void boost::core::launder()`, a portable implementation of
|
||||||
|
`std::launder`.
|
||||||
|
|
||||||
|
[section Synopsis]
|
||||||
|
|
||||||
|
``
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class T> T* launder( T* p );
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
``
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
@@ -51,8 +51,16 @@ When using `lightweight_test.hpp`, *do not forget* to
|
|||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
int report_errors();
|
|
||||||
}
|
int report_errors();
|
||||||
|
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
void lwt_init();
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
``
|
``
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
@@ -246,6 +254,25 @@ Return the error count from `main`.
|
|||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
[section lwt_init]
|
||||||
|
|
||||||
|
``
|
||||||
|
void boost::core::lwt_init()
|
||||||
|
``
|
||||||
|
|
||||||
|
Performs one-time initialization. Disables the interactive message
|
||||||
|
boxes displayed by the Microsoft Windows debug runtime library on
|
||||||
|
`abort`, failing `assert`, and other abnormal program terminations
|
||||||
|
(to facilitate unattended testing), and ensures that in case
|
||||||
|
`boost::report_errors` is not called (a common mistake), the program
|
||||||
|
ends with a nonzero exit code.
|
||||||
|
|
||||||
|
`lwt_init` is automatically called by the test macros. There is
|
||||||
|
no need to call it explicitly, except in cases where a test fails due
|
||||||
|
to e.g. an assertion failure before the first test macro is invoked.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
[section Example]
|
[section Example]
|
||||||
|
|
||||||
``
|
``
|
||||||
@@ -326,14 +353,14 @@ parentheses.)
|
|||||||
|
|
||||||
``
|
``
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
|
||||||
template<class T, class U> struct X
|
template<class T, class U> struct X
|
||||||
{
|
{
|
||||||
typedef T type;
|
typedef T type;
|
||||||
};
|
};
|
||||||
|
|
||||||
using boost::core::is_same;
|
using boost::is_same;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|||||||
81
doc/make_span.qbk
Normal file
81
doc/make_span.qbk
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2023 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:make_span make_span]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Glen Fernandes
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Overview]
|
||||||
|
|
||||||
|
The header <boost/core/make_span.hpp> provides function templates `make_span`
|
||||||
|
to conveniently create `span` objects. They are useful before C++17 where Class
|
||||||
|
Template Argument Deduction (CTAD) is not available.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Reference]
|
||||||
|
|
||||||
|
```
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class I>
|
||||||
|
constexpr span<I>
|
||||||
|
make_span(I* d, std::size_t n) noexcept;
|
||||||
|
|
||||||
|
template<class I>
|
||||||
|
constexpr span<I>
|
||||||
|
make_span(I* b, I* e) noexcept;
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
constexpr span<T, N>
|
||||||
|
make_span(T(&a)[N]) noexcept;
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
constexpr span<T, N>
|
||||||
|
make_span(std::array<T, N>& a) noexcept;
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
constexpr span<const T, N>
|
||||||
|
make_span(const std::array<T, N>& a) noexcept;
|
||||||
|
|
||||||
|
template<class R>
|
||||||
|
span<remove_pointer_t<iterator_t<R> > >
|
||||||
|
make_span(R&& r);
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
```
|
||||||
|
|
||||||
|
[section Functions]
|
||||||
|
|
||||||
|
[variablelist
|
||||||
|
[[`template<class I> span<I> make_span(I* f, std::size_t c);`]
|
||||||
|
[Returns `span<I>(f, c)`.]]
|
||||||
|
[[`template<class I> span<I> make_span(I* f, I* l);`]
|
||||||
|
[Returns `span<I>(f, l)`.]]
|
||||||
|
[[`template<class T, std::size_t N> span<T, N> make_span(T(&a)[N]);`]
|
||||||
|
[Returns `span<T, N>(a)`.]]
|
||||||
|
[[`template<class T, std::size_t N> span<T, N>
|
||||||
|
make_span(std::array<T, N>& a);`]
|
||||||
|
[Returns `span<T, N>(a)`.]]
|
||||||
|
[[`template<class T, std::size_t N> span<const T, N>
|
||||||
|
make_span(const std::array<T, N>& a);`]
|
||||||
|
[Returns `span<const T, N>(a)`.]]
|
||||||
|
[[`template<class R>
|
||||||
|
span<remove_pointer_t<iterator_t<R> > >
|
||||||
|
make_span(R&& r);`]
|
||||||
|
[Returns `span<remove_pointer_t<iterator_t<R> > >(std::forward<R>(r))`.]]]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
42
doc/max_align.qbk
Normal file
42
doc/max_align.qbk
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2023 Peter Dimov
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
https://boost.org/LICENSE_1_0.txt
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:max_align max_align]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Peter Dimov
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Header <boost/core/max_align.hpp>]
|
||||||
|
|
||||||
|
The header `<boost/core/max_align.hpp>` defines the type
|
||||||
|
`boost::core::max_align_t`, a portable equivalent of
|
||||||
|
`std::max_align_t`, and the constant `boost::core::max_align`,
|
||||||
|
the alignment of `max_align_t`.
|
||||||
|
|
||||||
|
[section Synopsis]
|
||||||
|
|
||||||
|
``
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
union max_align_t;
|
||||||
|
|
||||||
|
constexpr std::size_t max_align = alignof(max_align_t);
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
``
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
139
doc/memory_resource.qbk
Normal file
139
doc/memory_resource.qbk
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2023 Peter Dimov
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
https://boost.org/LICENSE_1_0.txt
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:memory_resource memory_resource]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Peter Dimov
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Header <boost/core/memory_resource.hpp>]
|
||||||
|
|
||||||
|
The header `<boost/core/memory_resource.hpp>` defines the class
|
||||||
|
`boost::core::memory_resource`, a portable equivalent of
|
||||||
|
`std::pmr::memory_resource` from C++17.
|
||||||
|
|
||||||
|
This is not a complete implementation of the standard `<memory_resource>`
|
||||||
|
header; for such, one should use Boost.Container. The abstract base class
|
||||||
|
is only provided by Core so that Boost libraries that provide and take
|
||||||
|
advantage of PMR facilities such as concrete implementations of memory
|
||||||
|
resources, or implementations of `polymorphic_allocator`, can interoperate.
|
||||||
|
|
||||||
|
[section Synopsis]
|
||||||
|
|
||||||
|
``
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
class memory_resource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual ~memory_resource() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] void* allocate( std::size_t bytes, std::size_t alignment = max_align );
|
||||||
|
void deallocate( void* p, std::size_t bytes, std::size_t alignment = max_align );
|
||||||
|
|
||||||
|
bool is_equal( memory_resource const & other ) const noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
virtual void* do_allocate( std::size_t bytes, std::size_t alignment ) = 0;
|
||||||
|
virtual void do_deallocate( void* p, std::size_t bytes, std::size_t alignment ) = 0;
|
||||||
|
|
||||||
|
virtual bool do_is_equal( memory_resource const& other ) const noexcept = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool operator==( memory_resource const& a, memory_resource const& b ) noexcept;
|
||||||
|
inline bool operator!=( memory_resource const& a, memory_resource const& b ) noexcept;
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
``
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `allocate`]
|
||||||
|
|
||||||
|
`[[nodiscard]] void* allocate( std::size_t bytes, std::size_t alignment = max_align );`
|
||||||
|
|
||||||
|
* *Returns:* `do_allocate( bytes, alignment )`.
|
||||||
|
* *Remarks:* Implicitly creates objects in the returned region of storage.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `deallocate`]
|
||||||
|
|
||||||
|
`void deallocate( void* p, std::size_t bytes, std::size_t alignment = max_align );`
|
||||||
|
|
||||||
|
* *Effects:* `do_deallocate( bytes, alignment )`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `is_equal`]
|
||||||
|
|
||||||
|
`bool is_equal( memory_resource const& other ) const noexcept;`
|
||||||
|
|
||||||
|
* *Returns:* `do_is_equal( other )`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `do_allocate`]
|
||||||
|
|
||||||
|
`void* do_allocate( std::size_t bytes, std::size_t alignment ) = 0;`
|
||||||
|
|
||||||
|
* *Remarks:* A derived class should implement this member function to return
|
||||||
|
a pointer to allocated storage of size at least `bytes` and alignment at
|
||||||
|
least `alignment`.
|
||||||
|
* *Throws:* An appropriate exception (by convention `std::bad_alloc` or
|
||||||
|
derived) when storage with the specified size and alignment could not be
|
||||||
|
obtained.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `do_deallocate`]
|
||||||
|
|
||||||
|
`void do_deallocate( void* p, std::size_t bytes, std::size_t alignment ) = 0;`
|
||||||
|
|
||||||
|
* *Remarks:* A derived class should implement this member function to deallocate
|
||||||
|
a region of storage previously allocated by `do_allocate`.
|
||||||
|
* *Throws:* Nothing.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `do_is_equal`]
|
||||||
|
|
||||||
|
`bool do_is_equal( memory_resource const& other ) const noexcept = 0;`
|
||||||
|
|
||||||
|
* *Remarks:* A derived class shall implement this function to return `true` if
|
||||||
|
memory allocated from `*this` can be deallocated from `other` and vice-versa,
|
||||||
|
otherwise `false`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `operator==`]
|
||||||
|
|
||||||
|
`bool operator==( memory_resource const& a, memory_resource const& b ) noexcept;`
|
||||||
|
|
||||||
|
* *Returns:* `&a == &b || a.is_equal( b )`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `operator!=`]
|
||||||
|
|
||||||
|
`bool operator!=( memory_resource const& a, memory_resource const& b ) noexcept;`
|
||||||
|
|
||||||
|
* *Returns:* `!( a == b )`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
@@ -113,6 +113,9 @@ also not defined (`pointer_traits` is SFINAE-friendly).
|
|||||||
where `Args` is zero or more type arguments; otherwise, the member is not
|
where `Args` is zero or more type arguments; otherwise, the member is not
|
||||||
defined.]]]
|
defined.]]]
|
||||||
|
|
||||||
|
[note When C++11 template aliases are not supported, the `type` for `rebind` is
|
||||||
|
`T::rebind<U>::other` if such a type exists.]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Member functions]
|
[section Member functions]
|
||||||
@@ -121,7 +124,7 @@ also not defined (`pointer_traits` is SFINAE-friendly).
|
|||||||
[[`static pointer pointer_traits::pointer_to(element_type& v);`]
|
[[`static pointer pointer_traits::pointer_to(element_type& v);`]
|
||||||
[[variablelist
|
[[variablelist
|
||||||
[[Remark]
|
[[Remark]
|
||||||
[If `element_type` is a void type, or if `T::pointer_to(v)` is not well formed,
|
[If `element_type` is a void type, or if `T::pointer_to(v)` is not well-formed,
|
||||||
this member is not defined.]]
|
this member is not defined.]]
|
||||||
[[Returns]
|
[[Returns]
|
||||||
[A pointer to `v` obtained by calling `T::pointer_to(v)`.]]]]]
|
[A pointer to `v` obtained by calling `T::pointer_to(v)`.]]]]]
|
||||||
@@ -162,7 +165,7 @@ also not defined (`pointer_traits` is SFINAE-friendly).
|
|||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Acknowledgments]
|
[section Acknowledgements]
|
||||||
|
|
||||||
Glen Fernandes implemented `pointer_traits` and `to_address` with reviews and
|
Glen Fernandes implemented `pointer_traits` and `to_address` with reviews and
|
||||||
guidance from Peter Dimov.
|
guidance from Peter Dimov.
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ The type-expression `boost::unwrap_reference<T>::type` is
|
|||||||
|
|
||||||
[xinclude ref_reference.xml]
|
[xinclude ref_reference.xml]
|
||||||
|
|
||||||
[section Acknowledgments]
|
[section Acknowledgements]
|
||||||
|
|
||||||
`ref` and `cref` were originally part of the Tuple library by
|
`ref` and `cref` were originally part of the Tuple library by
|
||||||
Jaakko J\u00E4rvi. They were "promoted to `boost::` status" by
|
Jaakko J\u00E4rvi. They were "promoted to `boost::` status" by
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ The user can portably declare such enumeration as follows:
|
|||||||
}
|
}
|
||||||
BOOST_SCOPED_ENUM_DECLARE_END(future_errc)
|
BOOST_SCOPED_ENUM_DECLARE_END(future_errc)
|
||||||
|
|
||||||
These macros allows to use `future_errc` in almost all the cases as an scoped enum.
|
These macros allow using `future_errc` in almost all the cases as a scoped enum.
|
||||||
|
|
||||||
future_errc ev = future_errc::no_state;
|
future_errc ev = future_errc::no_state;
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ such cases.
|
|||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Acknowledgments]
|
[section Acknowledgements]
|
||||||
|
|
||||||
This scoped enum emulation was developed by Beman Dawes, Vicente J. Botet Escriba and Anthony Williams.
|
This scoped enum emulation was developed by Beman Dawes, Vicente J. Botet Escriba and Anthony Williams.
|
||||||
|
|
||||||
|
|||||||
145
doc/serialization.qbk
Normal file
145
doc/serialization.qbk
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2023 Peter Dimov
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
https://boost.org/LICENSE_1_0.txt
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:serialization serialization]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Peter Dimov
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Header <boost/core/serialization.hpp>]
|
||||||
|
|
||||||
|
The header `<boost/core/serialization.hpp>` implements primitives
|
||||||
|
that are necessary to implement Boost.Serialization support without
|
||||||
|
including a Boost.Serialization header and thereby making a library
|
||||||
|
dependent on Boost.Serialization.
|
||||||
|
|
||||||
|
[section Synopsis]
|
||||||
|
|
||||||
|
``
|
||||||
|
#include <boost/core/nvp.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace serialization
|
||||||
|
{
|
||||||
|
|
||||||
|
// forward declarations
|
||||||
|
|
||||||
|
template<class T> struct version;
|
||||||
|
class access;
|
||||||
|
|
||||||
|
// core_version_type
|
||||||
|
|
||||||
|
struct core_version_type;
|
||||||
|
|
||||||
|
} // namespace serialization
|
||||||
|
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
// nvp
|
||||||
|
|
||||||
|
using serialization::nvp;
|
||||||
|
using serialization::make_nvp;
|
||||||
|
|
||||||
|
// split_free
|
||||||
|
|
||||||
|
template<class Ar, class T> void split_free( Ar& ar, T& t, unsigned int v );
|
||||||
|
|
||||||
|
// split_member
|
||||||
|
|
||||||
|
template<class Ar, class T> void split_member( Ar& ar, T& t, unsigned int v );
|
||||||
|
|
||||||
|
// load_construct_data_adl
|
||||||
|
|
||||||
|
template<class Ar, class T> void load_construct_data_adl( Ar& ar, T* t, unsigned int v );
|
||||||
|
|
||||||
|
// save_construct_data_adl
|
||||||
|
|
||||||
|
template<class Ar, class T> void save_construct_data_adl( Ar& ar, T const* t, unsigned int v );
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
``
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `core_version_type`]
|
||||||
|
|
||||||
|
``
|
||||||
|
struct core_version_type
|
||||||
|
{
|
||||||
|
unsigned int version_;
|
||||||
|
|
||||||
|
core_version_type( unsigned int version ): version_( version ) {}
|
||||||
|
operator unsigned int () const { return version_; }
|
||||||
|
};
|
||||||
|
``
|
||||||
|
|
||||||
|
`core_version_type` is a Core reimplementation of
|
||||||
|
`boost::serialization::version_type`, needed to call ADL serialization
|
||||||
|
primitives such as, for example, `load_construct_data` below.
|
||||||
|
|
||||||
|
It's defined in the `serialization` namespace instead of the `core`
|
||||||
|
namespace because its only purpose is to add `boost::serialization` to
|
||||||
|
the list of the associated namespaces of the corresponding call.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `split_free`]
|
||||||
|
|
||||||
|
`template<class Ar, class T> inline void split_free( Ar& ar, T& t, unsigned int v );`
|
||||||
|
|
||||||
|
`boost::core::split_free` is a Core reimplementation of
|
||||||
|
`boost::serialization::split_free`.
|
||||||
|
|
||||||
|
* *Effects:*
|
||||||
|
* If `Ar::is_saving::value` is `true`, calls `save( ar, t, core_version_type( v ) )`;
|
||||||
|
* Otherwise, calls `load( ar, t, core_version_type( v ) )`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `split_member`]
|
||||||
|
|
||||||
|
`template<class Ar, class T> void split_member( Ar& ar, T& t, unsigned int v );`
|
||||||
|
|
||||||
|
`boost::core::split_member` is a Core reimplementation of
|
||||||
|
`boost::serialization::split_member`.
|
||||||
|
|
||||||
|
* *Effects:*
|
||||||
|
* If `Ar::is_saving::value` is `true`, calls `t.save( ar, v )`;
|
||||||
|
* Otherwise, calls `t.load( ar, v )`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `load_construct_data_adl`]
|
||||||
|
|
||||||
|
`template<class Ar, class T> void load_construct_data_adl( Ar& ar, T* t, unsigned int v );`
|
||||||
|
|
||||||
|
`boost::core::load_construct_data_adl` is a Core reimplementation of
|
||||||
|
`boost::serialization::load_construct_data_adl`.
|
||||||
|
|
||||||
|
* *Effects:* `load_construct_data( ar, t, serialization::core_version_type( v ) );`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section `save_construct_data_adl`]
|
||||||
|
|
||||||
|
`template<class Ar, class T> void save_construct_data_adl( Ar& ar, T const* t, unsigned int v );`
|
||||||
|
|
||||||
|
`boost::core::save_construct_data_adl` is a Core reimplementation of
|
||||||
|
`boost::serialization::save_construct_data_adl`.
|
||||||
|
|
||||||
|
* *Effects:* `save_construct_data( ar, t, serialization::core_version_type( v ) );`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
54
doc/size.qbk
Normal file
54
doc/size.qbk
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2023 Glen Joseph Fernandes
|
||||||
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:size size]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Glen Fernandes
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Overview]
|
||||||
|
|
||||||
|
The header <boost/core/size.hpp> provides function templates `size` to obtain
|
||||||
|
the number of elements in a range.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section Reference]
|
||||||
|
|
||||||
|
```
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class C>
|
||||||
|
constexpr auto
|
||||||
|
size(const C& c) noexcept(noexcept(c.size())) -> decltype(c.size());
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
constexpr std::size_t
|
||||||
|
size(T(&)[N]) noexcept;
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
```
|
||||||
|
|
||||||
|
[section Functions]
|
||||||
|
|
||||||
|
[variablelist
|
||||||
|
[[`template<class C> constexpr auto size(const C& c)
|
||||||
|
noexcept(noexcept(c.size())) -> decltype(c.size());`]
|
||||||
|
[Returns `c.size()`.]]
|
||||||
|
[[`template<class T, std::size_t N> constexpr std::size_t size(T(&)[N])
|
||||||
|
noexcept;`]
|
||||||
|
[Returns `N`.]]]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
47
doc/snprintf.qbk
Normal file
47
doc/snprintf.qbk
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
[/
|
||||||
|
/ Copyright (c) 2022 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:snprintf snprintf]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Andrey Semashev
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Header <boost/core/snprintf.hpp>]
|
||||||
|
|
||||||
|
The header `<boost/core/snprintf.hpp>` provides portable definition of [@https://en.cppreference.com/w/c/io/fprintf `snprintf`],
|
||||||
|
`vsnprintf` and their corresponding `wchar_t` counterparts. On a platform that supports these functions in the standard library,
|
||||||
|
these definitions are equivalent to the standard functions. On other platforms (mainly, older MSVC versions) these functions
|
||||||
|
are emulated through non-standard functions that have similar behavior.
|
||||||
|
|
||||||
|
Depending on the standard library, certain implementation differences are exposed to the user:
|
||||||
|
|
||||||
|
* Any non-standard behavior with respect to string format description are not hidden by the emulation.
|
||||||
|
* Returned value of `boost::core::snprintf` in case if the output buffer is too small may not be equal to the number of characters
|
||||||
|
that would have been written if the buffer was large enough. It is, however, equal or larger than the buffer size,
|
||||||
|
which still allows the caller to detect the buffer overflow condition. The formatted output is still properly null-terminated
|
||||||
|
in this case.
|
||||||
|
|
||||||
|
[note Unlike `snprintf`, `swprintf` does not return the number of characters to be written if the output buffer is too small
|
||||||
|
but returns -1 instead. Furthermore, `swprintf` may or may not produce characters in the output buffer in this case.]
|
||||||
|
|
||||||
|
[section Example]
|
||||||
|
``
|
||||||
|
char buf[10];
|
||||||
|
int n = boost::core::snprintf(buf, sizeof(buf), "%d", i);
|
||||||
|
if (n < 0)
|
||||||
|
throw std::runtime_error("Formatting error");
|
||||||
|
if (n >= sizeof(buf))
|
||||||
|
throw std::runtime_error("Formatting buffer overflow");
|
||||||
|
``
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
10
doc/span.qbk
10
doc/span.qbk
@@ -149,7 +149,7 @@ template<class T, std::size_t N>
|
|||||||
span(const std::array<T, N>&) -> span<const T, N>;
|
span(const std::array<T, N>&) -> span<const T, N>;
|
||||||
|
|
||||||
template<class R>
|
template<class R>
|
||||||
span(R&&) -> span<std::remove_pointer_t<decltype(std::declval<R&>().data())> >;
|
span(R&&) -> span<remove_pointer_t<iterator_t<R> > >;
|
||||||
|
|
||||||
template<class T, std::size_t E>
|
template<class T, std::size_t E>
|
||||||
span<const std::byte, E == dynamic_extent ? dynamic_extent : sizeof(T) * E>
|
span<const std::byte, E == dynamic_extent ? dynamic_extent : sizeof(T) * E>
|
||||||
@@ -227,13 +227,13 @@ constexpr span(R&& r);`]
|
|||||||
[`remove_cvref_t<R>` is not a specialization of `span`,]
|
[`remove_cvref_t<R>` is not a specialization of `span`,]
|
||||||
[`remove_cvref_t<R>` is not a specialization of `array`,]
|
[`remove_cvref_t<R>` is not a specialization of `array`,]
|
||||||
[`is_array_v<remove_cvref_t<R>>` is `false`,]
|
[`is_array_v<remove_cvref_t<R>>` is `false`,]
|
||||||
[`r.data()` is well-formed and
|
[`data(r)` is well-formed and
|
||||||
`is_convertible_v<remove_pointer_t<decltype(declval<R&>().data())>(*)[],
|
`is_convertible_v<remove_pointer_t<iterator_t<R> >(*)[],
|
||||||
T(*)[]>` is `true`, and]
|
T(*)[]>` is `true`, and]
|
||||||
[`r.size()` is well-formed and
|
[`r.size()` is well-formed and
|
||||||
`is_convertible_v<decltype(declval<R&>().size()), size_t>` is `true`.]]]]
|
`is_convertible_v<decltype(declval<R&>().size()), size_t>` is `true`.]]]]
|
||||||
[[Effects][Constructs a `span` with data `r.data()` and size `r.size()`.]]
|
[[Effects][Constructs a `span` with data `data(r)` and size `r.size()`.]]
|
||||||
[[Throws][What and when r.data() and r.size() throw.]]]]]
|
[[Throws][What and when data(r) and r.size() throw.]]]]]
|
||||||
[[`explicit(E != dynamic_extent && N == dynamic_extent)
|
[[`explicit(E != dynamic_extent && N == dynamic_extent)
|
||||||
template<class U, std::size_t N>
|
template<class U, std::size_t N>
|
||||||
constexpr span(const span<U, N>& s) noexcept;`]
|
constexpr span(const span<U, N>& s) noexcept;`]
|
||||||
|
|||||||
69
doc/swap.qbk
69
doc/swap.qbk
@@ -20,17 +20,17 @@
|
|||||||
|
|
||||||
[endsimplesect]
|
[endsimplesect]
|
||||||
|
|
||||||
[section Header <boost/core/swap.hpp>]
|
[section Header <boost/core/invoke_swap.hpp>]
|
||||||
|
|
||||||
`template<class T> void swap(T& left, T& right);`
|
[^template<class T> void invoke_swap(T& left, T& right) noexcept(['see below]);]
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Introduction]
|
[section Introduction]
|
||||||
|
|
||||||
The template function `boost::swap` allows the values of two
|
The template function `boost::core::invoke_swap` allows the
|
||||||
variables to be swapped, using argument dependent lookup to
|
values of two variables to be swapped, using argument dependent
|
||||||
select a specialized swap function if available. If no
|
lookup to select a specialized swap function if available. If no
|
||||||
specialized swap function is available, `std::swap` is used.
|
specialized swap function is available, `std::swap` is used.
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
@@ -40,13 +40,14 @@ specialized swap function is available, `std::swap` is used.
|
|||||||
The generic `std::swap` function requires that the elements
|
The generic `std::swap` function requires that the elements
|
||||||
to be swapped are assignable and copy constructible. It is
|
to be swapped are assignable and copy constructible. It is
|
||||||
usually implemented using one copy construction and two
|
usually implemented using one copy construction and two
|
||||||
assignments - this is often both unnecessarily restrictive and
|
assignments (C++11 replaces copy operations with move) - this
|
||||||
unnecessarily slow. In addition, where the generic swap
|
is often both unnecessarily restrictive and unnecessarily slow.
|
||||||
implementation provides only the basic guarantee, specialized
|
In addition, where the generic swap implementation provides
|
||||||
swap functions are often able to provide the no-throw exception
|
only the basic guarantee, specialized swap functions are often
|
||||||
guarantee (and it is considered best practice to do so where
|
able to provide the no-throw exception guarantee (and it is
|
||||||
possible [footnote Scott Meyers, Effective C++ Third Edition,
|
considered best practice to do so where possible[footnote Scott
|
||||||
Item 25: "Consider support for a non-throwing swap"].
|
Meyers, Effective C++ Third Edition, Item 25: "Consider support
|
||||||
|
for a non-throwing swap"].
|
||||||
|
|
||||||
The alternative to using argument dependent lookup in this
|
The alternative to using argument dependent lookup in this
|
||||||
situation is to provide a template specialization of
|
situation is to provide a template specialization of
|
||||||
@@ -55,23 +56,27 @@ Although this is legal C++, no Boost libraries use this method,
|
|||||||
whereas many Boost libraries provide specialized swap functions
|
whereas many Boost libraries provide specialized swap functions
|
||||||
in their own namespaces.
|
in their own namespaces.
|
||||||
|
|
||||||
`boost::swap` also supports swapping built-in arrays. Note that
|
`boost::core::invoke_swap` also supports swapping built-in arrays.
|
||||||
`std::swap` originally did not do so, but a request to add an
|
Note that `std::swap` originally did not do so, but a request to
|
||||||
overload of `std::swap` for built-in arrays has been accepted
|
add an overload of `std::swap` for built-in arrays has been accepted
|
||||||
by the C++ Standards Committee[footnote
|
by the C++ Standards Committee[footnote
|
||||||
[@http://open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#809
|
[@http://open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#809
|
||||||
LWG Defect Report 809: std::swap should be overloaded for array
|
LWG Defect Report 809: std::swap should be overloaded for array
|
||||||
types]].
|
types]].
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Exception Safety]
|
[section Exception Safety]
|
||||||
|
|
||||||
`boost::swap` provides the same exception guarantee as the
|
`boost::core::invoke_swap` provides the same exception guarantee as
|
||||||
underlying swap function used, with one exception; for an array
|
the underlying swap function used, with one exception; for an array
|
||||||
of type `T[n]`, where `n > 1` and the underlying swap function
|
of type `T[n]`, where `n > 1` and the underlying swap function
|
||||||
for `T` provides the strong exception guarantee, `boost::swap`
|
for `T` provides the strong exception guarantee,
|
||||||
provides only the basic exception guarantee.
|
`boost::core::invoke_swap` provides only the basic exception guarantee.
|
||||||
|
|
||||||
|
In C++11 and later, `boost::core::invoke_swap` propagates the same
|
||||||
|
`noexcept` specification as the one specified in the underlying swap
|
||||||
|
function.
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
@@ -79,42 +84,44 @@ provides only the basic exception guarantee.
|
|||||||
|
|
||||||
Either:
|
Either:
|
||||||
|
|
||||||
* T must be assignable
|
* `T` must be copy assignable (/since C++11:/ move assignable)
|
||||||
* T must be copy constructible
|
* `T` must be copy constructible (/since C++11:/ move constructible)
|
||||||
|
|
||||||
Or:
|
Or:
|
||||||
|
|
||||||
* A function with the signature `swap(T&,T&)` is available via
|
* A function with the signature `swap(T&, T&)` is available via
|
||||||
argument dependent lookup
|
argument dependent lookup
|
||||||
|
|
||||||
Or:
|
Or:
|
||||||
|
|
||||||
* A template specialization of `std::swap` exists for T
|
* A template specialization of `std::swap` exists for `T`
|
||||||
|
|
||||||
Or:
|
Or:
|
||||||
|
|
||||||
* T is a built-in array of swappable elements
|
* `T` is a built-in array of swappable elements
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Portability]
|
[section Portability]
|
||||||
|
|
||||||
Several older compilers do not support argument dependent
|
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
|
`std::swap`, ignoring any specialized swap functions that
|
||||||
could be found as a result of argument dependent lookup.
|
could be found as a result of argument dependent lookup.
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
[section Credits]
|
[section Credits]
|
||||||
|
|
||||||
* *Niels Dekker* - for implementing and documenting support for
|
* *Niels Dekker* - for implementing and documenting support for
|
||||||
built-in arrays
|
built-in arrays
|
||||||
* *Joseph Gauterin* - for the initial idea, implementation,
|
* *Joseph Gauterin* - for the initial idea, implementation,
|
||||||
tests, and documentation
|
tests, and documentation
|
||||||
* *Steven Watanabe* - for the idea to make `boost::swap` less
|
* *Steven Watanabe* - for the idea to make `boost::swap` less
|
||||||
specialized than `std::swap`, thereby allowing the function
|
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]
|
[endsect]
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
[section Overview]
|
[section Overview]
|
||||||
|
|
||||||
The header <boost/core/use_default.hpp> provides the type `boost::use_default`
|
The header <boost/core/use_default.hpp> provides the type `boost::use_default`
|
||||||
which is used by other Boost libraries as a sentinel type in a templates to
|
which is used by other Boost libraries as a sentinel type in templates to
|
||||||
indicate defaults.
|
indicate defaults.
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|||||||
79
doc/yield_primitives.qbk
Normal file
79
doc/yield_primitives.qbk
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
[/
|
||||||
|
Copyright 2023 Peter Dimov
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
https://boost.org/LICENSE_1_0.txt
|
||||||
|
]
|
||||||
|
|
||||||
|
[section:yield_primitives Yield Primitives]
|
||||||
|
|
||||||
|
[simplesect Authors]
|
||||||
|
|
||||||
|
* Peter Dimov
|
||||||
|
|
||||||
|
[endsimplesect]
|
||||||
|
|
||||||
|
[section Header <boost/core/yield_primitives.hpp>]
|
||||||
|
|
||||||
|
The header `<boost/core/yield_primitives.hpp>` implements a
|
||||||
|
collection of primitives that allow the current thread to
|
||||||
|
yield the CPU in various ways.
|
||||||
|
|
||||||
|
Very low level, specialized functionality, generally only useful for
|
||||||
|
implementing spinlocks. Normal synchronization primitives should
|
||||||
|
almost always be preferable in application code.
|
||||||
|
|
||||||
|
[section Synopsis]
|
||||||
|
|
||||||
|
``
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
void sp_thread_pause() noexcept;
|
||||||
|
void sp_thread_yield() noexcept;
|
||||||
|
void sp_thread_sleep() noexcept;
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
``
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section sp_thread_pause]
|
||||||
|
|
||||||
|
`void sp_thread_pause() noexcept;`
|
||||||
|
|
||||||
|
Emits a PAUSE instruction (on x86) or a YIELD instruction (on ARM).
|
||||||
|
|
||||||
|
A portable equivalent of the GCC builtin function `__builtin_ia32_pause`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section sp_thread_yield]
|
||||||
|
|
||||||
|
`void sp_thread_yield() noexcept;`
|
||||||
|
|
||||||
|
Informs the scheduler that the current thread wishes to relinquish
|
||||||
|
the rest of its timeslice.
|
||||||
|
|
||||||
|
A portable equivalent of POSIX `sched_yield`.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[section sp_thread_sleep]
|
||||||
|
|
||||||
|
`void sp_thread_sleep() noexcept;`
|
||||||
|
|
||||||
|
Sleeps for a short period, as if by calling POSIX `nanosleep` with
|
||||||
|
a small, implementation-dependent, interval (usually one microsecond).
|
||||||
|
|
||||||
|
A more forcing yield primitive than `sp_thread_yield`, because it's
|
||||||
|
generally not ignored even if all other waiting threads are of lower
|
||||||
|
priority.
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
|
|
||||||
|
[endsect]
|
||||||
8
extra/boost_core.natvis
Normal file
8
extra/boost_core.natvis
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||||
|
|
||||||
|
<Type Name="boost::core::basic_string_view<*>">
|
||||||
|
<DisplayString>{p_,[n_]s}</DisplayString>
|
||||||
|
</Type>
|
||||||
|
|
||||||
|
</AutoVisualizer>
|
||||||
57
include/boost/core/alignof.hpp
Normal file
57
include/boost/core/alignof.hpp
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#ifndef BOOST_CORE_ALIGNOF_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_ALIGNOF_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_ALIGNOF)
|
||||||
|
|
||||||
|
#define BOOST_CORE_ALIGNOF alignof
|
||||||
|
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
|
#define BOOST_CORE_ALIGNOF __alignof__
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
|
#define BOOST_CORE_ALIGNOF __alignof
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
template<class T> struct alignof_helper
|
||||||
|
{
|
||||||
|
char x;
|
||||||
|
T t;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
// ignoring -Wvariadic-macros with #pragma doesn't work under GCC
|
||||||
|
# pragma GCC system_header
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BOOST_CORE_ALIGNOF(...) offsetof( ::boost::core::detail::alignof_helper<__VA_ARGS__>, t );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_ALIGNOF_HPP_INCLUDED
|
||||||
@@ -807,14 +807,14 @@ using allocator_rebind_t = typename allocator_rebind<A, T>::type;
|
|||||||
|
|
||||||
} /* boost */
|
} /* boost */
|
||||||
|
|
||||||
#if defined(_LIBCPP_SUPPRESS_DEPRECATED_POP)
|
#if defined(_MSC_VER)
|
||||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
#if defined(_STL_RESTORE_DEPRECATED_WARNING)
|
#if defined(_STL_RESTORE_DEPRECATED_WARNING)
|
||||||
_STL_RESTORE_DEPRECATED_WARNING
|
_STL_RESTORE_DEPRECATED_WARNING
|
||||||
#endif
|
#endif
|
||||||
#if defined(_MSC_VER)
|
#if defined(_LIBCPP_SUPPRESS_DEPRECATED_POP)
|
||||||
#pragma warning(pop)
|
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include <boost/cstdint.hpp>
|
#include <boost/cstdint.hpp>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
@@ -38,6 +39,27 @@
|
|||||||
|
|
||||||
#endif // defined(_MSC_VER)
|
#endif // defined(_MSC_VER)
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC) && BOOST_MSVC >= 1925
|
||||||
|
# define BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__has_builtin)
|
||||||
|
# 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_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 boost
|
||||||
{
|
{
|
||||||
namespace core
|
namespace core
|
||||||
@@ -45,6 +67,16 @@ namespace core
|
|||||||
|
|
||||||
// bit_cast
|
// bit_cast
|
||||||
|
|
||||||
|
#if defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST)
|
||||||
|
|
||||||
|
template<class To, class From>
|
||||||
|
BOOST_CONSTEXPR To bit_cast( From const & from ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return __builtin_bit_cast( To, from );
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
template<class To, class From>
|
template<class To, class From>
|
||||||
To bit_cast( From const & from ) BOOST_NOEXCEPT
|
To bit_cast( From const & from ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
@@ -55,6 +87,8 @@ To bit_cast( From const & from ) BOOST_NOEXCEPT
|
|||||||
return to;
|
return to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// countl
|
// countl
|
||||||
|
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
@@ -92,6 +126,8 @@ BOOST_CONSTEXPR inline int countl_impl( boost::ulong_long_type x ) BOOST_NOEXCEP
|
|||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT
|
BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
return boost::core::detail::countl_impl( x );
|
return boost::core::detail::countl_impl( x );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,10 +136,51 @@ BOOST_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
if( __builtin_is_constant_evaluated() )
|
||||||
|
{
|
||||||
|
constexpr unsigned char mod37[ 37 ] = { 32, 31, 6, 30, 9, 5, 0, 29, 16, 8, 2, 4, 21, 0, 19, 28, 25, 15, 0, 7, 10, 1, 17, 3, 22, 20, 26, 0, 11, 18, 23, 27, 12, 24, 13, 14, 0 };
|
||||||
|
|
||||||
|
x |= x >> 1;
|
||||||
|
x |= x >> 2;
|
||||||
|
x |= x >> 4;
|
||||||
|
x |= x >> 8;
|
||||||
|
x |= x >> 16;
|
||||||
|
|
||||||
|
return mod37[ x % 37 ];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned long r;
|
||||||
|
|
||||||
|
if( _BitScanReverse( &r, x ) )
|
||||||
|
{
|
||||||
|
return 31 - static_cast<int>( r );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint8_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
inline int countl_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
inline int countl_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
|
||||||
|
|
||||||
unsigned long r;
|
unsigned long r;
|
||||||
|
|
||||||
if( _BitScanReverse( &r, x ) )
|
if( _BitScanReverse( &r, x ) )
|
||||||
@@ -114,44 +191,6 @@ inline int countl_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
|||||||
{
|
{
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static unsigned char const mod37[ 37 ] = { 32, 31, 6, 30, 9, 5, 0, 29, 16, 8, 2, 4, 21, 0, 19, 28, 25, 15, 0, 7, 10, 1, 17, 3, 22, 20, 26, 0, 11, 18, 23, 27, 12, 24, 13, 14, 0 };
|
|
||||||
|
|
||||||
x |= x >> 1;
|
|
||||||
x |= x >> 2;
|
|
||||||
x |= x >> 4;
|
|
||||||
x |= x >> 8;
|
|
||||||
x |= x >> 16;
|
|
||||||
|
|
||||||
return mod37[ x % 37 ];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
|
||||||
{
|
|
||||||
#if defined(_MSC_VER) && defined(_M_X64)
|
|
||||||
|
|
||||||
unsigned long r;
|
|
||||||
|
|
||||||
if( _BitScanReverse64( &r, x ) )
|
|
||||||
{
|
|
||||||
return 63 - static_cast<int>( r );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return static_cast<boost::uint32_t>( x >> 32 ) != 0?
|
|
||||||
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x >> 32 ) ):
|
|
||||||
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) + 32;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int countl_impl( boost::uint8_t x ) BOOST_NOEXCEPT
|
inline int countl_impl( boost::uint8_t x ) BOOST_NOEXCEPT
|
||||||
@@ -164,11 +203,101 @@ inline int countl_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
|||||||
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 16;
|
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
inline int countl_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
static unsigned char const mod37[ 37 ] = { 32, 31, 6, 30, 9, 5, 0, 29, 16, 8, 2, 4, 21, 0, 19, 28, 25, 15, 0, 7, 10, 1, 17, 3, 22, 20, 26, 0, 11, 18, 23, 27, 12, 24, 13, 14, 0 };
|
||||||
|
|
||||||
|
x |= x >> 1;
|
||||||
|
x |= x >> 2;
|
||||||
|
x |= x >> 4;
|
||||||
|
x |= x >> 8;
|
||||||
|
x |= x >> 16;
|
||||||
|
|
||||||
|
return mod37[ x % 37 ];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int countl_impl( boost::uint8_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int countl_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) - 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(_M_X64) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
if( __builtin_is_constant_evaluated() )
|
||||||
|
{
|
||||||
|
return static_cast<boost::uint32_t>( x >> 32 ) != 0?
|
||||||
|
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x >> 32 ) ):
|
||||||
|
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) + 32;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned long r;
|
||||||
|
|
||||||
|
if( _BitScanReverse64( &r, x ) )
|
||||||
|
{
|
||||||
|
return 63 - static_cast<int>( r );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER) && defined(_M_X64)
|
||||||
|
|
||||||
|
inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
unsigned long r;
|
||||||
|
|
||||||
|
if( _BitScanReverse64( &r, x ) )
|
||||||
|
{
|
||||||
|
return 63 - static_cast<int>( r );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return static_cast<boost::uint32_t>( x >> 32 ) != 0?
|
||||||
|
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x >> 32 ) ):
|
||||||
|
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) + 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return static_cast<boost::uint32_t>( x >> 32 ) != 0?
|
||||||
|
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x >> 32 ) ):
|
||||||
|
boost::core::detail::countl_impl( static_cast<boost::uint32_t>( x ) ) + 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
int countl_zero( T x ) BOOST_NOEXCEPT
|
BOOST_CXX14_CONSTEXPR int countl_zero( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) );
|
BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) );
|
||||||
|
|
||||||
BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) )
|
BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) )
|
||||||
@@ -194,6 +323,8 @@ int countl_zero( T x ) BOOST_NOEXCEPT
|
|||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CONSTEXPR int countl_one( T x ) BOOST_NOEXCEPT
|
BOOST_CONSTEXPR int countl_one( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
return boost::core::countl_zero( static_cast<T>( ~x ) );
|
return boost::core::countl_zero( static_cast<T>( ~x ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,6 +365,8 @@ BOOST_CONSTEXPR inline int countr_impl( boost::ulong_long_type x ) BOOST_NOEXCEP
|
|||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT
|
BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
return boost::core::detail::countr_impl( x );
|
return boost::core::detail::countr_impl( x );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,10 +375,44 @@ BOOST_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT
|
|||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
if( __builtin_is_constant_evaluated() )
|
||||||
|
{
|
||||||
|
constexpr unsigned char mod37[ 37 ] = { 32, 0, 1, 26, 2, 23, 27, 0, 3, 16, 24, 30, 28, 11, 0, 13, 4, 7, 17, 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, 21, 14, 9, 5, 20, 8, 19, 18 };
|
||||||
|
return mod37[ ( -(boost::int32_t)x & x ) % 37 ];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned long r;
|
||||||
|
|
||||||
|
if( _BitScanForward( &r, x ) )
|
||||||
|
{
|
||||||
|
return static_cast<int>( r );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint8_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x100 );
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x10000 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
inline int countr_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
inline int countr_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
|
||||||
|
|
||||||
unsigned long r;
|
unsigned long r;
|
||||||
|
|
||||||
if( _BitScanForward( &r, x ) )
|
if( _BitScanForward( &r, x ) )
|
||||||
@@ -256,37 +423,6 @@ inline int countr_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
|||||||
{
|
{
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static unsigned char const mod37[ 37 ] = { 32, 0, 1, 26, 2, 23, 27, 0, 3, 16, 24, 30, 28, 11, 0, 13, 4, 7, 17, 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, 21, 14, 9, 5, 20, 8, 19, 18 };
|
|
||||||
return mod37[ ( -(boost::int32_t)x & x ) % 37 ];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
|
||||||
{
|
|
||||||
#if defined(_MSC_VER) && defined(_M_X64)
|
|
||||||
|
|
||||||
unsigned long r;
|
|
||||||
|
|
||||||
if( _BitScanForward64( &r, x ) )
|
|
||||||
{
|
|
||||||
return static_cast<int>( r );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
return static_cast<boost::uint32_t>( x ) != 0?
|
|
||||||
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) ):
|
|
||||||
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x >> 32 ) ) + 32;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int countr_impl( boost::uint8_t x ) BOOST_NOEXCEPT
|
inline int countr_impl( boost::uint8_t x ) BOOST_NOEXCEPT
|
||||||
@@ -299,11 +435,94 @@ inline int countr_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
|||||||
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x10000 );
|
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x10000 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
inline int countr_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
static unsigned char const mod37[ 37 ] = { 32, 0, 1, 26, 2, 23, 27, 0, 3, 16, 24, 30, 28, 11, 0, 13, 4, 7, 17, 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, 21, 14, 9, 5, 20, 8, 19, 18 };
|
||||||
|
return mod37[ ( -(boost::int32_t)x & x ) % 37 ];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int countr_impl( boost::uint8_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x100 );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int countr_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) | 0x10000 );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(_M_X64) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
if( __builtin_is_constant_evaluated() )
|
||||||
|
{
|
||||||
|
return static_cast<boost::uint32_t>( x ) != 0?
|
||||||
|
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) ):
|
||||||
|
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x >> 32 ) ) + 32;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned long r;
|
||||||
|
|
||||||
|
if( _BitScanForward64( &r, x ) )
|
||||||
|
{
|
||||||
|
return static_cast<int>( r );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER) && defined(_M_X64)
|
||||||
|
|
||||||
|
inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
unsigned long r;
|
||||||
|
|
||||||
|
if( _BitScanForward64( &r, x ) )
|
||||||
|
{
|
||||||
|
return static_cast<int>( r );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return static_cast<boost::uint32_t>( x ) != 0?
|
||||||
|
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) ):
|
||||||
|
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x >> 32 ) ) + 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return static_cast<boost::uint32_t>( x ) != 0?
|
||||||
|
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x ) ):
|
||||||
|
boost::core::detail::countr_impl( static_cast<boost::uint32_t>( x >> 32 ) ) + 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
int countr_zero( T x ) BOOST_NOEXCEPT
|
BOOST_CXX14_CONSTEXPR int countr_zero( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) );
|
BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) );
|
||||||
|
|
||||||
BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) )
|
BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) )
|
||||||
@@ -329,6 +548,8 @@ int countr_zero( T x ) BOOST_NOEXCEPT
|
|||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CONSTEXPR int countr_one( T x ) BOOST_NOEXCEPT
|
BOOST_CONSTEXPR int countr_one( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
return boost::core::countr_zero( static_cast<T>( ~x ) );
|
return boost::core::countr_zero( static_cast<T>( ~x ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,6 +598,8 @@ BOOST_CORE_POPCOUNT_CONSTEXPR inline int popcount_impl( boost::ulong_long_type x
|
|||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT
|
BOOST_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
return boost::core::detail::popcount_impl( x );
|
return boost::core::detail::popcount_impl( x );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,6 +631,8 @@ BOOST_CXX14_CONSTEXPR inline int popcount_impl( boost::uint64_t x ) BOOST_NOEXCE
|
|||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT
|
BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT( sizeof(T) <= sizeof(boost::uint64_t) );
|
BOOST_STATIC_ASSERT( sizeof(T) <= sizeof(boost::uint64_t) );
|
||||||
|
|
||||||
BOOST_IF_CONSTEXPR ( sizeof(T) <= sizeof(boost::uint32_t) )
|
BOOST_IF_CONSTEXPR ( sizeof(T) <= sizeof(boost::uint32_t) )
|
||||||
@@ -427,15 +652,19 @@ BOOST_CXX14_CONSTEXPR int popcount( T x ) BOOST_NOEXCEPT
|
|||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT
|
BOOST_CXX14_CONSTEXPR T rotl( T x, int s ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
unsigned const mask = std::numeric_limits<T>::digits - 1;
|
unsigned const mask = std::numeric_limits<T>::digits - 1;
|
||||||
return x << (s & mask) | x >> ((-s) & mask);
|
return static_cast<T>( x << (static_cast<unsigned>( s ) & mask) | x >> (static_cast<unsigned>( -s ) & mask) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT
|
BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
unsigned const mask = std::numeric_limits<T>::digits - 1;
|
unsigned const mask = std::numeric_limits<T>::digits - 1;
|
||||||
return x >> (s & mask) | x << ((-s) & mask);
|
return static_cast<T>( x >> (static_cast<unsigned>( s ) & mask) | x << (static_cast<unsigned>( -s ) & mask) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// integral powers of 2
|
// integral powers of 2
|
||||||
@@ -443,22 +672,28 @@ BOOST_CXX14_CONSTEXPR T rotr( T x, int s ) BOOST_NOEXCEPT
|
|||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT
|
BOOST_CONSTEXPR bool has_single_bit( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
return x != 0 && ( x & ( x - 1 ) ) == 0;
|
return x != 0 && ( x & ( x - 1 ) ) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bit_width should return int, https://cplusplus.github.io/LWG/issue3656
|
// bit_width returns `int` now, https://cplusplus.github.io/LWG/issue3656
|
||||||
|
// has been applied to C++20 as a DR
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CONSTEXPR T bit_width( T x ) BOOST_NOEXCEPT
|
BOOST_CONSTEXPR int bit_width( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return static_cast<T>(
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
std::numeric_limits<T>::digits - boost::core::countl_zero( x ) );
|
|
||||||
|
return std::numeric_limits<T>::digits - boost::core::countl_zero( x );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CONSTEXPR T bit_floor( T x ) BOOST_NOEXCEPT
|
BOOST_CONSTEXPR T bit_floor( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return x == 0? 0: T(1) << ( boost::core::bit_width( x ) - 1 );
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
|
return x == 0? T(0): static_cast<T>( T(1) << ( boost::core::bit_width( x ) - 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
@@ -510,6 +745,8 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x )
|
|||||||
template<class T>
|
template<class T>
|
||||||
BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT
|
BOOST_CXX14_CONSTEXPR T bit_ceil( T x ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer && !std::numeric_limits<T>::is_signed );
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT( sizeof(T) <= sizeof(boost::uint64_t) );
|
BOOST_STATIC_ASSERT( sizeof(T) <= sizeof(boost::uint64_t) );
|
||||||
|
|
||||||
BOOST_IF_CONSTEXPR ( sizeof(T) <= sizeof(boost::uint32_t) )
|
BOOST_IF_CONSTEXPR ( sizeof(T) <= sizeof(boost::uint32_t) )
|
||||||
@@ -585,6 +822,128 @@ typedef endian::type endian_type;
|
|||||||
|
|
||||||
#undef BOOST_CORE_BIT_NATIVE_INITIALIZER
|
#undef BOOST_CORE_BIT_NATIVE_INITIALIZER
|
||||||
|
|
||||||
|
// byteswap
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
BOOST_CONSTEXPR inline boost::uint8_t byteswap_impl( boost::uint8_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
return __builtin_bswap32( x );
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline boost::uint64_t byteswap_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return __builtin_bswap64( x );
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
if( __builtin_is_constant_evaluated() )
|
||||||
|
{
|
||||||
|
boost::uint32_t step16 = x << 16 | x >> 16;
|
||||||
|
return ((step16 << 8) & 0xff00ff00) | ((step16 >> 8) & 0x00ff00ff);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _byteswap_ulong( x );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline boost::uint64_t byteswap_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
if( __builtin_is_constant_evaluated() )
|
||||||
|
{
|
||||||
|
boost::uint64_t step32 = x << 32 | x >> 32;
|
||||||
|
boost::uint64_t step16 = (step32 & 0x0000FFFF0000FFFFULL) << 16 | (step32 & 0xFFFF0000FFFF0000ULL) >> 16;
|
||||||
|
return (step16 & 0x00FF00FF00FF00FFULL) << 8 | (step16 & 0xFF00FF00FF00FF00ULL) >> 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _byteswap_uint64( x );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
|
inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return _byteswap_ulong( x );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline boost::uint64_t byteswap_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return _byteswap_uint64( x );
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline boost::uint32_t byteswap_impl( boost::uint32_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
boost::uint32_t step16 = x << 16 | x >> 16;
|
||||||
|
return ((step16 << 8) & 0xff00ff00) | ((step16 >> 8) & 0x00ff00ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_CXX14_CONSTEXPR inline boost::uint64_t byteswap_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
boost::uint64_t step32 = x << 32 | x >> 32;
|
||||||
|
boost::uint64_t step16 = (step32 & 0x0000FFFF0000FFFFULL) << 16 | (step32 & 0xFFFF0000FFFF0000ULL) >> 16;
|
||||||
|
return (step16 & 0x00FF00FF00FF00FFULL) << 8 | (step16 & 0xFF00FF00FF00FF00ULL) >> 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
template<class T> BOOST_CXX14_CONSTEXPR T byteswap( T x ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_integer );
|
||||||
|
|
||||||
|
BOOST_STATIC_ASSERT( sizeof(T) == sizeof(boost::uint8_t) || sizeof(T) == sizeof(boost::uint16_t) || sizeof(T) == sizeof(boost::uint32_t) || sizeof(T) == sizeof(boost::uint64_t) );
|
||||||
|
|
||||||
|
BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint8_t) )
|
||||||
|
{
|
||||||
|
return static_cast<T>( boost::core::detail::byteswap_impl( static_cast<boost::uint8_t>( x ) ) );
|
||||||
|
}
|
||||||
|
else BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint16_t) )
|
||||||
|
{
|
||||||
|
return static_cast<T>( boost::core::detail::byteswap_impl( static_cast<boost::uint16_t>( x ) ) );
|
||||||
|
}
|
||||||
|
else BOOST_IF_CONSTEXPR ( sizeof(T) == sizeof(boost::uint32_t) )
|
||||||
|
{
|
||||||
|
return static_cast<T>( boost::core::detail::byteswap_impl( static_cast<boost::uint32_t>( x ) ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return static_cast<T>( boost::core::detail::byteswap_impl( static_cast<boost::uint64_t>( x ) ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace core
|
} // namespace core
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
|||||||
@@ -30,16 +30,33 @@ namespace boost
|
|||||||
|
|
||||||
template<class T> inline void checked_delete(T * x) BOOST_NOEXCEPT
|
template<class T> inline void checked_delete(T * x) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
// intentionally complex - simplification causes regressions
|
#if defined(__cpp_static_assert) && __cpp_static_assert >= 200410L
|
||||||
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
|
|
||||||
|
static_assert( sizeof(T) != 0, "Type must be complete" );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
typedef char type_must_be_complete[ sizeof(T) ];
|
||||||
(void) sizeof(type_must_be_complete);
|
(void) sizeof(type_must_be_complete);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
delete x;
|
delete x;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> inline void checked_array_delete(T * x) BOOST_NOEXCEPT
|
template<class T> inline void checked_array_delete(T * x) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
|
#if defined(__cpp_static_assert) && __cpp_static_assert >= 200410L
|
||||||
|
|
||||||
|
static_assert( sizeof(T) != 0, "Type must be complete" );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
typedef char type_must_be_complete[ sizeof(T) ];
|
||||||
(void) sizeof(type_must_be_complete);
|
(void) sizeof(type_must_be_complete);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
delete [] x;
|
delete [] x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
46
include/boost/core/data.hpp
Normal file
46
include/boost/core/data.hpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2023 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_DATA_HPP
|
||||||
|
#define BOOST_CORE_DATA_HPP
|
||||||
|
|
||||||
|
#include <initializer_list>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class C>
|
||||||
|
inline constexpr auto
|
||||||
|
data(C& c) noexcept(noexcept(c.data())) -> decltype(c.data())
|
||||||
|
{
|
||||||
|
return c.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class C>
|
||||||
|
inline constexpr auto
|
||||||
|
data(const C& c) noexcept(noexcept(c.data())) -> decltype(c.data())
|
||||||
|
{
|
||||||
|
return c.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
inline constexpr T*
|
||||||
|
data(T(&a)[N]) noexcept
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline constexpr const T*
|
||||||
|
data(std::initializer_list<T> l) noexcept
|
||||||
|
{
|
||||||
|
return l.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
|
||||||
|
#endif
|
||||||
39
include/boost/core/detail/is_same.hpp
Normal file
39
include/boost/core/detail/is_same.hpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef BOOST_CORE_DETAIL_IS_SAME_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_DETAIL_IS_SAME_HPP_INCLUDED
|
||||||
|
|
||||||
|
// is_same<T1,T2>::value is true when T1 == T2
|
||||||
|
//
|
||||||
|
// Copyright 2014 Peter Dimov
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
template< class T1, class T2 > struct is_same
|
||||||
|
{
|
||||||
|
BOOST_STATIC_CONSTANT( bool, value = false );
|
||||||
|
};
|
||||||
|
|
||||||
|
template< class T > struct is_same< T, T >
|
||||||
|
{
|
||||||
|
BOOST_STATIC_CONSTANT( bool, value = true );
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_DETAIL_IS_SAME_HPP_INCLUDED
|
||||||
66
include/boost/core/detail/lwt_unattended.hpp
Normal file
66
include/boost/core/detail/lwt_unattended.hpp
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#ifndef BOOST_CORE_DETAIL_LWT_UNATTENDED_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_DETAIL_LWT_UNATTENDED_HPP_INCLUDED
|
||||||
|
|
||||||
|
// Copyright 2014, 2022 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG)
|
||||||
|
# include <crtdbg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
// Setup unattended mode by disabling interactive popups on
|
||||||
|
// assertion failures
|
||||||
|
|
||||||
|
inline void lwt_unattended()
|
||||||
|
{
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER > 1310)
|
||||||
|
|
||||||
|
// disable message boxes on assert(), abort()
|
||||||
|
::_set_abort_behavior( 0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT );
|
||||||
|
|
||||||
|
# pragma warning(push)
|
||||||
|
# pragma warning(disable: 4996)
|
||||||
|
|
||||||
|
# if defined(__clang__)
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY == 100 /*WINAPI_FAMILY_DESKTOP_APP*/
|
||||||
|
|
||||||
|
// disable message box on crash
|
||||||
|
::_seterrormode( /*SEM_NOGPFAULTERRORBOX*/ 0x0002 );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# if defined(__clang__)
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# pragma warning(pop)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG)
|
||||||
|
|
||||||
|
// disable message boxes on iterator debugging violations
|
||||||
|
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
|
||||||
|
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_DETAIL_LWT_UNATTENDED_HPP_INCLUDED
|
||||||
71
include/boost/core/detail/sp_thread_pause.hpp
Normal file
71
include/boost/core/detail/sp_thread_pause.hpp
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
#ifndef BOOST_CORE_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// boost/core/detail/sp_thread_pause.hpp
|
||||||
|
//
|
||||||
|
// inline void bost::core::sp_thread_pause();
|
||||||
|
//
|
||||||
|
// Emits a "pause" instruction.
|
||||||
|
//
|
||||||
|
// Copyright 2008, 2020, 2023 Peter Dimov
|
||||||
|
// 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_ia32_pause) && !defined(__INTEL_COMPILER)
|
||||||
|
# define BOOST_CORE_HAS_BUILTIN_IA32_PAUSE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BOOST_CORE_HAS_BUILTIN_IA32_PAUSE)
|
||||||
|
|
||||||
|
# define BOOST_CORE_SP_PAUSE() __builtin_ia32_pause()
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER) && ( defined(_M_IX86) || defined(_M_X64) )
|
||||||
|
|
||||||
|
# include <intrin.h>
|
||||||
|
# define BOOST_CORE_SP_PAUSE() _mm_pause()
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER) && ( defined(_M_ARM) || defined(_M_ARM64) )
|
||||||
|
|
||||||
|
# include <intrin.h>
|
||||||
|
# define BOOST_CORE_SP_PAUSE() __yield()
|
||||||
|
|
||||||
|
#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
|
||||||
|
|
||||||
|
# define BOOST_CORE_SP_PAUSE() __asm__ __volatile__( "rep; nop" : : : "memory" )
|
||||||
|
|
||||||
|
#elif defined(__GNUC__) && ( (defined(__ARM_ARCH) && __ARM_ARCH >= 8) || defined(__ARM_ARCH_8A__) || defined(__aarch64__) )
|
||||||
|
|
||||||
|
# define BOOST_CORE_SP_PAUSE() __asm__ __volatile__( "yield" : : : "memory" )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
# define BOOST_CORE_SP_PAUSE() ((void)0)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
BOOST_FORCEINLINE void sp_thread_pause() BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
BOOST_CORE_SP_PAUSE();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#undef BOOST_CORE_SP_PAUSE
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED
|
||||||
122
include/boost/core/detail/sp_thread_sleep.hpp
Normal file
122
include/boost/core/detail/sp_thread_sleep.hpp
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
#ifndef BOOST_CORE_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// boost/core/detail/sp_thread_sleep.hpp
|
||||||
|
//
|
||||||
|
// inline void bost::core::sp_thread_sleep();
|
||||||
|
//
|
||||||
|
// Cease execution for a while to yield to other threads,
|
||||||
|
// as if by calling nanosleep() with an appropriate interval.
|
||||||
|
//
|
||||||
|
// Copyright 2008, 2020, 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/config/pragma_message.hpp>
|
||||||
|
|
||||||
|
#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
|
||||||
|
|
||||||
|
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
||||||
|
BOOST_PRAGMA_MESSAGE("Using Sleep(1) in sp_thread_sleep")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/core/detail/sp_win32_sleep.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
inline void sp_thread_sleep() BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
Sleep( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
using boost::core::detail::sp_thread_sleep;
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#elif defined(BOOST_HAS_NANOSLEEP)
|
||||||
|
|
||||||
|
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
||||||
|
BOOST_PRAGMA_MESSAGE("Using nanosleep() in sp_thread_sleep")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
|
||||||
|
# include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
inline void sp_thread_sleep() BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
|
||||||
|
|
||||||
|
int oldst;
|
||||||
|
pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &oldst );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// g++ -Wextra warns on {} or {0}
|
||||||
|
struct timespec rqtp = { 0, 0 };
|
||||||
|
|
||||||
|
// POSIX says that timespec has tv_sec and tv_nsec
|
||||||
|
// But it doesn't guarantee order or placement
|
||||||
|
|
||||||
|
rqtp.tv_sec = 0;
|
||||||
|
rqtp.tv_nsec = 1000;
|
||||||
|
|
||||||
|
nanosleep( &rqtp, 0 );
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
|
||||||
|
|
||||||
|
pthread_setcancelstate( oldst, &oldst );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
||||||
|
BOOST_PRAGMA_MESSAGE("Using sp_thread_yield() in sp_thread_sleep")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/core/detail/sp_thread_yield.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
inline void sp_thread_sleep() BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
sp_thread_yield();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED
|
||||||
100
include/boost/core/detail/sp_thread_yield.hpp
Normal file
100
include/boost/core/detail/sp_thread_yield.hpp
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
#ifndef BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// boost/core/detail/sp_thread_yield.hpp
|
||||||
|
//
|
||||||
|
// inline void bost::core::sp_thread_yield();
|
||||||
|
//
|
||||||
|
// Gives up the remainder of the time slice,
|
||||||
|
// as if by calling sched_yield().
|
||||||
|
//
|
||||||
|
// Copyright 2008, 2020 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/config/pragma_message.hpp>
|
||||||
|
|
||||||
|
#if defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
|
||||||
|
|
||||||
|
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
||||||
|
BOOST_PRAGMA_MESSAGE("Using SwitchToThread() in sp_thread_yield")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/core/detail/sp_win32_sleep.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
inline void sp_thread_yield() BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
SwitchToThread();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
using boost::core::detail::sp_thread_yield;
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#elif defined(BOOST_HAS_SCHED_YIELD)
|
||||||
|
|
||||||
|
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
||||||
|
BOOST_PRAGMA_MESSAGE("Using sched_yield() in sp_thread_yield")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _AIX
|
||||||
|
# include <sched.h>
|
||||||
|
#else
|
||||||
|
// AIX's sched.h defines ::var which sometimes conflicts with Lambda's var
|
||||||
|
extern "C" int sched_yield(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
inline void sp_thread_yield() BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
sched_yield();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
||||||
|
BOOST_PRAGMA_MESSAGE("Using sp_thread_pause() in sp_thread_yield")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/core/detail/sp_thread_pause.hpp>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
inline void sp_thread_yield() BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
sp_thread_pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED
|
||||||
54
include/boost/core/detail/sp_win32_sleep.hpp
Normal file
54
include/boost/core/detail/sp_win32_sleep.hpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#ifndef BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// boost/core/detail/sp_win32_sleep.hpp
|
||||||
|
//
|
||||||
|
// Declares the Win32 Sleep() function.
|
||||||
|
//
|
||||||
|
// Copyright 2008, 2020 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#if defined( BOOST_USE_WINDOWS_H )
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
#if !defined( BOOST_USE_WINDOWS_H )
|
||||||
|
|
||||||
|
#if defined(__clang__) && defined(__x86_64__)
|
||||||
|
// clang x64 warns that __stdcall is ignored
|
||||||
|
# define BOOST_CORE_SP_STDCALL
|
||||||
|
#else
|
||||||
|
# define BOOST_CORE_SP_STDCALL __stdcall
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__LP64__) // Cygwin 64
|
||||||
|
extern "C" __declspec(dllimport) void BOOST_CORE_SP_STDCALL Sleep( unsigned int ms );
|
||||||
|
#else
|
||||||
|
extern "C" __declspec(dllimport) void BOOST_CORE_SP_STDCALL Sleep( unsigned long ms );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern "C" __declspec(dllimport) int BOOST_CORE_SP_STDCALL SwitchToThread();
|
||||||
|
|
||||||
|
#undef BOOST_CORE_SP_STDCALL
|
||||||
|
|
||||||
|
#endif // !defined( BOOST_USE_WINDOWS_H )
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
// https://www.boost.org/LICENSE_1_0.txt
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
#include <boost/core/enable_if.hpp>
|
#include <boost/core/enable_if.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
#include <boost/core/detail/is_same.hpp>
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/assert/source_location.hpp>
|
#include <boost/assert/source_location.hpp>
|
||||||
#include <boost/throw_exception.hpp>
|
#include <boost/throw_exception.hpp>
|
||||||
@@ -381,7 +381,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class End> BOOST_CXX14_CONSTEXPR basic_string_view( Ch const* first, End last,
|
template<class End> BOOST_CXX14_CONSTEXPR basic_string_view( Ch const* first, End last,
|
||||||
typename boost::enable_if<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_( last - first )
|
||||||
{
|
{
|
||||||
BOOST_ASSERT( last - first >= 0 );
|
BOOST_ASSERT( last - first >= 0 );
|
||||||
}
|
}
|
||||||
@@ -399,10 +399,26 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<class Ch2> basic_string_view( boost::basic_string_view<Ch2, std::char_traits<Ch2> > const& str,
|
template<class Ch2> basic_string_view( boost::basic_string_view<Ch2, std::char_traits<Ch2> > const& str,
|
||||||
typename boost::enable_if<is_same<Ch, Ch2> >::type* = 0 ) BOOST_NOEXCEPT: p_( str.data() ), n_( str.size() )
|
typename boost::enable_if<boost::core::detail::is_same<Ch, Ch2> >::type* = 0 ) BOOST_NOEXCEPT: p_( str.data() ), n_( str.size() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_NULLPTR)
|
||||||
|
# if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
|
||||||
|
|
||||||
|
basic_string_view( std::nullptr_t ) = delete;
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
basic_string_view( std::nullptr_t );
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// BOOST_CONSTEXPR basic_string_view& operator=( basic_string_view const& ) BOOST_NOEXCEPT & = default;
|
// BOOST_CONSTEXPR basic_string_view& operator=( basic_string_view const& ) BOOST_NOEXCEPT & = default;
|
||||||
|
|
||||||
// conversions
|
// conversions
|
||||||
@@ -414,7 +430,7 @@ public:
|
|||||||
|
|
||||||
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
|
||||||
|
|
||||||
template<class Ch2, class En = typename boost::enable_if<is_same<Ch2, Ch> >::type>
|
template<class Ch2, class En = typename boost::enable_if<boost::core::detail::is_same<Ch2, Ch> >::type>
|
||||||
operator std::basic_string_view<Ch2>() const BOOST_NOEXCEPT
|
operator std::basic_string_view<Ch2>() const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return std::basic_string_view<Ch>( data(), size() );
|
return std::basic_string_view<Ch>( data(), size() );
|
||||||
@@ -423,7 +439,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<class Ch2> operator boost::basic_string_view<Ch2,
|
template<class Ch2> operator boost::basic_string_view<Ch2,
|
||||||
typename boost::enable_if<boost::core::is_same<Ch2, Ch>, std::char_traits<Ch> >::type> () const BOOST_NOEXCEPT
|
typename boost::enable_if<boost::core::detail::is_same<Ch2, Ch>, std::char_traits<Ch> >::type> () const BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return boost::basic_string_view< Ch, std::char_traits<Ch> >( data(), size() );
|
return boost::basic_string_view< Ch, std::char_traits<Ch> >( data(), size() );
|
||||||
}
|
}
|
||||||
@@ -589,7 +605,7 @@ public:
|
|||||||
if( cmp != 0 ) return cmp;
|
if( cmp != 0 ) return cmp;
|
||||||
|
|
||||||
if( size() == str.size() ) return 0;
|
if( size() == str.size() ) return 0;
|
||||||
|
|
||||||
return size() < str.size()? -1: +1;
|
return size() < str.size()? -1: +1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,37 +56,37 @@ public:
|
|||||||
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
||||||
empty_value() = default;
|
empty_value() = default;
|
||||||
#else
|
#else
|
||||||
empty_value() { }
|
BOOST_CONSTEXPR empty_value() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
empty_value(boost::empty_init_t)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t)
|
||||||
: value_() { }
|
: value_() { }
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
template<class U, class... Args>
|
template<class U, class... Args>
|
||||||
empty_value(boost::empty_init_t, U&& value, Args&&... args)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args)
|
||||||
: value_(std::forward<U>(value), std::forward<Args>(args)...) { }
|
: value_(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||||
#else
|
#else
|
||||||
template<class U>
|
template<class U>
|
||||||
empty_value(boost::empty_init_t, U&& value)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value)
|
||||||
: value_(std::forward<U>(value)) { }
|
: value_(std::forward<U>(value)) { }
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
template<class U>
|
template<class U>
|
||||||
empty_value(boost::empty_init_t, const U& value)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value)
|
||||||
: value_(value) { }
|
: value_(value) { }
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
empty_value(boost::empty_init_t, U& value)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value)
|
||||||
: value_(value) { }
|
: value_(value) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const T& get() const BOOST_NOEXCEPT {
|
BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT {
|
||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
T& get() BOOST_NOEXCEPT {
|
BOOST_CXX14_CONSTEXPR T& get() BOOST_NOEXCEPT {
|
||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,37 +104,37 @@ public:
|
|||||||
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
||||||
empty_value() = default;
|
empty_value() = default;
|
||||||
#else
|
#else
|
||||||
empty_value() { }
|
BOOST_CONSTEXPR empty_value() { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
empty_value(boost::empty_init_t)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t)
|
||||||
: T() { }
|
: T() { }
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
template<class U, class... Args>
|
template<class U, class... Args>
|
||||||
empty_value(boost::empty_init_t, U&& value, Args&&... args)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args)
|
||||||
: T(std::forward<U>(value), std::forward<Args>(args)...) { }
|
: T(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||||
#else
|
#else
|
||||||
template<class U>
|
template<class U>
|
||||||
empty_value(boost::empty_init_t, U&& value)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value)
|
||||||
: T(std::forward<U>(value)) { }
|
: T(std::forward<U>(value)) { }
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
template<class U>
|
template<class U>
|
||||||
empty_value(boost::empty_init_t, const U& value)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value)
|
||||||
: T(value) { }
|
: T(value) { }
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
empty_value(boost::empty_init_t, U& value)
|
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value)
|
||||||
: T(value) { }
|
: T(value) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const T& get() const BOOST_NOEXCEPT {
|
BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
T& get() BOOST_NOEXCEPT {
|
BOOST_CXX14_CONSTEXPR T& get() BOOST_NOEXCEPT {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
46
include/boost/core/fclose_deleter.hpp
Normal file
46
include/boost/core/fclose_deleter.hpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright Andrey Semashev 2022.
|
||||||
|
* 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.hpp
|
||||||
|
* \author Andrey Semashev
|
||||||
|
* \date 21.09.2022
|
||||||
|
*
|
||||||
|
* This header contains an \c fclose_deleter implementation. This is a deleter
|
||||||
|
* function object that invokes <tt>std::fclose</tt> on the passed pointer to
|
||||||
|
* a <tt>std::FILE</tt> structure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOOST_CORE_FCLOSE_DELETER_HPP
|
||||||
|
#define BOOST_CORE_FCLOSE_DELETER_HPP
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
//! A function object that closes a file
|
||||||
|
struct fclose_deleter
|
||||||
|
{
|
||||||
|
//! Function object result type
|
||||||
|
typedef void result_type;
|
||||||
|
/*!
|
||||||
|
* Closes the file handle
|
||||||
|
*/
|
||||||
|
void operator() (std::FILE* p) const BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
if (BOOST_LIKELY(!!p))
|
||||||
|
std::fclose(p);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // BOOST_CORE_FCLOSE_DELETER_HPP
|
||||||
61
include/boost/core/identity.hpp
Normal file
61
include/boost/core/identity.hpp
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2021-2023 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_IDENTITY_HPP
|
||||||
|
#define BOOST_CORE_IDENTITY_HPP
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
#include <utility>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
struct identity {
|
||||||
|
typedef void is_transparent;
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
template<class T>
|
||||||
|
BOOST_CONSTEXPR T&& operator()(T&& value) const BOOST_NOEXCEPT {
|
||||||
|
return std::forward<T>(value);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
template<class T>
|
||||||
|
BOOST_CONSTEXPR const T& operator()(const T& value) const BOOST_NOEXCEPT {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
BOOST_CONSTEXPR T& operator()(T& value) const BOOST_NOEXCEPT {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
template<class>
|
||||||
|
struct result { };
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct result<identity(T&)> {
|
||||||
|
typedef T& type;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
|
template<class T>
|
||||||
|
struct result<identity(T)> {
|
||||||
|
typedef T&& type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
struct result<identity(T&&)> {
|
||||||
|
typedef T&& type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
|
||||||
|
#endif
|
||||||
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
|
||||||
@@ -1,12 +1,6 @@
|
|||||||
#ifndef BOOST_CORE_IS_SAME_HPP_INCLUDED
|
#ifndef BOOST_CORE_IS_SAME_HPP_INCLUDED
|
||||||
#define BOOST_CORE_IS_SAME_HPP_INCLUDED
|
#define BOOST_CORE_IS_SAME_HPP_INCLUDED
|
||||||
|
|
||||||
// MS compatible compilers support #pragma once
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
|
||||||
# pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// is_same<T1,T2>::value is true when T1 == T2
|
// is_same<T1,T2>::value is true when T1 == T2
|
||||||
//
|
//
|
||||||
// Copyright 2014 Peter Dimov
|
// Copyright 2014 Peter Dimov
|
||||||
@@ -16,6 +10,15 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/core/detail/is_same.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <boost/config/header_deprecated.hpp>
|
||||||
|
|
||||||
|
BOOST_HEADER_DEPRECATED("<boost/type_traits/is_same.hpp>")
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
@@ -23,15 +26,7 @@ namespace boost
|
|||||||
namespace core
|
namespace core
|
||||||
{
|
{
|
||||||
|
|
||||||
template< class T1, class T2 > struct is_same
|
using boost::core::detail::is_same;
|
||||||
{
|
|
||||||
BOOST_STATIC_CONSTANT( bool, value = false );
|
|
||||||
};
|
|
||||||
|
|
||||||
template< class T > struct is_same< T, T >
|
|
||||||
{
|
|
||||||
BOOST_STATIC_CONSTANT( bool, value = true );
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace core
|
} // namespace core
|
||||||
|
|
||||||
|
|||||||
55
include/boost/core/launder.hpp
Normal file
55
include/boost/core/launder.hpp
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#ifndef BOOST_CORE_LAUNDER_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_LAUNDER_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#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>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
#if defined(BOOST_CORE_HAS_BUILTIN_LAUNDER)
|
||||||
|
|
||||||
|
template<class T> T* launder( T* p )
|
||||||
|
{
|
||||||
|
return __builtin_launder( p );
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && defined(__cpp_lib_launder)
|
||||||
|
|
||||||
|
template<class T> T* launder( T* p )
|
||||||
|
{
|
||||||
|
return std::launder( p );
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
template<class T> T* launder( T* p )
|
||||||
|
{
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_LAUNDER_HPP_INCLUDED
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt
|
// http://www.boost.org/LICENSE_1_0.txt
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <boost/core/detail/lwt_unattended.hpp>
|
||||||
#include <boost/current_function.hpp>
|
#include <boost/current_function.hpp>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
@@ -32,11 +33,6 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG)
|
|
||||||
# include <crtdbg.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// IDE's like Visual Studio perform better if output goes to std::cout or
|
// IDE's like Visual Studio perform better if output goes to std::cout or
|
||||||
// some other stream, so allow user to configure output stream:
|
// some other stream, so allow user to configure output stream:
|
||||||
@@ -46,42 +42,39 @@
|
|||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
class test_result {
|
class test_result
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
test_result()
|
|
||||||
: report_(false)
|
test_result(): report_( false ), errors_( 0 )
|
||||||
, errors_(0) {
|
{
|
||||||
#if defined(_MSC_VER) && (_MSC_VER > 1310)
|
core::detail::lwt_unattended();
|
||||||
// disable message boxes on assert(), abort()
|
|
||||||
::_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
|
||||||
#endif
|
|
||||||
#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG)
|
|
||||||
// disable message boxes on iterator debugging violations
|
|
||||||
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
|
|
||||||
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~test_result() {
|
~test_result()
|
||||||
if (!report_) {
|
{
|
||||||
|
if( !report_ )
|
||||||
|
{
|
||||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "main() should return report_errors()" << std::endl;
|
BOOST_LIGHTWEIGHT_TEST_OSTREAM << "main() should return report_errors()" << std::endl;
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int& errors() {
|
int& errors()
|
||||||
|
{
|
||||||
return errors_;
|
return errors_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void done() {
|
void done()
|
||||||
|
{
|
||||||
report_ = true;
|
report_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool report_;
|
bool report_;
|
||||||
int errors_;
|
int errors_;
|
||||||
};
|
};
|
||||||
@@ -197,11 +190,6 @@ inline unsigned long test_output_impl( char16_t const& v ) { return v; }
|
|||||||
inline unsigned long test_output_impl( char32_t const& v ) { return v; }
|
inline unsigned long test_output_impl( char32_t const& v ) { return v; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable: 4996)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline std::string test_output_impl( char const& v )
|
inline std::string test_output_impl( char const& v )
|
||||||
{
|
{
|
||||||
if( std::isprint( static_cast<unsigned char>( v ) ) )
|
if( std::isprint( static_cast<unsigned char>( v ) ) )
|
||||||
@@ -210,17 +198,17 @@ inline std::string test_output_impl( char const& v )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buffer[ 8 ];
|
static const char char_table[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||||
std::sprintf( buffer, "\\x%02X", static_cast<unsigned char>( v ) );
|
char buffer[ 4 ];
|
||||||
|
buffer[ 0 ] = '\\';
|
||||||
|
buffer[ 1 ] = 'x';
|
||||||
|
buffer[ 2 ] = char_table[ (static_cast<unsigned char>( v ) >> 4u) & 0x0f ];
|
||||||
|
buffer[ 3 ] = char_table[ static_cast<unsigned char>( v ) & 0x0f ];
|
||||||
|
|
||||||
return buffer;
|
return std::string( buffer, 4u );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// predicates
|
// predicates
|
||||||
|
|
||||||
struct lw_test_eq
|
struct lw_test_eq
|
||||||
@@ -530,6 +518,15 @@ inline int report_errors()
|
|||||||
return errors < 256? errors: 255;
|
return errors < 256? errors: 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
inline void lwt_init()
|
||||||
|
{
|
||||||
|
boost::detail::test_results();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
#define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) )
|
#define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) )
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <boost/core/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <boost/core/type_name.hpp>
|
#include <boost/core/type_name.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
#include <boost/core/detail/is_same.hpp>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
@@ -56,7 +56,7 @@ template<class T> inline bool test_trait_same_impl_( T )
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class T1, class T2> inline void test_trait_same_impl( char const * types,
|
template<class T1, class T2> inline void test_trait_same_impl( char const * types,
|
||||||
boost::core::is_same<T1, T2> same, char const * file, int line, char const * function )
|
boost::core::detail::is_same<T1, T2> same, char const * file, int line, char const * function )
|
||||||
{
|
{
|
||||||
if( test_trait_same_impl_( same ) )
|
if( test_trait_same_impl_( same ) )
|
||||||
{
|
{
|
||||||
@@ -86,6 +86,6 @@ template<class T1, class T2> inline void test_trait_same_impl( char const * type
|
|||||||
# pragma GCC system_header
|
# pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BOOST_TEST_TRAIT_SAME(...) ( ::boost::detail::test_trait_same_impl(#__VA_ARGS__, ::boost::core::is_same<__VA_ARGS__>(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
|
#define BOOST_TEST_TRAIT_SAME(...) ( ::boost::detail::test_trait_same_impl(#__VA_ARGS__, ::boost::core::detail::is_same< __VA_ARGS__ >(), __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
|
||||||
|
|
||||||
#endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP
|
#endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP
|
||||||
|
|||||||
59
include/boost/core/make_span.hpp
Normal file
59
include/boost/core/make_span.hpp
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2023 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_MAKE_SPAN_HPP
|
||||||
|
#define BOOST_CORE_MAKE_SPAN_HPP
|
||||||
|
|
||||||
|
#include <boost/core/span.hpp>
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class I>
|
||||||
|
inline constexpr span<I>
|
||||||
|
make_span(I* f, std::size_t c) noexcept
|
||||||
|
{
|
||||||
|
return span<I>(f, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class I>
|
||||||
|
inline constexpr span<I>
|
||||||
|
make_span(I* f, I* l) noexcept
|
||||||
|
{
|
||||||
|
return span<I>(f, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
inline constexpr span<T, N>
|
||||||
|
make_span(T(&a)[N]) noexcept
|
||||||
|
{
|
||||||
|
return span<T, N>(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
inline constexpr span<T, N>
|
||||||
|
make_span(std::array<T, N>& a) noexcept
|
||||||
|
{
|
||||||
|
return span<T, N>(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
inline constexpr span<const T, N>
|
||||||
|
make_span(const std::array<T, N>& a) noexcept
|
||||||
|
{
|
||||||
|
return span<const T, N>(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class R>
|
||||||
|
inline span<typename detail::span_data<R>::type>
|
||||||
|
make_span(R&& r)
|
||||||
|
{
|
||||||
|
return span<typename detail::span_data<R>::type>(std::forward<R>(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
|
||||||
|
#endif
|
||||||
82
include/boost/core/max_align.hpp
Normal file
82
include/boost/core/max_align.hpp
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
#ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_MAX_ALIGN_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/core/alignof.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
// BOOST_CORE_HAS_FLOAT128
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_FLOAT128)
|
||||||
|
|
||||||
|
# define BOOST_CORE_HAS_FLOAT128
|
||||||
|
|
||||||
|
#elif defined(__SIZEOF_FLOAT128__)
|
||||||
|
|
||||||
|
# define BOOST_CORE_HAS_FLOAT128
|
||||||
|
|
||||||
|
#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 404) && defined(__i386__)
|
||||||
|
|
||||||
|
# define BOOST_CORE_HAS_FLOAT128
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// max_align_t, max_align
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
union max_align_t
|
||||||
|
{
|
||||||
|
char c;
|
||||||
|
short s;
|
||||||
|
int i;
|
||||||
|
long l;
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_LONG_LONG)
|
||||||
|
|
||||||
|
boost::long_long_type ll;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_INT128)
|
||||||
|
|
||||||
|
boost::int128_type i128;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float f;
|
||||||
|
double d;
|
||||||
|
long double ld;
|
||||||
|
|
||||||
|
#if defined(BOOST_CORE_HAS_FLOAT128)
|
||||||
|
|
||||||
|
__float128 f128;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void* p;
|
||||||
|
void (*pf) ();
|
||||||
|
|
||||||
|
int max_align_t::* pm;
|
||||||
|
void (max_align_t::*pmf)();
|
||||||
|
};
|
||||||
|
|
||||||
|
BOOST_CONSTEXPR_OR_CONST std::size_t max_align = BOOST_CORE_ALIGNOF( max_align_t );
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED
|
||||||
108
include/boost/core/memory_resource.hpp
Normal file
108
include/boost/core/memory_resource.hpp
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
#ifndef BOOST_CORE_MEMORY_RESOURCE_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_MEMORY_RESOURCE_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/core/max_align.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/config/workaround.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
// Define our own placement new to avoid the inclusion of <new>
|
||||||
|
// (~9K extra lines) at Ion Gaztanhaga's request.
|
||||||
|
//
|
||||||
|
// We can use our own because [intro.object] p13 says:
|
||||||
|
//
|
||||||
|
// Any implicit or explicit invocation of a function named `operator new`
|
||||||
|
// or `operator new[]` implicitly creates objects in the returned region of
|
||||||
|
// storage and returns a pointer to a suitable created object.
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
struct placement_new_tag {};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
inline void* operator new( std::size_t, void* p, boost::core::detail::placement_new_tag )
|
||||||
|
{
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void operator delete( void*, void*, boost::core::detail::placement_new_tag )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
class memory_resource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || BOOST_WORKAROUND(BOOST_GCC, < 40700)
|
||||||
|
|
||||||
|
virtual ~memory_resource() {}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
virtual ~memory_resource() = default;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BOOST_ATTRIBUTE_NODISCARD void* allocate( std::size_t bytes, std::size_t alignment = max_align )
|
||||||
|
{
|
||||||
|
// https://github.com/boostorg/container/issues/199
|
||||||
|
// https://cplusplus.github.io/LWG/issue3471
|
||||||
|
|
||||||
|
return ::operator new( bytes, do_allocate( bytes, alignment ), core::detail::placement_new_tag() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void deallocate( void* p, std::size_t bytes, std::size_t alignment = max_align )
|
||||||
|
{
|
||||||
|
do_deallocate( p, bytes, alignment );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_equal( memory_resource const & other ) const BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return do_is_equal( other );
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
virtual void* do_allocate( std::size_t bytes, std::size_t alignment ) = 0;
|
||||||
|
virtual void do_deallocate( void* p, std::size_t bytes, std::size_t alignment ) = 0;
|
||||||
|
|
||||||
|
virtual bool do_is_equal( memory_resource const & other ) const BOOST_NOEXCEPT = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool operator==( memory_resource const& a, memory_resource const& b ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return &a == &b || a.is_equal( b );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=( memory_resource const& a, memory_resource const& b ) BOOST_NOEXCEPT
|
||||||
|
{
|
||||||
|
return !( a == b );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_MEMORY_RESOURCE_HPP_INCLUDED
|
||||||
@@ -100,11 +100,19 @@ template<class T, class U, class = void>
|
|||||||
struct ptr_rebind
|
struct ptr_rebind
|
||||||
: ptr_transform<T, U> { };
|
: ptr_transform<T, U> { };
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||||
template<class T, class U>
|
template<class T, class U>
|
||||||
struct ptr_rebind<T, U,
|
struct ptr_rebind<T, U,
|
||||||
typename ptr_valid<typename T::template rebind<U> >::type> {
|
typename ptr_valid<typename T::template rebind<U> >::type> {
|
||||||
typedef typename T::template rebind<U> type;
|
typedef typename T::template rebind<U> type;
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
template<class T, class U>
|
||||||
|
struct ptr_rebind<T, U,
|
||||||
|
typename ptr_valid<typename T::template rebind<U>::other>::type> {
|
||||||
|
typedef typename T::template rebind<U>::other type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
|
#if !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
|
||||||
template<class T, class E>
|
template<class T, class E>
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
#ifndef BOOST_CORE_REF_HPP
|
#ifndef BOOST_CORE_REF_HPP
|
||||||
#define BOOST_CORE_REF_HPP
|
#define BOOST_CORE_REF_HPP
|
||||||
|
|
||||||
// MS compatible compilers support #pragma once
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
|
||||||
# pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <boost/config/workaround.hpp>
|
#include <boost/config/workaround.hpp>
|
||||||
#include <boost/core/addressof.hpp>
|
#include <boost/core/addressof.hpp>
|
||||||
#include <boost/core/enable_if.hpp>
|
#include <boost/core/enable_if.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// ref.hpp - ref/cref, useful helper functions
|
// ref.hpp - ref/cref, useful helper functions
|
||||||
//
|
//
|
||||||
@@ -61,9 +59,11 @@ template< class Y, class T > struct ref_convertible
|
|||||||
enum _vt { value = sizeof( (f)( static_cast<Y*>(0) ) ) == sizeof(yes) };
|
enum _vt { value = sizeof( (f)( static_cast<Y*>(0) ) ) == sizeof(yes) };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS)
|
||||||
struct ref_empty
|
struct ref_empty
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
@@ -92,11 +92,11 @@ public:
|
|||||||
|
|
||||||
@remark Does not throw.
|
@remark Does not throw.
|
||||||
*/
|
*/
|
||||||
BOOST_FORCEINLINE explicit reference_wrapper(T& t): t_(boost::addressof(t)) {}
|
BOOST_FORCEINLINE explicit reference_wrapper(T& t) BOOST_NOEXCEPT : t_(boost::addressof(t)) {}
|
||||||
|
|
||||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 )
|
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 )
|
||||||
|
|
||||||
BOOST_FORCEINLINE explicit reference_wrapper( T & t, ref_workaround_tag ): t_( boost::addressof( t ) ) {}
|
BOOST_FORCEINLINE explicit reference_wrapper( T & t, ref_workaround_tag ) BOOST_NOEXCEPT : t_( boost::addressof( t ) ) {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -117,30 +117,37 @@ public:
|
|||||||
@remark Only enabled when `Y*` is convertible to `T*`.
|
@remark Only enabled when `Y*` is convertible to `T*`.
|
||||||
@remark Does not throw.
|
@remark Does not throw.
|
||||||
*/
|
*/
|
||||||
template<class Y> reference_wrapper( reference_wrapper<Y> r,
|
#if !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS)
|
||||||
typename enable_if_c<boost::detail::ref_convertible<Y, T>::value,
|
template<class Y, class = typename enable_if_c<boost::detail::ref_convertible<Y, T>::value>::type>
|
||||||
boost::detail::ref_empty>::type = boost::detail::ref_empty() ): t_( r.t_ )
|
reference_wrapper( reference_wrapper<Y> r ) BOOST_NOEXCEPT : t_( r.t_ )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
template<class Y> reference_wrapper( reference_wrapper<Y> r,
|
||||||
|
typename enable_if_c<boost::detail::ref_convertible<Y, T>::value,
|
||||||
|
boost::detail::ref_empty>::type = boost::detail::ref_empty() ) BOOST_NOEXCEPT : t_( r.t_ )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return The stored reference.
|
@return The stored reference.
|
||||||
@remark Does not throw.
|
@remark Does not throw.
|
||||||
*/
|
*/
|
||||||
BOOST_FORCEINLINE operator T& () const { return *t_; }
|
BOOST_FORCEINLINE operator T& () const BOOST_NOEXCEPT { return *t_; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return The stored reference.
|
@return The stored reference.
|
||||||
@remark Does not throw.
|
@remark Does not throw.
|
||||||
*/
|
*/
|
||||||
BOOST_FORCEINLINE T& get() const { return *t_; }
|
BOOST_FORCEINLINE T& get() const BOOST_NOEXCEPT { return *t_; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return A pointer to the object referenced by the stored
|
@return A pointer to the object referenced by the stored
|
||||||
reference.
|
reference.
|
||||||
@remark Does not throw.
|
@remark Does not throw.
|
||||||
*/
|
*/
|
||||||
BOOST_FORCEINLINE T* get_pointer() const { return t_; }
|
BOOST_FORCEINLINE T* get_pointer() const BOOST_NOEXCEPT { return t_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@@ -165,7 +172,7 @@ private:
|
|||||||
@return `reference_wrapper<T>(t)`
|
@return `reference_wrapper<T>(t)`
|
||||||
@remark Does not throw.
|
@remark Does not throw.
|
||||||
*/
|
*/
|
||||||
template<class T> BOOST_FORCEINLINE reference_wrapper<T> BOOST_REF_CONST ref( T & t )
|
template<class T> BOOST_FORCEINLINE reference_wrapper<T> BOOST_REF_CONST ref( T & t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 )
|
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 )
|
||||||
|
|
||||||
@@ -184,7 +191,7 @@ template<class T> BOOST_FORCEINLINE reference_wrapper<T> BOOST_REF_CONST ref( T
|
|||||||
@return `reference_wrapper<T const>(t)`
|
@return `reference_wrapper<T const>(t)`
|
||||||
@remark Does not throw.
|
@remark Does not throw.
|
||||||
*/
|
*/
|
||||||
template<class T> BOOST_FORCEINLINE reference_wrapper<T const> BOOST_REF_CONST cref( T const & t )
|
template<class T> BOOST_FORCEINLINE reference_wrapper<T const> BOOST_REF_CONST cref( T const & t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return reference_wrapper<T const>(t);
|
return reference_wrapper<T const>(t);
|
||||||
}
|
}
|
||||||
@@ -315,7 +322,7 @@ template<typename T> struct unwrap_reference< reference_wrapper<T> const volatil
|
|||||||
@return `unwrap_reference<T>::type&(t)`
|
@return `unwrap_reference<T>::type&(t)`
|
||||||
@remark Does not throw.
|
@remark Does not throw.
|
||||||
*/
|
*/
|
||||||
template<class T> BOOST_FORCEINLINE typename unwrap_reference<T>::type& unwrap_ref( T & t )
|
template<class T> BOOST_FORCEINLINE typename unwrap_reference<T>::type& unwrap_ref( T & t ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@@ -325,7 +332,7 @@ template<class T> BOOST_FORCEINLINE typename unwrap_reference<T>::type& unwrap_r
|
|||||||
/**
|
/**
|
||||||
@cond
|
@cond
|
||||||
*/
|
*/
|
||||||
template<class T> BOOST_FORCEINLINE T* get_pointer( reference_wrapper<T> const & r )
|
template<class T> BOOST_FORCEINLINE T* get_pointer( reference_wrapper<T> const & r ) BOOST_NOEXCEPT
|
||||||
{
|
{
|
||||||
return r.get_pointer();
|
return r.get_pointer();
|
||||||
}
|
}
|
||||||
|
|||||||
131
include/boost/core/serialization.hpp
Normal file
131
include/boost/core/serialization.hpp
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
#ifndef BOOST_CORE_SERIALIZATION_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_SERIALIZATION_HPP_INCLUDED
|
||||||
|
|
||||||
|
// MS compatible compilers support #pragma once
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||||
|
# pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
//
|
||||||
|
// Utilities needed to implement serialization support
|
||||||
|
// without including a Boost.Serialization header
|
||||||
|
|
||||||
|
#include <boost/core/nvp.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace boost
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace serialization
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declarations (needed for specializations)
|
||||||
|
|
||||||
|
template<class T> struct version;
|
||||||
|
|
||||||
|
class access;
|
||||||
|
|
||||||
|
// Our own version_type replacement. This has to be in
|
||||||
|
// the `serialization` namespace, because its only purpose
|
||||||
|
// is to add `serialization` as an associated namespace.
|
||||||
|
|
||||||
|
struct core_version_type
|
||||||
|
{
|
||||||
|
unsigned int version_;
|
||||||
|
|
||||||
|
core_version_type( unsigned int version ): version_( version ) {}
|
||||||
|
operator unsigned int () const { return version_; }
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace serialization
|
||||||
|
|
||||||
|
namespace core
|
||||||
|
{
|
||||||
|
|
||||||
|
// nvp
|
||||||
|
|
||||||
|
using serialization::nvp;
|
||||||
|
using serialization::make_nvp;
|
||||||
|
|
||||||
|
// split_free
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
template<bool IsSaving> struct load_or_save_f;
|
||||||
|
|
||||||
|
template<> struct load_or_save_f<true>
|
||||||
|
{
|
||||||
|
template<class A, class T> void operator()( A& a, T& t, unsigned int v ) const
|
||||||
|
{
|
||||||
|
save( a, t, serialization::core_version_type( v ) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> struct load_or_save_f<false>
|
||||||
|
{
|
||||||
|
template<class A, class T> void operator()( A& a, T& t, unsigned int v ) const
|
||||||
|
{
|
||||||
|
load( a, t, serialization::core_version_type( v ) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
template<class A, class T> inline void split_free( A& a, T& t, unsigned int v )
|
||||||
|
{
|
||||||
|
detail::load_or_save_f< A::is_saving::value >()( a, t, v );
|
||||||
|
}
|
||||||
|
|
||||||
|
// split_member
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
|
||||||
|
template<bool IsSaving, class Access = serialization::access> struct load_or_save_m;
|
||||||
|
|
||||||
|
template<class Access> struct load_or_save_m<true, Access>
|
||||||
|
{
|
||||||
|
template<class A, class T> void operator()( A& a, T const& t, unsigned int v ) const
|
||||||
|
{
|
||||||
|
Access::member_save( a, t, v );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class Access> struct load_or_save_m<false, Access>
|
||||||
|
{
|
||||||
|
template<class A, class T> void operator()( A& a, T& t, unsigned int v ) const
|
||||||
|
{
|
||||||
|
Access::member_load( a, t, v );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
template<class A, class T> inline void split_member( A& a, T& t, unsigned int v )
|
||||||
|
{
|
||||||
|
detail::load_or_save_m< A::is_saving::value >()( a, t, v );
|
||||||
|
}
|
||||||
|
|
||||||
|
// load_construct_data_adl
|
||||||
|
|
||||||
|
template<class Ar, class T> void load_construct_data_adl( Ar& ar, T* t, unsigned int v )
|
||||||
|
{
|
||||||
|
load_construct_data( ar, t, serialization::core_version_type( v ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// save_construct_data_adl
|
||||||
|
|
||||||
|
template<class Ar, class T> void save_construct_data_adl( Ar& ar, T const* t, unsigned int v )
|
||||||
|
{
|
||||||
|
save_construct_data( ar, t, serialization::core_version_type( v ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_SERIALIZATION_HPP_INCLUDED
|
||||||
31
include/boost/core/size.hpp
Normal file
31
include/boost/core/size.hpp
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2023 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_SIZE_HPP
|
||||||
|
#define BOOST_CORE_SIZE_HPP
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class C>
|
||||||
|
inline constexpr auto
|
||||||
|
size(const C& c) noexcept(noexcept(c.size())) -> decltype(c.size())
|
||||||
|
{
|
||||||
|
return c.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, std::size_t N>
|
||||||
|
inline constexpr std::size_t
|
||||||
|
size(T(&)[N]) noexcept
|
||||||
|
{
|
||||||
|
return N;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* boost */
|
||||||
|
|
||||||
|
#endif
|
||||||
173
include/boost/core/snprintf.hpp
Normal file
173
include/boost/core/snprintf.hpp
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/*
|
||||||
|
* Copyright Andrey Semashev 2022.
|
||||||
|
* 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 snprintf.hpp
|
||||||
|
* \author Andrey Semashev
|
||||||
|
* \date 06.12.2022
|
||||||
|
*
|
||||||
|
* \brief The header provides more portable definition of snprintf and vsnprintf,
|
||||||
|
* as well as \c wchar_t counterparts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BOOST_CORE_SNPRINTF_HPP_INCLUDED_
|
||||||
|
#define BOOST_CORE_SNPRINTF_HPP_INCLUDED_
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
|
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MINGW32__)
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdarg>
|
||||||
|
#if !defined(__MINGW64_VERSION_MAJOR)
|
||||||
|
#include <climits>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// MinGW32 and MinGW-w64 provide their own snprintf implementations that are compliant with the C standard.
|
||||||
|
#define BOOST_CORE_DETAIL_MINGW_SNPRINTF
|
||||||
|
|
||||||
|
#elif (defined(BOOST_MSSTL_VERSION) && BOOST_MSSTL_VERSION < 140)
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
|
// MSVC snprintfs are not conforming but they are good enough for typical use cases.
|
||||||
|
#define BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
namespace core {
|
||||||
|
|
||||||
|
#if defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF) || defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF)
|
||||||
|
|
||||||
|
#if defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF)
|
||||||
|
|
||||||
|
inline int vsnprintf(char* buf, std::size_t size, const char* format, std::va_list args)
|
||||||
|
{
|
||||||
|
return __mingw_vsnprintf(buf, size, format, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int vswprintf(wchar_t* buf, std::size_t size, const wchar_t* format, std::va_list args)
|
||||||
|
{
|
||||||
|
#if defined(__MINGW64_VERSION_MAJOR)
|
||||||
|
int res = __mingw_vsnwprintf(buf, size, format, args);
|
||||||
|
// __mingw_vsnwprintf returns the number of characters to be printed, but (v)swprintf is expected to return -1 on truncation
|
||||||
|
if (static_cast< unsigned int >(res) >= size)
|
||||||
|
res = -1;
|
||||||
|
return res;
|
||||||
|
#else
|
||||||
|
// Legacy MinGW32 does not provide __mingw_vsnwprintf, so use _vsnwprintf from MSVC CRT
|
||||||
|
if (BOOST_UNLIKELY(size == 0u || size > static_cast< std::size_t >(INT_MAX)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
int res = _vsnwprintf(buf, size, format, args);
|
||||||
|
// (v)swprintf is expected to return -1 on truncation, so we only need to ensure the output is null-terminated
|
||||||
|
if (static_cast< unsigned int >(res) >= size)
|
||||||
|
{
|
||||||
|
buf[size - 1u] = L'\0';
|
||||||
|
res = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF)
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(push)
|
||||||
|
// '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead.
|
||||||
|
#pragma warning(disable: 4996)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
inline int vsnprintf(char* buf, std::size_t size, const char* format, std::va_list args)
|
||||||
|
{
|
||||||
|
if (BOOST_UNLIKELY(size == 0u))
|
||||||
|
return 0;
|
||||||
|
if (BOOST_UNLIKELY(size > static_cast< std::size_t >(INT_MAX)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
buf[size - 1u] = '\0';
|
||||||
|
int res = _vsnprintf(buf, size, format, args);
|
||||||
|
if (static_cast< unsigned int >(res) >= size)
|
||||||
|
{
|
||||||
|
// _vsnprintf returns -1 if the output was truncated and in case of other errors.
|
||||||
|
// Detect truncation by checking whether the output buffer was written over entirely.
|
||||||
|
if (buf[size - 1u] != '\0')
|
||||||
|
{
|
||||||
|
buf[size - 1u] = '\0';
|
||||||
|
res = static_cast< int >(size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int vswprintf(wchar_t* buf, std::size_t size, const wchar_t* format, std::va_list args)
|
||||||
|
{
|
||||||
|
if (BOOST_UNLIKELY(size == 0u || size > static_cast< std::size_t >(INT_MAX)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
int res = _vsnwprintf(buf, size, format, args);
|
||||||
|
// (v)swprintf is expected to return -1 on truncation, so we only need to ensure the output is null-terminated
|
||||||
|
if (static_cast< unsigned int >(res) >= size)
|
||||||
|
{
|
||||||
|
buf[size - 1u] = L'\0';
|
||||||
|
res = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
inline int snprintf(char* buf, std::size_t size, const char* format, ...)
|
||||||
|
{
|
||||||
|
std::va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
int res = vsnprintf(buf, size, format, args);
|
||||||
|
va_end(args);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int swprintf(wchar_t* buf, std::size_t size, const wchar_t* format, ...)
|
||||||
|
{
|
||||||
|
std::va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
int res = vswprintf(buf, size, format, args);
|
||||||
|
va_end(args);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF) || defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF)
|
||||||
|
|
||||||
|
// Standard-conforming compilers already have the correct snprintfs
|
||||||
|
using ::snprintf;
|
||||||
|
using ::vsnprintf;
|
||||||
|
|
||||||
|
using ::swprintf;
|
||||||
|
using ::vswprintf;
|
||||||
|
|
||||||
|
#endif // defined(BOOST_CORE_DETAIL_MINGW_SNPRINTF) || defined(BOOST_CORE_DETAIL_MSVC_LEGACY_SNPRINTF)
|
||||||
|
|
||||||
|
} // namespace core
|
||||||
|
|
||||||
|
} // namespace boost
|
||||||
|
|
||||||
|
#endif // BOOST_CORE_SNPRINTF_HPP_INCLUDED_
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2019 Glen Joseph Fernandes
|
Copyright 2019-2023 Glen Joseph Fernandes
|
||||||
(glenjofe@gmail.com)
|
(glenjofe@gmail.com)
|
||||||
|
|
||||||
Distributed under the Boost Software License, Version 1.0.
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
@@ -8,10 +8,10 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
#ifndef BOOST_CORE_SPAN_HPP
|
#ifndef BOOST_CORE_SPAN_HPP
|
||||||
#define BOOST_CORE_SPAN_HPP
|
#define BOOST_CORE_SPAN_HPP
|
||||||
|
|
||||||
|
#include <boost/core/data.hpp>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
@@ -39,10 +39,8 @@ struct span_compatible {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct span_uncvref {
|
using span_uncvref = typename std::remove_cv<typename
|
||||||
typedef typename std::remove_cv<typename
|
std::remove_reference<T>::type>::type;
|
||||||
std::remove_reference<T>::type>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class>
|
template<class>
|
||||||
struct span_is_span {
|
struct span_is_span {
|
||||||
@@ -64,15 +62,16 @@ struct span_is_array<std::array<T, N> > {
|
|||||||
static constexpr bool value = true;
|
static constexpr bool value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
using span_ptr = decltype(boost::data(std::declval<T&>()));
|
||||||
|
|
||||||
template<class, class = void>
|
template<class, class = void>
|
||||||
struct span_data { };
|
struct span_data { };
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct span_data<T,
|
struct span_data<T,
|
||||||
typename std::enable_if<std::is_pointer<decltype(std::declval<T
|
typename std::enable_if<std::is_pointer<span_ptr<T> >::value>::type> {
|
||||||
&>().data())>::value>::type> {
|
typedef typename std::remove_pointer<span_ptr<T> >::type type;
|
||||||
typedef typename std::remove_pointer<decltype(std::declval<T
|
|
||||||
&>().data())>::type type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class, class, class = void>
|
template<class, class, class = void>
|
||||||
@@ -102,9 +101,9 @@ template<class R, class T>
|
|||||||
struct span_is_range {
|
struct span_is_range {
|
||||||
static constexpr bool value = (std::is_const<T>::value ||
|
static constexpr bool value = (std::is_const<T>::value ||
|
||||||
std::is_lvalue_reference<R>::value) &&
|
std::is_lvalue_reference<R>::value) &&
|
||||||
!span_is_span<typename span_uncvref<R>::type>::value &&
|
!span_is_span<span_uncvref<R> >::value &&
|
||||||
!span_is_array<typename span_uncvref<R>::type>::value &&
|
!span_is_array<span_uncvref<R> >::value &&
|
||||||
!std::is_array<typename span_uncvref<R>::type>::value &&
|
!std::is_array<span_uncvref<R> >::value &&
|
||||||
span_has_data<R, T>::value &&
|
span_has_data<R, T>::value &&
|
||||||
span_has_size<R>::value;
|
span_has_size<R>::value;
|
||||||
};
|
};
|
||||||
@@ -224,15 +223,16 @@ public:
|
|||||||
template<class R,
|
template<class R,
|
||||||
typename std::enable_if<E == dynamic_extent &&
|
typename std::enable_if<E == dynamic_extent &&
|
||||||
detail::span_is_range<R, T>::value, int>::type = 0>
|
detail::span_is_range<R, T>::value, int>::type = 0>
|
||||||
constexpr span(R&& r) noexcept(noexcept(r.data()) && noexcept(r.size()))
|
constexpr span(R&& r) noexcept(noexcept(boost::data(r)) &&
|
||||||
: s_(r.data(), r.size()) { }
|
noexcept(r.size()))
|
||||||
|
: s_(boost::data(r), r.size()) { }
|
||||||
|
|
||||||
template<class R,
|
template<class R,
|
||||||
typename std::enable_if<E != dynamic_extent &&
|
typename std::enable_if<E != dynamic_extent &&
|
||||||
detail::span_is_range<R, T>::value, int>::type = 0>
|
detail::span_is_range<R, T>::value, int>::type = 0>
|
||||||
explicit constexpr span(R&& r) noexcept(noexcept(r.data()) &&
|
explicit constexpr span(R&& r) noexcept(noexcept(boost::data(r)) &&
|
||||||
noexcept(r.size()))
|
noexcept(r.size()))
|
||||||
: s_(r.data(), r.size()) { }
|
: s_(boost::data(r), r.size()) { }
|
||||||
|
|
||||||
template<class U, std::size_t N,
|
template<class U, std::size_t N,
|
||||||
typename std::enable_if<detail::span_implicit<E, N>::value &&
|
typename std::enable_if<detail::span_implicit<E, N>::value &&
|
||||||
|
|||||||
@@ -10,61 +10,31 @@
|
|||||||
#define BOOST_CORE_SWAP_HPP
|
#define BOOST_CORE_SWAP_HPP
|
||||||
|
|
||||||
// Note: the implementation of this utility contains various workarounds:
|
// 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.
|
|
||||||
// - swap_impl has 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
|
// - boost::swap has two template arguments, instead of one, to
|
||||||
// avoid ambiguity when swapping objects of a Boost type that does
|
// avoid ambiguity when swapping objects of a Boost type that does
|
||||||
// not have its own boost::swap overload.
|
// not have its own boost::swap overload.
|
||||||
|
|
||||||
#include <boost/core/enable_if.hpp>
|
#include <boost/core/enable_if.hpp>
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB)
|
#include <boost/config/header_deprecated.hpp>
|
||||||
#include <utility> // for std::swap (C++11)
|
#include <boost/core/invoke_swap.hpp>
|
||||||
#else
|
|
||||||
#include <algorithm> // for std::swap (C++98)
|
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||||
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
#include <cstddef> // for std::size_t
|
|
||||||
|
|
||||||
namespace boost_swap_impl
|
BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp")
|
||||||
{
|
|
||||||
// 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 }; };
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
BOOST_GPU_ENABLED
|
|
||||||
void swap_impl(T& left, T& right)
|
|
||||||
{
|
|
||||||
using namespace std;//use std::swap if argument dependent lookup fails
|
|
||||||
swap(left,right);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T, std::size_t N>
|
|
||||||
BOOST_GPU_ENABLED
|
|
||||||
void swap_impl(T (& left)[N], T (& right)[N])
|
|
||||||
{
|
|
||||||
for (std::size_t i = 0; i < N; ++i)
|
|
||||||
{
|
|
||||||
::boost_swap_impl::swap_impl(left[i], right[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
template<class T1, class T2>
|
template<class T1, class T2>
|
||||||
BOOST_GPU_ENABLED
|
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)
|
swap(T1& left, T2& right)
|
||||||
{
|
{
|
||||||
::boost_swap_impl::swap_impl(left, right);
|
boost::core::invoke_swap(left, right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // BOOST_CORE_SWAP_HPP
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
// https://www.boost.org/LICENSE_1_0.txt
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
#include <boost/core/demangle.hpp>
|
#include <boost/core/demangle.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -103,11 +102,23 @@ inline std::string fix_typeid_name( char const* n )
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> std::string typeid_name()
|
// class types can be incomplete
|
||||||
|
template<class T> std::string typeid_name_impl( int T::* )
|
||||||
|
{
|
||||||
|
std::string r = fix_typeid_name( typeid(T[1]).name() );
|
||||||
|
return r.substr( 0, r.size() - 4 ); // remove ' [1]' suffix
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T> std::string typeid_name_impl( ... )
|
||||||
{
|
{
|
||||||
return fix_typeid_name( typeid(T).name() );
|
return fix_typeid_name( typeid(T).name() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T> std::string typeid_name()
|
||||||
|
{
|
||||||
|
return typeid_name_impl<T>( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
// template names
|
// template names
|
||||||
|
|
||||||
template<class T> std::string class_template_name()
|
template<class T> std::string class_template_name()
|
||||||
@@ -185,14 +196,23 @@ template<class T> std::string array_template_name()
|
|||||||
# pragma warning( disable: 4996 )
|
# pragma warning( disable: 4996 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Use snprintf if available as some compilers (clang 14.0) issue deprecation warnings for sprintf
|
||||||
|
#if ( defined(_MSC_VER) && _MSC_VER < 1900 ) || ( defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) )
|
||||||
|
# define BOOST_CORE_DETAIL_SNPRINTF(buffer, format, arg) std::sprintf(buffer, format, arg)
|
||||||
|
#else
|
||||||
|
# define BOOST_CORE_DETAIL_SNPRINTF(buffer, format, arg) std::snprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), format, arg)
|
||||||
|
#endif
|
||||||
|
|
||||||
inline std::string tn_to_string( std::size_t n )
|
inline std::string tn_to_string( std::size_t n )
|
||||||
{
|
{
|
||||||
char buffer[ 32 ];
|
char buffer[ 32 ];
|
||||||
std::sprintf( buffer, "%lu", static_cast< unsigned long >( n ) );
|
BOOST_CORE_DETAIL_SNPRINTF( buffer, "%lu", static_cast< unsigned long >( n ) );
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef BOOST_CORE_DETAIL_SNPRINTF
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
#if defined(BOOST_MSVC)
|
||||||
# pragma warning( pop )
|
# pragma warning( pop )
|
||||||
#endif
|
#endif
|
||||||
@@ -854,6 +874,8 @@ template<class T, std::size_t N> struct tn_holder<T const volatile[N]>
|
|||||||
|
|
||||||
// pointers to members
|
// pointers to members
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
template<class R, class T> struct tn_holder<R T::*>
|
template<class R, class T> struct tn_holder<R T::*>
|
||||||
{
|
{
|
||||||
static std::string type_name( std::string const& suffix )
|
static std::string type_name( std::string const& suffix )
|
||||||
@@ -862,7 +884,7 @@ template<class R, class T> struct tn_holder<R T::*>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(BOOST_MSVC) && BOOST_MSVC < 1900 && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if defined(BOOST_MSVC) && BOOST_MSVC < 1900
|
||||||
|
|
||||||
template<class R, class T, class... A> struct tn_holder<R(T::*)(A...)>
|
template<class R, class T, class... A> struct tn_holder<R(T::*)(A...)>
|
||||||
{
|
{
|
||||||
@@ -896,7 +918,9 @@ template<class R, class T, class... A> struct tn_holder<R(T::*)(A...) const vola
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // #if defined(BOOST_MSVC) && BOOST_MSVC < 1900
|
||||||
|
|
||||||
|
#endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
|
|
||||||
// strings
|
// strings
|
||||||
|
|
||||||
|
|||||||
12
include/boost/core/yield_primitives.hpp
Normal file
12
include/boost/core/yield_primitives.hpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef BOOST_CORE_YIELD_PRIMITIVES_HPP_INCLUDED
|
||||||
|
#define BOOST_CORE_YIELD_PRIMITIVES_HPP_INCLUDED
|
||||||
|
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/core/detail/sp_thread_pause.hpp>
|
||||||
|
#include <boost/core/detail/sp_thread_yield.hpp>
|
||||||
|
#include <boost/core/detail/sp_thread_sleep.hpp>
|
||||||
|
|
||||||
|
#endif // #ifndef BOOST_CORE_YIELD_PRIMITIVES_HPP_INCLUDED
|
||||||
@@ -10,8 +10,11 @@
|
|||||||
#define BOOST_SWAP_HPP
|
#define BOOST_SWAP_HPP
|
||||||
|
|
||||||
// The header file at this path is deprecated;
|
// 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>
|
#include <boost/core/swap.hpp>
|
||||||
|
|
||||||
|
BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp")
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -10,8 +10,11 @@
|
|||||||
#define BOOST_UTILITY_SWAP_HPP
|
#define BOOST_UTILITY_SWAP_HPP
|
||||||
|
|
||||||
// The header file at this path is deprecated;
|
// 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>
|
#include <boost/core/swap.hpp>
|
||||||
|
|
||||||
|
BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp")
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
|
|||||||
|
|
||||||
if(HAVE_BOOST_TEST)
|
if(HAVE_BOOST_TEST)
|
||||||
|
|
||||||
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::core Boost::static_assert)
|
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)
|
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::type_traits)
|
||||||
|
|
||||||
@@ -27,6 +27,24 @@ set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::utility)
|
|||||||
|
|
||||||
boost_test(TYPE run SOURCES sv_conversion_test2.cpp)
|
boost_test(TYPE run SOURCES sv_conversion_test2.cpp)
|
||||||
|
|
||||||
|
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::config Boost::move Boost::smart_ptr)
|
||||||
|
|
||||||
|
boost_test(TYPE run SOURCES fclose_deleter_test.cpp)
|
||||||
|
|
||||||
|
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::serialization)
|
||||||
|
|
||||||
|
boost_test(TYPE run SOURCES serialization_nvp_test.cpp)
|
||||||
|
boost_test(TYPE run SOURCES serialization_split_free_test.cpp)
|
||||||
|
boost_test(TYPE run SOURCES serialization_split_member_test.cpp)
|
||||||
|
boost_test(TYPE run SOURCES serialization_construct_data_test.cpp)
|
||||||
|
|
||||||
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
set(BOOST_TEST_LINK_LIBRARIES Boost::core Threads::Threads)
|
||||||
|
|
||||||
|
boost_test(TYPE run SOURCES yield_prim_pthread_cancel_test.cpp)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(swap)
|
add_subdirectory(swap)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ project : requirements
|
|||||||
<toolset>gcc:<warnings-as-errors>on
|
<toolset>gcc:<warnings-as-errors>on
|
||||||
<toolset>gcc-4.4:<cxxflags>-Wno-sign-compare ;
|
<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>msvc:<warnings-as-errors>on"
|
||||||
"-<toolset>gcc:<warnings-as-errors>on"
|
"-<toolset>gcc:<warnings-as-errors>on"
|
||||||
"-<toolset>clang:<warnings-as-errors>on" ;
|
"-<toolset>clang:<warnings-as-errors>on" ;
|
||||||
@@ -32,36 +32,36 @@ run addressof_np_test.cpp ;
|
|||||||
run addressof_fn_test.cpp ;
|
run addressof_fn_test.cpp ;
|
||||||
compile addressof_constexpr_test.cpp ;
|
compile addressof_constexpr_test.cpp ;
|
||||||
compile-fail addressof_fail_rvalue.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 ;
|
||||||
compile-fail checked_delete_fail.cpp
|
compile-fail checked_delete_fail.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
compile-fail checked_delete_fail2.cpp
|
compile-fail checked_delete_fail2.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
|
|
||||||
compile ref_ct_test.cpp ;
|
compile ref_ct_test.cpp ;
|
||||||
run ref_test.cpp ;
|
run ref_test.cpp ;
|
||||||
run ref_ref_test.cpp ;
|
run ref_ref_test.cpp ;
|
||||||
run ref_fn_test.cpp ;
|
run ref_fn_test.cpp ;
|
||||||
compile-fail ref_rv_fail1.cpp
|
compile-fail ref_rv_fail1.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
compile-fail ref_rv_fail2.cpp
|
compile-fail ref_rv_fail2.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
compile-fail ref_rv_fail3.cpp
|
compile-fail ref_rv_fail3.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
compile-fail ref_rv_fail4.cpp
|
compile-fail ref_rv_fail4.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
compile-fail ref_rv_fail5.cpp
|
compile-fail ref_rv_fail5.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
compile-fail ref_implicit_fail.cpp
|
compile-fail ref_implicit_fail.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
compile-fail ref_implicit_fail2.cpp
|
compile-fail ref_implicit_fail2.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
compile-fail ref_implicit_fail3.cpp
|
compile-fail ref_implicit_fail3.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
compile-fail ref_implicit_fail4.cpp
|
compile-fail ref_implicit_fail4.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
run ref_cv_test.cpp ;
|
run ref_cv_test.cpp ;
|
||||||
run ref_conversion_test.cpp ;
|
run ref_conversion_test.cpp ;
|
||||||
|
|
||||||
@@ -75,18 +75,18 @@ run eif_no_disambiguation.cpp : ;
|
|||||||
run eif_partial_specializations.cpp : ;
|
run eif_partial_specializations.cpp : ;
|
||||||
|
|
||||||
compile-fail noncopyable_compile_fail.cpp
|
compile-fail noncopyable_compile_fail.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
|
|
||||||
run explicit_operator_bool.cpp ;
|
run explicit_operator_bool.cpp ;
|
||||||
run explicit_operator_bool_noexcept.cpp ;
|
run explicit_operator_bool_noexcept.cpp ;
|
||||||
compile-fail explicit_operator_bool_compile_fail_conv_int.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
|
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
|
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
|
compile-fail explicit_operator_bool_compile_fail_shift.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
|
|
||||||
compile ignore_unused_test.cpp ;
|
compile ignore_unused_test.cpp ;
|
||||||
|
|
||||||
@@ -98,6 +98,8 @@ run visit_each_test.cpp ;
|
|||||||
run get_pointer_test.cpp ;
|
run get_pointer_test.cpp ;
|
||||||
|
|
||||||
local pedantic-errors = <warnings>pedantic
|
local pedantic-errors = <warnings>pedantic
|
||||||
|
<toolset>gcc:<cxxflags>"-Wconversion"
|
||||||
|
<toolset>clang:<cxxflags>"-Wconversion"
|
||||||
<toolset>msvc:<warnings-as-errors>on
|
<toolset>msvc:<warnings-as-errors>on
|
||||||
<toolset>gcc:<warnings-as-errors>on
|
<toolset>gcc:<warnings-as-errors>on
|
||||||
<toolset>clang:<warnings-as-errors>on ;
|
<toolset>clang:<warnings-as-errors>on ;
|
||||||
@@ -148,6 +150,7 @@ run-fail lightweight_test_fail12.cpp ;
|
|||||||
run-fail lightweight_test_fail13.cpp ;
|
run-fail lightweight_test_fail13.cpp ;
|
||||||
run-fail lightweight_test_fail14.cpp ;
|
run-fail lightweight_test_fail14.cpp ;
|
||||||
run-fail lightweight_test_fail15.cpp ;
|
run-fail lightweight_test_fail15.cpp ;
|
||||||
|
run-fail lightweight_test_fail16.cpp : ;
|
||||||
run-fail lightweight_test_lt_fail.cpp ;
|
run-fail lightweight_test_lt_fail.cpp ;
|
||||||
run-fail lightweight_test_le_fail.cpp ;
|
run-fail lightweight_test_le_fail.cpp ;
|
||||||
run-fail lightweight_test_gt_fail.cpp ;
|
run-fail lightweight_test_gt_fail.cpp ;
|
||||||
@@ -174,16 +177,18 @@ run demangle_test.cpp
|
|||||||
run demangled_name_test.cpp
|
run demangled_name_test.cpp
|
||||||
: : : <test-info>always_show_run_output ;
|
: : : <test-info>always_show_run_output ;
|
||||||
|
|
||||||
run demangled_name_test.cpp : : : <rtti>off <test-info>always_show_run_output : demangled_name_test_no_rtti ;
|
run demangled_name_test.cpp : : : <rtti>off <test-info>always_show_run_output : demangled_name_test_no_rtti ;
|
||||||
|
|
||||||
run scoped_enum.cpp ;
|
run scoped_enum.cpp ;
|
||||||
compile-fail scoped_enum_compile_fail_conv_from_int.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
|
compile-fail scoped_enum_compile_fail_conv_to_int.cpp
|
||||||
: $(warning-as-errors-off) ;
|
: $(warnings-as-errors-off) ;
|
||||||
|
|
||||||
run underlying_type.cpp ;
|
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 ;
|
||||||
|
|
||||||
run pointer_traits_pointer_test.cpp ;
|
run pointer_traits_pointer_test.cpp ;
|
||||||
run pointer_traits_element_type_test.cpp ;
|
run pointer_traits_element_type_test.cpp ;
|
||||||
run pointer_traits_difference_type_test.cpp ;
|
run pointer_traits_difference_type_test.cpp ;
|
||||||
@@ -203,6 +208,7 @@ compile first_scalar_constexpr_test.cpp ;
|
|||||||
run empty_value_test.cpp ;
|
run empty_value_test.cpp ;
|
||||||
run empty_value_size_test.cpp ;
|
run empty_value_size_test.cpp ;
|
||||||
run empty_value_final_test.cpp ;
|
run empty_value_final_test.cpp ;
|
||||||
|
run empty_value_constexpr_test.cpp ;
|
||||||
|
|
||||||
run quick_exit_test.cpp ;
|
run quick_exit_test.cpp ;
|
||||||
run-fail quick_exit_fail.cpp ;
|
run-fail quick_exit_fail.cpp ;
|
||||||
@@ -292,9 +298,27 @@ run bit_popcount_test.cpp
|
|||||||
: : : $(pedantic-errors) ;
|
: : : $(pedantic-errors) ;
|
||||||
run bit_endian_test.cpp
|
run bit_endian_test.cpp
|
||||||
: : : $(pedantic-errors) ;
|
: : : $(pedantic-errors) ;
|
||||||
|
run bit_byteswap_test.cpp
|
||||||
|
: : : $(pedantic-errors) ;
|
||||||
|
|
||||||
|
compile-fail bit_width_fail.cpp
|
||||||
|
: <warnings>off ;
|
||||||
|
|
||||||
|
compile bit_cast_test_cx.cpp ;
|
||||||
|
compile bit_rotate_test_cx.cpp ;
|
||||||
|
compile bit_countr_test_cx.cpp ;
|
||||||
|
compile bit_countl_test_cx.cpp ;
|
||||||
|
compile bit_width_test_cx.cpp ;
|
||||||
|
compile has_single_bit_test_cx.cpp ;
|
||||||
|
compile bit_floor_test_cx.cpp ;
|
||||||
|
compile bit_ceil_test_cx.cpp ;
|
||||||
|
compile bit_popcount_test_cx.cpp ;
|
||||||
|
compile bit_byteswap_test_cx.cpp ;
|
||||||
|
|
||||||
run type_name_test.cpp ;
|
run type_name_test.cpp ;
|
||||||
|
|
||||||
|
run snprintf_test.cpp ;
|
||||||
|
|
||||||
run sv_types_test.cpp ;
|
run sv_types_test.cpp ;
|
||||||
run sv_construct_test.cpp ;
|
run sv_construct_test.cpp ;
|
||||||
run sv_iteration_test.cpp ;
|
run sv_iteration_test.cpp ;
|
||||||
@@ -324,6 +348,8 @@ run sv_conversion_test2.cpp : ;
|
|||||||
run sv_common_reference_test.cpp ;
|
run sv_common_reference_test.cpp ;
|
||||||
compile sv_common_reference_test2.cpp ;
|
compile sv_common_reference_test2.cpp ;
|
||||||
compile sv_windows_h_test.cpp ;
|
compile sv_windows_h_test.cpp ;
|
||||||
|
compile-fail sv_nullptr_fail.cpp
|
||||||
|
: $(warnings-as-errors-off) ;
|
||||||
|
|
||||||
run span_test.cpp ;
|
run span_test.cpp ;
|
||||||
run span_types_test.cpp ;
|
run span_types_test.cpp ;
|
||||||
@@ -332,6 +358,7 @@ run span_deduction_guide_test.cpp ;
|
|||||||
run as_bytes_test.cpp ;
|
run as_bytes_test.cpp ;
|
||||||
run as_writable_bytes_test.cpp ;
|
run as_writable_bytes_test.cpp ;
|
||||||
compile span_boost_begin_test.cpp ;
|
compile span_boost_begin_test.cpp ;
|
||||||
|
run make_span_test.cpp ;
|
||||||
|
|
||||||
run splitmix64_test.cpp
|
run splitmix64_test.cpp
|
||||||
: : : $(pedantic-errors) ;
|
: : : $(pedantic-errors) ;
|
||||||
@@ -341,5 +368,31 @@ run-fail verbose_terminate_handler_fail.cpp : : : <exception-handling>off : verb
|
|||||||
run-fail verbose_terminate_handler_fail.cpp : : : <rtti>off : verbose_terminate_handler_fail_nr ;
|
run-fail verbose_terminate_handler_fail.cpp : : : <rtti>off : verbose_terminate_handler_fail_nr ;
|
||||||
run-fail verbose_terminate_handler_fail.cpp : : : <exception-handling>off <rtti>off : verbose_terminate_handler_fail_nxr ;
|
run-fail verbose_terminate_handler_fail.cpp : : : <exception-handling>off <rtti>off : verbose_terminate_handler_fail_nxr ;
|
||||||
|
|
||||||
|
run launder_test.cpp ;
|
||||||
|
|
||||||
|
run alignof_test.cpp ;
|
||||||
|
run max_align_test.cpp ;
|
||||||
|
|
||||||
|
run memory_resource_test.cpp ;
|
||||||
|
|
||||||
|
run data_test.cpp ;
|
||||||
|
run size_test.cpp ;
|
||||||
|
|
||||||
|
local with-serialization = <library>/boost//serialization/<warnings>off $(warnings-as-errors-off) <undefined-sanitizer>norecover:<link>static ;
|
||||||
|
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
run sp_thread_pause_test.cpp ;
|
||||||
|
run sp_thread_yield_test.cpp ;
|
||||||
|
run sp_thread_sleep_test.cpp ;
|
||||||
|
run yield_prim_windows_h_test.cpp ;
|
||||||
|
run yield_prim_pthread_cancel_test.cpp : ;
|
||||||
|
|
||||||
use-project /boost/core/swap : ./swap ;
|
use-project /boost/core/swap : ./swap ;
|
||||||
build-project ./swap ;
|
build-project ./swap ;
|
||||||
|
|||||||
98
test/alignof_test.cpp
Normal file
98
test/alignof_test.cpp
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/core/alignof.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
#include <boost/type_traits.hpp>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
template<class T> struct struct_of
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T> union union_of
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T> void test2()
|
||||||
|
{
|
||||||
|
BOOST_TEST_EQ( BOOST_CORE_ALIGNOF(T), boost::alignment_of<T>::value );
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_ALIGNOF)
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( BOOST_CORE_ALIGNOF(T), alignof(T) );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T> void test()
|
||||||
|
{
|
||||||
|
test2<T>();
|
||||||
|
test2<T[2]>();
|
||||||
|
test2< struct_of<T> >();
|
||||||
|
test2< union_of<T> >();
|
||||||
|
}
|
||||||
|
|
||||||
|
struct X
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
test<char>();
|
||||||
|
test<short>();
|
||||||
|
test<int>();
|
||||||
|
test<long>();
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_LONG_LONG)
|
||||||
|
# if !( defined(__GNUC__) && defined(__i386__) )
|
||||||
|
|
||||||
|
// g++ -m32 has alignof(long long) = 8, but boost::alignment_of<long long>::value = 4
|
||||||
|
test<boost::long_long_type>();
|
||||||
|
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_INT128)
|
||||||
|
|
||||||
|
test<boost::int128_type>();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
test<float>();
|
||||||
|
|
||||||
|
#if !( defined(__GNUC__) && defined(__i386__) )
|
||||||
|
|
||||||
|
// g++ -m32 has alignof(double) = 8, but boost::alignment_of<double>::value = 4
|
||||||
|
test<double>();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
test<long double>();
|
||||||
|
|
||||||
|
#if defined(BOOST_HAS_FLOAT128)
|
||||||
|
|
||||||
|
test<__float128>();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
test<void*>();
|
||||||
|
test<void(*)()>();
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER)
|
||||||
|
|
||||||
|
// under MSVC, alignof is 8, boost::alignment_of is 4
|
||||||
|
// under clang-cl, alignof is 4, boost::alignment_of is 8 (!)
|
||||||
|
|
||||||
|
test<int X::*>();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
test<void (X::*)()>();
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
@@ -72,6 +72,7 @@ int main()
|
|||||||
BOOST_TEST_EQ(p->value(), 2);
|
BOOST_TEST_EQ(p->value(), 2);
|
||||||
boost::alloc_destroy(a, p);
|
boost::alloc_destroy(a, p);
|
||||||
BOOST_TEST_EQ(type::count, 0);
|
BOOST_TEST_EQ(type::count, 0);
|
||||||
|
a.deallocate(p, 1);
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <boost/core/detail/is_same.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A1 {
|
struct A1 {
|
||||||
@@ -22,9 +22,9 @@ struct A2 {
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int*,
|
||||||
boost::allocator_const_pointer<A1<char> >::type>));
|
boost::allocator_const_pointer<A1<char> >::type>));
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<const int*,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<const int*,
|
||||||
boost::allocator_const_pointer<A2<int> >::type>));
|
boost::allocator_const_pointer<A2<int> >::type>));
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <boost/core/detail/is_same.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A1 {
|
struct A1 {
|
||||||
@@ -27,9 +27,9 @@ struct A2 {
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int*,
|
||||||
boost::allocator_const_void_pointer<A1<char> >::type>));
|
boost::allocator_const_void_pointer<A1<char> >::type>));
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<const void*,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<const void*,
|
||||||
boost::allocator_const_void_pointer<A2<int> >::type>));
|
boost::allocator_const_void_pointer<A2<int> >::type>));
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <boost/core/detail/is_same.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A1 {
|
struct A1 {
|
||||||
@@ -22,9 +22,9 @@ struct A2 {
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<short,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<short,
|
||||||
boost::allocator_difference_type<A1<char> >::type>));
|
boost::allocator_difference_type<A1<char> >::type>));
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<std::ptrdiff_t,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<std::ptrdiff_t,
|
||||||
boost::allocator_difference_type<A2<int> >::type>));
|
boost::allocator_difference_type<A2<int> >::type>));
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <boost/core/detail/is_same.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A1 {
|
struct A1 {
|
||||||
@@ -22,9 +22,9 @@ struct A2 {
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int*,
|
||||||
boost::allocator_pointer<A1<char> >::type>));
|
boost::allocator_pointer<A1<char> >::type>));
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int*,
|
||||||
boost::allocator_pointer<A2<int> >::type>));
|
boost::allocator_pointer<A2<int> >::type>));
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <boost/core/detail/is_same.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A1 {
|
struct A1 {
|
||||||
@@ -25,9 +25,9 @@ struct A2 {
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<A1<int>,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<A1<int>,
|
||||||
boost::allocator_rebind<A1<char>, bool>::type>));
|
boost::allocator_rebind<A1<char>, bool>::type>));
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<A2<int>,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<A2<int>,
|
||||||
boost::allocator_rebind<A2<char>, int>::type>));
|
boost::allocator_rebind<A2<char>, int>::type>));
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <boost/type_traits/is_same.hpp>
|
||||||
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
|
#include <boost/type_traits/make_unsigned.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A1 {
|
struct A1 {
|
||||||
@@ -24,11 +27,11 @@ struct A2 {
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int,
|
BOOST_TEST_TRAIT_TRUE((boost::is_same<int,
|
||||||
boost::allocator_size_type<A1<char> >::type>));
|
boost::allocator_size_type<A1<char> >::type>));
|
||||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<
|
BOOST_TEST_TRAIT_TRUE((boost::is_same<
|
||||||
std::make_unsigned<std::ptrdiff_t>::type,
|
boost::make_unsigned<std::ptrdiff_t>::type,
|
||||||
boost::allocator_size_type<A2<int> >::type>));
|
boost::allocator_size_type<A2<int> >::type>));
|
||||||
#endif
|
#endif
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <boost/core/detail/is_same.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A {
|
struct A {
|
||||||
@@ -16,7 +16,7 @@ struct A {
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int,
|
||||||
boost::allocator_value_type<A<int> >::type>));
|
boost::allocator_value_type<A<int> >::type>));
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ Distributed under the Boost Software License, Version 1.0.
|
|||||||
(http://www.boost.org/LICENSE_1_0.txt)
|
(http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
#include <boost/core/allocator_access.hpp>
|
#include <boost/core/allocator_access.hpp>
|
||||||
#include <boost/core/is_same.hpp>
|
|
||||||
#include <boost/core/lightweight_test_trait.hpp>
|
#include <boost/core/lightweight_test_trait.hpp>
|
||||||
|
#include <boost/core/detail/is_same.hpp>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A1 {
|
struct A1 {
|
||||||
@@ -27,9 +27,9 @@ struct A2 {
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<int*,
|
||||||
boost::allocator_void_pointer<A1<char> >::type>));
|
boost::allocator_void_pointer<A1<char> >::type>));
|
||||||
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<void*,
|
BOOST_TEST_TRAIT_TRUE((boost::core::detail::is_same<void*,
|
||||||
boost::allocator_void_pointer<A2<int> >::type>));
|
boost::allocator_void_pointer<A2<int> >::type>));
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
26
test/bit_byteswap_test.cpp
Normal file
26
test/bit_byteswap_test.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// Test for boost/core/bit.hpp (byteswap)
|
||||||
|
//
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
#include <boost/core/lightweight_test.hpp>
|
||||||
|
#include <boost/cstdint.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
BOOST_TEST_EQ( boost::core::byteswap( (boost::int8_t)0x01 ), 0x01 );
|
||||||
|
BOOST_TEST_EQ( boost::core::byteswap( (boost::uint8_t)0xF1 ), 0xF1 );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( boost::core::byteswap( (boost::int16_t)0x0102 ), 0x0201 );
|
||||||
|
BOOST_TEST_EQ( boost::core::byteswap( (boost::uint16_t)0xF1E2 ), 0xE2F1 );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( boost::core::byteswap( (boost::int32_t)0x01020304 ), 0x04030201 );
|
||||||
|
BOOST_TEST_EQ( boost::core::byteswap( (boost::uint32_t)0xF1E2D3C4u ), 0xC4D3E2F1u );
|
||||||
|
|
||||||
|
BOOST_TEST_EQ( boost::core::byteswap( (boost::int64_t)0x01020304 << 32 | 0x05060708 ), (boost::int64_t)0x08070605 << 32 | 0x04030201 );
|
||||||
|
BOOST_TEST_EQ( boost::core::byteswap( (boost::uint64_t)0xF1E2D3C4u << 32 | 0xB5A69788u ), (boost::uint64_t)0x8897A6B5u << 32 | 0xC4D3E2F1u );
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
37
test/bit_byteswap_test_cx.cpp
Normal file
37
test/bit_byteswap_test_cx.cpp
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// constexpr test for boost/core/bit.hpp (bit_width)
|
||||||
|
//
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#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" )
|
||||||
|
|
||||||
|
#elif defined(BOOST_MSVC) && BOOST_MSVC / 10 == 191
|
||||||
|
|
||||||
|
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_MSVC is " BOOST_STRINGIZE(BOOST_MSVC) )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::byteswap( (std::int8_t)0x01 ) == 0x01 );
|
||||||
|
STATIC_ASSERT( boost::core::byteswap( (std::uint8_t)0xF1 ) == 0xF1 );
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::byteswap( (std::int16_t)0x0102 ) == 0x0201 );
|
||||||
|
STATIC_ASSERT( boost::core::byteswap( (std::uint16_t)0xF1E2 ) == 0xE2F1 );
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::byteswap( (std::int32_t)0x01020304 ) == 0x04030201 );
|
||||||
|
STATIC_ASSERT( boost::core::byteswap( (std::uint32_t)0xF1E2D3C4u ) == 0xC4D3E2F1u );
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::byteswap( (std::int64_t)0x0102030405060708ll ) == 0x0807060504030201ll );
|
||||||
|
STATIC_ASSERT( boost::core::byteswap( (std::uint64_t)0xF1E2D3C4B5A69788ull ) == 0x8897A6B5C4D3E2F1ull );
|
||||||
|
|
||||||
|
#endif
|
||||||
28
test/bit_cast_test_cx.cpp
Normal file
28
test/bit_cast_test_cx.cpp
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// constexpr test for boost/core/bit.hpp (bit_cast)
|
||||||
|
//
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
#include <boost/cstdint.hpp>
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/config/pragma_message.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_CXX11_CONSTEXPR)
|
||||||
|
|
||||||
|
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_NO_CXX11_CONSTEXPR is defined" )
|
||||||
|
|
||||||
|
#elif !defined(BOOST_CORE_HAS_BUILTIN_BIT_CAST)
|
||||||
|
|
||||||
|
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_CORE_HAS_BUILTIN_BIT_CAST is not defined" )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::bit_cast<boost::uint32_t>( 1.0f ) == 0x3F800000u );
|
||||||
|
STATIC_ASSERT( boost::core::bit_cast<boost::uint64_t>( 1.0 ) == 0x3FF0000000000000ull );
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -14,7 +14,7 @@ template<class T> void test_bit_ceil( T x )
|
|||||||
{
|
{
|
||||||
if( !boost::core::has_single_bit( x ) )
|
if( !boost::core::has_single_bit( x ) )
|
||||||
{
|
{
|
||||||
x >>= 1;
|
x = static_cast<T>( x >> 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
T y = boost::core::bit_ceil( x );
|
T y = boost::core::bit_ceil( x );
|
||||||
|
|||||||
26
test/bit_ceil_test_cx.cpp
Normal file
26
test/bit_ceil_test_cx.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// constexpr test for boost/core/bit.hpp (bit_ceil)
|
||||||
|
//
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#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" )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
|
||||||
|
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::bit_ceil( (unsigned char)0x74 ) == 0x80 );
|
||||||
|
STATIC_ASSERT( boost::core::bit_ceil( (unsigned short)0x7400 ) == 0x8000 );
|
||||||
|
STATIC_ASSERT( boost::core::bit_ceil( 0x740000u ) == 0x800000u );
|
||||||
|
STATIC_ASSERT( boost::core::bit_ceil( 0x74000000ul ) == 0x80000000ul );
|
||||||
|
STATIC_ASSERT( boost::core::bit_ceil( 0x7400000000ull ) == 0x8000000000ull );
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -14,7 +14,7 @@ template<class T> void test_countl( T x )
|
|||||||
{
|
{
|
||||||
x |= static_cast<T>( 1 ) << ( std::numeric_limits<T>::digits - 1 );
|
x |= static_cast<T>( 1 ) << ( std::numeric_limits<T>::digits - 1 );
|
||||||
|
|
||||||
for( int i = 0; i <= std::numeric_limits<T>::digits; ++i, x >>= 1 )
|
for( int i = 0; i <= std::numeric_limits<T>::digits; ++i, x = static_cast<T>( x >> 1 ) )
|
||||||
{
|
{
|
||||||
BOOST_TEST_EQ( boost::core::countl_zero( x ), i );
|
BOOST_TEST_EQ( boost::core::countl_zero( x ), i );
|
||||||
BOOST_TEST_EQ( boost::core::countl_one( static_cast<T>( ~x ) ), i );
|
BOOST_TEST_EQ( boost::core::countl_one( static_cast<T>( ~x ) ), i );
|
||||||
|
|||||||
41
test/bit_countl_test_cx.cpp
Normal file
41
test/bit_countl_test_cx.cpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
// constexpr test for boost/core/bit.hpp (countl_zero, countl_one)
|
||||||
|
//
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# pragma warning(disable: 4310) // cast truncates constant value
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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" )
|
||||||
|
|
||||||
|
#elif defined(BOOST_MSVC) && BOOST_MSVC / 10 == 191
|
||||||
|
|
||||||
|
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_MSVC is " BOOST_STRINGIZE(BOOST_MSVC) )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
|
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::countl_zero( (unsigned char)0x1F ) == CHAR_BIT - 5 );
|
||||||
|
STATIC_ASSERT( boost::core::countl_zero( (unsigned short)0x1F ) == sizeof(unsigned short) * CHAR_BIT - 5 );
|
||||||
|
STATIC_ASSERT( boost::core::countl_zero( 0x1Fu ) == sizeof(unsigned int) * CHAR_BIT - 5 );
|
||||||
|
STATIC_ASSERT( boost::core::countl_zero( 0x1Ful ) == sizeof(unsigned long) * CHAR_BIT - 5 );
|
||||||
|
STATIC_ASSERT( boost::core::countl_zero( 0x1Full ) == sizeof(unsigned long long) * CHAR_BIT - 5 );
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::countl_one( (unsigned char)~0x1Fu ) == CHAR_BIT - 5 );
|
||||||
|
STATIC_ASSERT( boost::core::countl_one( (unsigned short)~0x1Fu ) == sizeof(unsigned short) * CHAR_BIT - 5 );
|
||||||
|
STATIC_ASSERT( boost::core::countl_one( ~0x1Fu ) == sizeof(unsigned int) * CHAR_BIT - 5 );
|
||||||
|
STATIC_ASSERT( boost::core::countl_one( ~0x1Ful ) == sizeof(unsigned long) * CHAR_BIT - 5 );
|
||||||
|
STATIC_ASSERT( boost::core::countl_one( ~0x1Full ) == sizeof(unsigned long long) * CHAR_BIT - 5 );
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -14,7 +14,7 @@ template<class T> void test_countr( T x )
|
|||||||
{
|
{
|
||||||
x |= 1;
|
x |= 1;
|
||||||
|
|
||||||
for( int i = 0; i <= std::numeric_limits<T>::digits; ++i, x <<= 1 )
|
for( int i = 0; i <= std::numeric_limits<T>::digits; ++i, x = static_cast<T>( x << 1 ) )
|
||||||
{
|
{
|
||||||
BOOST_TEST_EQ( boost::core::countr_zero( x ), i );
|
BOOST_TEST_EQ( boost::core::countr_zero( x ), i );
|
||||||
BOOST_TEST_EQ( boost::core::countr_one( static_cast<T>( ~x ) ), i );
|
BOOST_TEST_EQ( boost::core::countr_one( static_cast<T>( ~x ) ), i );
|
||||||
|
|||||||
41
test/bit_countr_test_cx.cpp
Normal file
41
test/bit_countr_test_cx.cpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
// constexpr test for boost/core/bit.hpp (countr_zero, countr_one)
|
||||||
|
//
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
# pragma warning(disable: 4310) // cast truncates constant value
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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" )
|
||||||
|
|
||||||
|
#elif defined(BOOST_MSVC) && BOOST_MSVC / 10 == 191
|
||||||
|
|
||||||
|
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_MSVC is " BOOST_STRINGIZE(BOOST_MSVC) )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
|
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::countr_zero( (unsigned char)0xF8 ) == 3 );
|
||||||
|
STATIC_ASSERT( boost::core::countr_zero( (unsigned short)0xF800 ) == 11 );
|
||||||
|
STATIC_ASSERT( boost::core::countr_zero( 0xF80000u ) == 19 );
|
||||||
|
STATIC_ASSERT( boost::core::countr_zero( 0xF8000000ul ) == 27 );
|
||||||
|
STATIC_ASSERT( boost::core::countr_zero( 0xF800000000ull ) == 35 );
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::countr_one( (unsigned char)~0xF8u ) == 3 );
|
||||||
|
STATIC_ASSERT( boost::core::countr_one( (unsigned short)~0xF800u ) == 11 );
|
||||||
|
STATIC_ASSERT( boost::core::countr_one( ~0xF80000u ) == 19 );
|
||||||
|
STATIC_ASSERT( boost::core::countr_one( ~0xF8000000ul ) == 27 );
|
||||||
|
STATIC_ASSERT( boost::core::countr_one( ~0xF800000000ull ) == 35 );
|
||||||
|
|
||||||
|
#endif
|
||||||
30
test/bit_floor_test_cx.cpp
Normal file
30
test/bit_floor_test_cx.cpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// constexpr test for boost/core/bit.hpp (bit_floor)
|
||||||
|
//
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#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" )
|
||||||
|
|
||||||
|
#elif defined(BOOST_MSVC) && BOOST_MSVC / 10 == 191
|
||||||
|
|
||||||
|
BOOST_PRAGMA_MESSAGE( "Test skipped because BOOST_MSVC is " BOOST_STRINGIZE(BOOST_MSVC) )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
|
||||||
|
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::bit_floor( (unsigned char)0x74 ) == 0x40 );
|
||||||
|
STATIC_ASSERT( boost::core::bit_floor( (unsigned short)0x7400 ) == 0x4000 );
|
||||||
|
STATIC_ASSERT( boost::core::bit_floor( 0x740000u ) == 0x400000u );
|
||||||
|
STATIC_ASSERT( boost::core::bit_floor( 0x74000000ul ) == 0x40000000ul );
|
||||||
|
STATIC_ASSERT( boost::core::bit_floor( 0x7400000000ull ) == 0x4000000000ull );
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// Test for boost/core/bit.hpp (bit_ceil)
|
// Test for boost/core/bit.hpp (popcount)
|
||||||
//
|
//
|
||||||
// Copyright 2020 Peter Dimov
|
// Copyright 2020 Peter Dimov
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
template<class T> void test_popcount( T x )
|
template<class T> void test_popcount( T x )
|
||||||
{
|
{
|
||||||
int k = 0;
|
int k = 0;
|
||||||
for( T y = x; y; y &= y - 1, ++k );
|
for( T y = x; y; y = static_cast<T>( y & (y - 1) ), ++k );
|
||||||
|
|
||||||
BOOST_TEST_EQ( boost::core::popcount( x ), k ) || ( std::cerr << "x: " << +x << std::endl );
|
BOOST_TEST_EQ( boost::core::popcount( x ), k ) || ( std::cerr << "x: " << +x << std::endl );
|
||||||
}
|
}
|
||||||
|
|||||||
30
test/bit_popcount_test_cx.cpp
Normal file
30
test/bit_popcount_test_cx.cpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// constexpr test for boost/core/bit.hpp (popcount)
|
||||||
|
//
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER / 10 == 191
|
||||||
|
# pragma warning(disable: 4307) // '*': integral constant overflow
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#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" )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
|
||||||
|
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::popcount( (unsigned char)0x74 ) == 4 );
|
||||||
|
STATIC_ASSERT( boost::core::popcount( (unsigned short)0x7400 ) == 4 );
|
||||||
|
STATIC_ASSERT( boost::core::popcount( 0x740000u ) == 4 );
|
||||||
|
STATIC_ASSERT( boost::core::popcount( 0x74000000ul ) == 4 );
|
||||||
|
STATIC_ASSERT( boost::core::popcount( 0x7400000000ull ) == 4 );
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -20,7 +20,7 @@ template<class T> void test_rotate( T x )
|
|||||||
BOOST_TEST_EQ( +boost::core::rotl( x, -i ), +boost::core::rotr( x, i ) );
|
BOOST_TEST_EQ( +boost::core::rotl( x, -i ), +boost::core::rotr( x, i ) );
|
||||||
|
|
||||||
unsigned const width = std::numeric_limits<T>::digits;
|
unsigned const width = std::numeric_limits<T>::digits;
|
||||||
unsigned r = i & ( width - 1 );
|
unsigned r = static_cast<unsigned>( i ) & ( width - 1 );
|
||||||
|
|
||||||
if( r == 0 )
|
if( r == 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
33
test/bit_rotate_test_cx.cpp
Normal file
33
test/bit_rotate_test_cx.cpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// constexpr test for boost/core/bit.hpp (rotl, rotr)
|
||||||
|
//
|
||||||
|
// Copyright 2023 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#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" )
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::rotl( (std::uint8_t)0x11, 1 ) == 0x22 );
|
||||||
|
STATIC_ASSERT( boost::core::rotr( (std::uint8_t)0x11, 1 ) == 0x88 );
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::rotl( (std::uint16_t)0x1111, 1 ) == 0x2222 );
|
||||||
|
STATIC_ASSERT( boost::core::rotr( (std::uint16_t)0x1111, 1 ) == 0x8888 );
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::rotl( (std::uint32_t)0x11111111, 1 ) == 0x22222222 );
|
||||||
|
STATIC_ASSERT( boost::core::rotr( (std::uint32_t)0x11111111, 1 ) == 0x88888888 );
|
||||||
|
|
||||||
|
STATIC_ASSERT( boost::core::rotl( (std::uint64_t)0x1111111111111111, 1 ) == 0x2222222222222222 );
|
||||||
|
STATIC_ASSERT( boost::core::rotr( (std::uint64_t)0x1111111111111111, 1 ) == 0x8888888888888888 );
|
||||||
|
|
||||||
|
#endif
|
||||||
13
test/bit_width_fail.cpp
Normal file
13
test/bit_width_fail.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// Negative test for boost/core/bit.hpp (bit_width)
|
||||||
|
//
|
||||||
|
// Copyright 2022 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
#include <boost/core/bit.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// should fail, because 0 is a signed integral type
|
||||||
|
return boost::core::bit_width( 0 );
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user