forked from boostorg/core
Compare commits
83 Commits
feature/po
...
develop
Author | SHA1 | Date | |
---|---|---|---|
58f469cd80 | |||
457d6a8ad0 | |||
e3d8de377b | |||
8d25b9ce54 | |||
6e05e5e764 | |||
7cb3e689e0 | |||
11d367377f | |||
f32cb2f696 | |||
21761b3f62 | |||
2e87ab53f7 | |||
8d5ee24c97 | |||
db59ef2a81 | |||
c48b7f269f | |||
4c74671f73 | |||
1e1ccb491e | |||
787b03ea9c | |||
b9a2221b3b | |||
cb603c9c6b | |||
24a8174ef1 | |||
7178a52909 | |||
9a3febf848 | |||
3e147e4ced | |||
1222948a8e | |||
749b6340b5 | |||
92f6cfb3cc | |||
ed452c57a3 | |||
78885aab8e | |||
8ebe2e7f57 | |||
32e6c30f4b | |||
cebfe007e8 | |||
3e16f3df14 | |||
e3a2e88e4c | |||
5e451b6c84 | |||
88a957b21c | |||
1bac0ccfd1 | |||
602961e526 | |||
366802b43c | |||
9dd0a8e1e4 | |||
622476533c | |||
a09ee19e3e | |||
040b018ce0 | |||
42d0c5954a | |||
76d0f22d3b | |||
243eec26fe | |||
44c32d7691 | |||
0ee7dc5910 | |||
9e9e6e3898 | |||
242b14bb69 | |||
76061d91d4 | |||
bda05a7812 | |||
d66b8c1c13 | |||
bd29e0dd15 | |||
72761e34e0 | |||
983234baee | |||
83a3a51bee | |||
acbeaae181 | |||
d01b4e94cc | |||
e22bd49fa7 | |||
c056f3dfc9 | |||
8b8944dd6e | |||
278d3f0060 | |||
3f36d507f2 | |||
a77338b1cd | |||
a8c757ddf2 | |||
98a055cf34 | |||
074a467d9d | |||
965508d9e1 | |||
0a238bb30d | |||
d03e58b77e | |||
f774295cdb | |||
b18495fe35 | |||
c928c844da | |||
0a42ddabef | |||
04cc766db3 | |||
aa01ad8bf0 | |||
442e36f652 | |||
03040c7f5c | |||
8b31acf9a4 | |||
fd01cf788c | |||
151d0c4143 | |||
25b0defdeb | |||
541745ea24 | |||
5f825106c7 |
@ -32,6 +32,8 @@ local linux_pipeline(name, image, environment, packages = "", sources = [], arch
|
||||
commands:
|
||||
[
|
||||
'set -e',
|
||||
'uname -a',
|
||||
'echo $DRONE_STAGE_MACHINE',
|
||||
'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -',
|
||||
] +
|
||||
(if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) +
|
||||
@ -122,7 +124,7 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
linux_pipeline(
|
||||
"Linux 16.04 GCC 4.8 32/64",
|
||||
"cppalliance/droneubuntu1604:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11', ADDRMD: '32,64' },
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-4.8', CXXSTD: '03,11', ADDRMD: '32,64' },
|
||||
"g++-4.8-multilib",
|
||||
),
|
||||
|
||||
@ -200,31 +202,37 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 23.04 GCC 13 32 ASAN",
|
||||
"cppalliance/droneubuntu2304:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan,
|
||||
"g++-13-multilib",
|
||||
"Linux 24.04 GCC 13* 32/64",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32,64' },
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 23.04 GCC 13 64 ASAN",
|
||||
"cppalliance/droneubuntu2304:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + asan,
|
||||
"g++-13-multilib",
|
||||
"Linux 24.04 GCC 14 32 ASAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + asan,
|
||||
"g++-14-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 23.04 GCC 13 32 UBSAN",
|
||||
"cppalliance/droneubuntu2304:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + ubsan,
|
||||
"g++-13-multilib",
|
||||
"Linux 24.04 GCC 14 64 ASAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + asan,
|
||||
"g++-14-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 23.04 GCC 13 64 UBSAN",
|
||||
"cppalliance/droneubuntu2304:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + ubsan,
|
||||
"g++-13-multilib",
|
||||
"Linux 24.04 GCC 14 32 UBSAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '32' } + ubsan,
|
||||
"g++-14-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.04 GCC 14 64 UBSAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b', ADDRMD: '64' } + ubsan,
|
||||
"g++-14-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
@ -347,24 +355,38 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 23.04 Clang 16",
|
||||
"cppalliance/droneubuntu2304:1",
|
||||
"Linux 24.04 Clang 16",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-16', CXXSTD: '03,11,14,17,20,2b' },
|
||||
"clang-16",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 23.10 Clang 17 UBSAN",
|
||||
"cppalliance/droneubuntu2310:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
|
||||
"Linux 24.04 Clang 17",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '03,11,14,17,20,2b' },
|
||||
"clang-17",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 23.10 Clang 17 ASAN",
|
||||
"cppalliance/droneubuntu2310:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '03,11,14,17,20,2b' } + asan,
|
||||
"clang-17",
|
||||
"Linux 24.04 Clang 18 UBSAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
|
||||
"clang-18",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.04 Clang 18 ASAN",
|
||||
"cppalliance/droneubuntu2404:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + asan,
|
||||
"clang-18",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 24.10 Clang 19",
|
||||
"cppalliance/droneubuntu2410:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-19', CXXSTD: '03,11,14,17,20,2b' },
|
||||
"clang-19",
|
||||
),
|
||||
|
||||
macos_pipeline(
|
||||
|
147
.github/workflows/ci.yml
vendored
147
.github/workflows/ci.yml
vendored
@ -1,5 +1,5 @@
|
||||
# Copyright 2020-2021 Peter Dimov
|
||||
# Copyright 2021-2024 Andrey Semashev
|
||||
# Copyright 2021-2025 Andrey Semashev
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
@ -100,13 +100,13 @@ jobs:
|
||||
- toolset: gcc-9
|
||||
cxxstd: "03,11,14,17,2a"
|
||||
address-model: 32,64
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-24.04
|
||||
install:
|
||||
- g++-9-multilib
|
||||
- toolset: gcc-10
|
||||
cxxstd: "03,11,14,17,20"
|
||||
address-model: 32,64
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-24.04
|
||||
install:
|
||||
- g++-10-multilib
|
||||
- toolset: gcc-11
|
||||
@ -125,9 +125,23 @@ jobs:
|
||||
cxxstd: "03,11,14,17,20,23"
|
||||
address-model: 32,64
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:23.04
|
||||
container: ubuntu:24.04
|
||||
install:
|
||||
- g++-13-multilib
|
||||
- toolset: gcc-14
|
||||
cxxstd: "03,11,14,17,20,23"
|
||||
address-model: 32,64
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:24.04
|
||||
install:
|
||||
- g++-14-multilib
|
||||
- toolset: gcc-15
|
||||
cxxstd: "03,11,14,17,20,23,2c"
|
||||
address-model: 32,64
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:25.04
|
||||
install:
|
||||
- g++-15-multilib
|
||||
- name: UBSAN
|
||||
toolset: gcc-12
|
||||
cxxstd: "03,11,14,17,20,23"
|
||||
@ -213,13 +227,15 @@ jobs:
|
||||
- toolset: clang
|
||||
compiler: clang++-9
|
||||
cxxstd: "03,11,14,17,2a"
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:20.04
|
||||
install:
|
||||
- clang-9
|
||||
- toolset: clang
|
||||
compiler: clang++-10
|
||||
cxxstd: "03,11,14,17,20"
|
||||
os: ubuntu-20.04
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:20.04
|
||||
install:
|
||||
- clang-10
|
||||
- toolset: clang
|
||||
@ -276,7 +292,7 @@ jobs:
|
||||
compiler: clang++-16
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:23.04
|
||||
container: ubuntu:24.04
|
||||
install:
|
||||
- clang-16
|
||||
- libc++-16-dev
|
||||
@ -286,15 +302,45 @@ jobs:
|
||||
- toolset: clang
|
||||
compiler: clang++-17
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-22.04
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:24.04
|
||||
install:
|
||||
- clang-17
|
||||
- libc++-17-dev
|
||||
- libc++abi-17-dev
|
||||
sources:
|
||||
- "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main"
|
||||
source_keys:
|
||||
- "https://apt.llvm.org/llvm-snapshot.gpg.key"
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
- toolset: clang
|
||||
compiler: clang++-18
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:24.04
|
||||
install:
|
||||
- clang-18
|
||||
- libc++-18-dev
|
||||
- libc++abi-18-dev
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
- toolset: clang
|
||||
compiler: clang++-19
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:24.04
|
||||
install:
|
||||
- clang-19
|
||||
- libc++-19-dev
|
||||
- libc++abi-19-dev
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
- toolset: clang
|
||||
compiler: clang++-20
|
||||
cxxstd: "03,11,14,17,20,2b,2c"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:25.04
|
||||
install:
|
||||
- clang-20
|
||||
- libc++-20-dev
|
||||
- libc++abi-20-dev
|
||||
cxxflags: -stdlib=libc++
|
||||
linkflags: -stdlib=libc++
|
||||
- name: UBSAN
|
||||
@ -310,15 +356,23 @@ jobs:
|
||||
- libc++-15-dev
|
||||
- libc++abi-15-dev
|
||||
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,2a"
|
||||
os: macos-11
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-12
|
||||
- name: ARM
|
||||
toolset: gcc-13
|
||||
cxxstd: "03-gnu,11-gnu,14-gnu,17-gnu,20-gnu,23-gnu"
|
||||
os: ubuntu-24.04-arm
|
||||
container: ubuntu:24.04
|
||||
install:
|
||||
- g++-13
|
||||
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-13
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-14
|
||||
- toolset: clang
|
||||
cxxstd: "03,11,14,17,20,2b"
|
||||
os: macos-15
|
||||
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{matrix.os}}
|
||||
@ -337,6 +391,22 @@ jobs:
|
||||
echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV
|
||||
if [ -f "/etc/debian_version" ]
|
||||
then
|
||||
# Use Azure APT mirrors in containers to avoid HTTP errors due to DDoS filters triggered by lots of CI jobs launching concurrently.
|
||||
# Note that not all Ubuntu versions support "mirror+file:..." URIs in APT sources, so just use Azure mirrors exclusively.
|
||||
# Note also that on recent Ubuntu versions DEB822 format is used for source files.
|
||||
APT_SOURCES=()
|
||||
if [ -d "/etc/apt/sources.list.d" ]
|
||||
then
|
||||
readarray -t APT_SOURCES < <(find "/etc/apt/sources.list.d" -type f -name '*.sources' -print)
|
||||
fi
|
||||
if [ -f "/etc/apt/sources.list" ]
|
||||
then
|
||||
APT_SOURCES+=("/etc/apt/sources.list")
|
||||
fi
|
||||
if [ "${#APT_SOURCES[@]}" -gt 0 ]
|
||||
then
|
||||
sed -i -E -e 's!([^ ]+) (http|https)://(archive|security)\.ubuntu\.com/ubuntu[^ ]*(.*)!\1 http://azure.archive.ubuntu.com/ubuntu/\4!' "${APT_SOURCES[@]}"
|
||||
fi
|
||||
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
|
||||
if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ]
|
||||
then
|
||||
@ -537,14 +607,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- toolset: msvc-14.0
|
||||
cxxstd: "14"
|
||||
addrmd: 32,64
|
||||
os: windows-2019
|
||||
- toolset: msvc-14.2
|
||||
cxxstd: "14,17,20,latest"
|
||||
addrmd: 32,64
|
||||
os: windows-2019
|
||||
- toolset: msvc-14.3
|
||||
cxxstd: "14,17,20,latest"
|
||||
addrmd: 32,64
|
||||
@ -556,7 +618,14 @@ jobs:
|
||||
- toolset: gcc
|
||||
cxxstd: "03,11,14,17,2a"
|
||||
addrmd: 64
|
||||
os: windows-2019
|
||||
os: windows-2022
|
||||
|
||||
# Windows SDK 32-bit ARM libs not installed in this image
|
||||
- name: ARM
|
||||
toolset: msvc-14.3
|
||||
cxxstd: "14,17,20,latest"
|
||||
addrmd: 64
|
||||
os: windows-11-arm
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 45
|
||||
@ -609,11 +678,11 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: ubuntu-24.04
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
- os: macos-15
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
@ -676,11 +745,11 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: ubuntu-24.04
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
- os: macos-15
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
@ -753,11 +822,11 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
- os: macos-11
|
||||
- os: macos-12
|
||||
- os: ubuntu-24.04
|
||||
- os: macos-13
|
||||
- os: macos-14
|
||||
- os: macos-15
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 20
|
||||
@ -834,8 +903,8 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-2019
|
||||
- os: windows-2022
|
||||
- os: windows-2025
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
@ -896,8 +965,8 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-2019
|
||||
- os: windows-2022
|
||||
- os: windows-2025
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 10
|
||||
@ -976,8 +1045,8 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-2019
|
||||
- os: windows-2022
|
||||
- os: windows-2025
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
timeout-minutes: 20
|
||||
|
23
build.jam
Normal file
23
build.jam
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright 2023-2024 René Ferdinand Rivera Morell
|
||||
# Copyright 2024 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
require-b2 5.2 ;
|
||||
|
||||
constant boost_dependencies :
|
||||
/boost/assert//boost_assert
|
||||
/boost/config//boost_config
|
||||
/boost/static_assert//boost_static_assert
|
||||
/boost/throw_exception//boost_throw_exception
|
||||
;
|
||||
|
||||
project /boost/core ;
|
||||
|
||||
explicit
|
||||
[ alias boost_core : : : : <include>include <library>$(boost_dependencies) ]
|
||||
[ alias all : boost_core test ]
|
||||
;
|
||||
|
||||
call-if : boost-library core
|
||||
;
|
@ -9,7 +9,7 @@ import project ;
|
||||
import doxygen ;
|
||||
import quickbook ;
|
||||
|
||||
path-constant INCLUDES : ../../.. ;
|
||||
path-constant INCLUDES : ../include ;
|
||||
|
||||
doxygen ref_reference
|
||||
:
|
||||
|
@ -7,12 +7,24 @@
|
||||
|
||||
[section Revision History]
|
||||
|
||||
[section Changes in 1.86.0]
|
||||
|
||||
* Added a [link core.pointer_in_range `boost/core/pointer_in_range.hpp`] header with a `pointer_in_range`
|
||||
function template to check if a pointer is within a given range.
|
||||
* Fixed `type_name` for abstract classes. ([github_issue 172])
|
||||
* Fixed `boost/core/type_name.hpp` compilation error with MSVC with disabled native `wchar_t` type.
|
||||
([github_issue 173])
|
||||
* Added a workaround for an MSVC [@https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025 bug]
|
||||
causing `empty_value` compilation errors when it is used with a nested class. ([github_pr 175])
|
||||
|
||||
[endsect]
|
||||
|
||||
[section Changes in 1.85.0]
|
||||
|
||||
* Added a new [link core.functor `boost/core/functor.hpp`] header with a `functor` class template
|
||||
for wrapping a raw function into a function object class.
|
||||
* Changed [link core.null_deleter `null_deleter`], [link core.fclose_deleter `fclose_deleter`]
|
||||
and [link.checked_delete checked deleter] definitions so that they don't bring namespace `boost`
|
||||
and [link core.checked_delete checked deleter] definitions so that they don't bring namespace `boost`
|
||||
into argument-dependent lookup in cases like this:
|
||||
```
|
||||
std::unique_ptr< std::FILE, boost::fclose_deleter > p1, p2;
|
||||
|
@ -20,6 +20,9 @@ or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
]
|
||||
]
|
||||
|
||||
[template github_issue[key]'''<ulink url="https://github.com/boostorg/core/issues/'''[key]'''">#'''[key]'''</ulink>''']
|
||||
[template github_pr[key]'''<ulink url="https://github.com/boostorg/core/pull/'''[key]'''">PR#'''[key]'''</ulink>''']
|
||||
|
||||
[template simplesect[title]
|
||||
[block '''<simplesect><title>'''[title]'''</title>''']]
|
||||
|
||||
|
@ -33,7 +33,7 @@ template<class T, class N>
|
||||
void
|
||||
Allocator<T, N>::deallocate(pointer ptr, size_type)
|
||||
{
|
||||
if (!boost::pointer_in_range(ptr, &buffer_[0], &buffer_[N])) {
|
||||
if (!boost::pointer_in_range(ptr, buffer_, buffer_ + N)) {
|
||||
::operator delete(ptr);
|
||||
}
|
||||
}
|
||||
@ -56,8 +56,9 @@ constexpr bool pointer_in_range(const T* ptr, const T* begin, const T* end);
|
||||
|
||||
[variablelist
|
||||
[[`template<class T> constexpr bool pointer_in_range(const T* ptr,
|
||||
const T* begin, T* end);`]
|
||||
const T* begin, const T* end);`]
|
||||
[[variablelist
|
||||
[[Requires][`[begin,end)` is a valid range.]]
|
||||
[[Returns][`true` if `ptr` is in range `[begin,end)`, otherwise `false`.]]]]]]
|
||||
|
||||
[endsect]
|
||||
|
@ -38,7 +38,7 @@ and return type use spans.
|
||||
|
||||
```
|
||||
auto sha1(boost::span<const unsigned char> input,
|
||||
boost::span<unsigned char, SHA_DIGEST_LENGTH> ouput)
|
||||
boost::span<unsigned char, SHA_DIGEST_LENGTH> output)
|
||||
{
|
||||
SHA_CTX context;
|
||||
SHA1_Init(&context);
|
||||
|
@ -28,7 +28,7 @@
|
||||
# pragma intrinsic(_BitScanForward)
|
||||
# pragma intrinsic(_BitScanReverse)
|
||||
|
||||
# if defined(_M_X64)
|
||||
# if defined(_M_X64) || defined(_M_ARM64)
|
||||
# pragma intrinsic(_BitScanForward64)
|
||||
# pragma intrinsic(_BitScanReverse64)
|
||||
# endif
|
||||
@ -230,7 +230,7 @@ inline int countl_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(_M_X64) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||
{
|
||||
@ -255,7 +255,7 @@ BOOST_CXX14_CONSTEXPR inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(_MSC_VER) && defined(_M_X64)
|
||||
#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
|
||||
|
||||
inline int countl_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||
{
|
||||
@ -455,7 +455,7 @@ inline int countr_impl( boost::uint16_t x ) BOOST_NOEXCEPT
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(_M_X64) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) && defined(BOOST_CORE_HAS_BUILTIN_ISCONSTEVAL)
|
||||
|
||||
BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||
{
|
||||
@ -480,7 +480,7 @@ BOOST_CXX14_CONSTEXPR inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(_MSC_VER) && defined(_M_X64)
|
||||
#elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64))
|
||||
|
||||
inline int countr_impl( boost::uint64_t x ) BOOST_NOEXCEPT
|
||||
{
|
||||
@ -703,7 +703,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint32_t bit_ceil_impl( boost::uint32_t x )
|
||||
{
|
||||
if( x == 0 )
|
||||
{
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
--x;
|
||||
@ -723,7 +723,7 @@ BOOST_CXX14_CONSTEXPR inline boost::uint64_t bit_ceil_impl( boost::uint64_t x )
|
||||
{
|
||||
if( x == 0 )
|
||||
{
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
--x;
|
||||
|
@ -10,6 +10,7 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <new>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#if defined( BOOST_CORE_HAS_CXXABI_H )
|
||||
# include <cxxabi.h>
|
||||
// For some archtectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library
|
||||
// For some architectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library
|
||||
// (https://android.googlesource.com/platform/ndk/+/master/sources/cxx-stl/gabi++/), which does not implement
|
||||
// abi::__cxa_demangle(). We detect this implementation by checking the include guard here.
|
||||
# if defined( __GABIXX_CXXABI_H__ )
|
||||
|
18
include/boost/core/detail/assert.hpp
Normal file
18
include/boost/core/detail/assert.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Copyright 2025 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#undef BOOST_CORE_DETAIL_ASSERT
|
||||
|
||||
#if !defined(__clang__) && \
|
||||
!defined(__INTEL_COMPILER) && \
|
||||
defined(__GNUC__) && \
|
||||
(__GNUC__ < 5)
|
||||
#define BOOST_CORE_DETAIL_ASSERT(expr) void(0)
|
||||
#else
|
||||
#include <boost/assert.hpp>
|
||||
#define BOOST_CORE_DETAIL_ASSERT(expr) BOOST_ASSERT(expr)
|
||||
#endif
|
58
include/boost/core/detail/minstd_rand.hpp
Normal file
58
include/boost/core/detail/minstd_rand.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
|
||||
#define BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
|
||||
|
||||
// Copyright 2017 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
//
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// An implementation of minstd_rand that does not require
|
||||
// the Random library
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class minstd_rand
|
||||
{
|
||||
private:
|
||||
|
||||
boost::uint_least32_t x_;
|
||||
|
||||
enum { a = 48271, m = 2147483647 };
|
||||
|
||||
public:
|
||||
|
||||
minstd_rand(): x_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
explicit minstd_rand( boost::uint_least32_t x ): x_( x % m )
|
||||
{
|
||||
if( x_ == 0 )
|
||||
{
|
||||
x_ = 1;
|
||||
}
|
||||
}
|
||||
|
||||
boost::uint_least32_t operator()()
|
||||
{
|
||||
boost::uint_least64_t y = x_;
|
||||
|
||||
y = ( a * y ) % m;
|
||||
|
||||
x_ = static_cast<boost::uint_least32_t>( y );
|
||||
|
||||
return x_;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_CORE_DETAIL_MINSTD_RAND_HPP_INCLUDED
|
@ -67,7 +67,7 @@ namespace core
|
||||
|
||||
inline void sp_thread_sleep() BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
|
||||
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__) && !defined(__OHOS__)
|
||||
|
||||
int oldst;
|
||||
pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &oldst );
|
||||
@ -85,7 +85,7 @@ inline void sp_thread_sleep() BOOST_NOEXCEPT
|
||||
|
||||
nanosleep( &rqtp, 0 );
|
||||
|
||||
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__)
|
||||
#if defined(BOOST_HAS_PTHREADS) && !defined(__ANDROID__) && !defined(__OHOS__)
|
||||
|
||||
pthread_setcancelstate( oldst, &oldst );
|
||||
|
||||
|
@ -41,9 +41,6 @@ namespace boost
|
||||
// forward declaration of boost::basic_string_view from Utility
|
||||
template<class Ch, class Tr> class basic_string_view;
|
||||
|
||||
// forward declaration of boost::hash_range from ContainerHash
|
||||
template<class It> std::size_t hash_range( It, It );
|
||||
|
||||
namespace core
|
||||
{
|
||||
namespace detail
|
||||
@ -74,7 +71,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_of( Ch const* p_
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@ -91,7 +88,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_of( Ch const* p_
|
||||
{
|
||||
for( std::size_t i = pos; i < n_; ++i )
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
if( ch >= 0 && ch < 256 && table[ ch ] ) return i;
|
||||
}
|
||||
}
|
||||
@ -129,7 +126,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_of( Ch const* p_,
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@ -150,7 +147,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_of( Ch const* p_,
|
||||
{
|
||||
do
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 && table[ ch ] ) return i;
|
||||
|
||||
@ -199,7 +196,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_not_of( Ch const
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@ -216,7 +213,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_first_not_of( Ch const
|
||||
{
|
||||
for( std::size_t i = pos; i < n_; ++i )
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
if( !( ch >= 0 && ch < 256 && table[ ch ] ) ) return i;
|
||||
}
|
||||
}
|
||||
@ -262,7 +259,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_not_of( Ch const*
|
||||
|
||||
for( std::size_t j = 0; j < n; ++j )
|
||||
{
|
||||
UCh ch = s[ j ];
|
||||
UCh ch = static_cast<UCh>( s[ j ] );
|
||||
|
||||
if( ch >= 0 && ch < 256 )
|
||||
{
|
||||
@ -283,7 +280,7 @@ template<class Ch> BOOST_CXX14_CONSTEXPR std::size_t find_last_not_of( Ch const*
|
||||
{
|
||||
do
|
||||
{
|
||||
UCh ch = p_[ i ];
|
||||
UCh ch = static_cast<UCh>( p_[ i ] );
|
||||
|
||||
if( !( ch >= 0 && ch < 256 && table[ ch ] ) ) return i;
|
||||
|
||||
@ -381,7 +378,7 @@ public:
|
||||
}
|
||||
|
||||
template<class End> BOOST_CXX14_CONSTEXPR basic_string_view( Ch const* first, End last,
|
||||
typename boost::enable_if<boost::core::detail::is_same<End, Ch const*> >::type* = 0 ) BOOST_NOEXCEPT: p_( first ), n_( last - first )
|
||||
typename boost::enable_if<boost::core::detail::is_same<End, Ch const*>, int >::type = 0 ) BOOST_NOEXCEPT: p_( first ), n_( static_cast<size_type>( last - first ) )
|
||||
{
|
||||
BOOST_ASSERT( last - first >= 0 );
|
||||
}
|
||||
@ -399,7 +396,7 @@ public:
|
||||
#endif
|
||||
|
||||
template<class Ch2> basic_string_view( boost::basic_string_view<Ch2, std::char_traits<Ch2> > const& str,
|
||||
typename boost::enable_if<boost::core::detail::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>, int >::type = 0 ) BOOST_NOEXCEPT: p_( str.data() ), n_( str.size() )
|
||||
{
|
||||
}
|
||||
|
||||
@ -681,7 +678,7 @@ public:
|
||||
|
||||
Ch const* r = traits_type::find( data() + pos, size() - pos, c );
|
||||
|
||||
return r? r - data(): npos;
|
||||
return r? static_cast<size_type>( r - data() ): npos;
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR size_type find( Ch const* s, size_type pos, size_type n ) const BOOST_NOEXCEPT
|
||||
@ -696,11 +693,11 @@ public:
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
p = traits_type::find( p, last - p, s[0] );
|
||||
p = traits_type::find( p, static_cast<size_type>( last - p ), s[0] );
|
||||
|
||||
if( p == 0 ) break;
|
||||
|
||||
if( traits_type::compare( p + 1, s + 1, n - 1 ) == 0 ) return p - data();
|
||||
if( traits_type::compare( p + 1, s + 1, n - 1 ) == 0 ) return static_cast<size_type>( p - data() );
|
||||
|
||||
++p;
|
||||
}
|
||||
@ -1181,11 +1178,6 @@ public:
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline friend std::size_t hash_value( basic_string_view const& sv )
|
||||
{
|
||||
return boost::hash_range( sv.begin(), sv.end() );
|
||||
}
|
||||
};
|
||||
|
||||
// stream inserter
|
||||
@ -1193,7 +1185,7 @@ public:
|
||||
template<class Ch> std::basic_ostream<Ch>& operator<<( std::basic_ostream<Ch>& os, basic_string_view<Ch> str )
|
||||
{
|
||||
Ch const* p = str.data();
|
||||
std::streamsize n = str.size();
|
||||
std::streamsize n = static_cast<std::streamsize>( str.size() );
|
||||
|
||||
std::streamsize m = os.width();
|
||||
|
||||
|
@ -95,9 +95,57 @@ private:
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
#if defined(BOOST_MSVC)
|
||||
/*
|
||||
This is a workaround to an MSVC bug when T is a nested class:
|
||||
https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025
|
||||
*/
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
class empty_value_base
|
||||
: public T {
|
||||
public:
|
||||
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
||||
empty_value_base() = default;
|
||||
#else
|
||||
BOOST_CONSTEXPR empty_value_base() { }
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class U, class... Args>
|
||||
BOOST_CONSTEXPR empty_value_base(U&& value, Args&&... args)
|
||||
: T(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value_base(U&& value)
|
||||
: T(std::forward<U>(value)) { }
|
||||
#endif
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value_base(const U& value)
|
||||
: T(value) { }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value_base(U& value)
|
||||
: T(value) { }
|
||||
#endif
|
||||
};
|
||||
|
||||
} /* detail */
|
||||
#endif
|
||||
|
||||
template<class T, unsigned N>
|
||||
class empty_value<T, N, true>
|
||||
#if defined(BOOST_MSVC)
|
||||
: detail::empty_value_base<T> {
|
||||
typedef detail::empty_value_base<T> empty_base_;
|
||||
#else
|
||||
: T {
|
||||
typedef T empty_base_;
|
||||
#endif
|
||||
|
||||
public:
|
||||
typedef T type;
|
||||
|
||||
@ -108,26 +156,26 @@ public:
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t)
|
||||
: T() { }
|
||||
: empty_base_() { }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class U, class... Args>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value, Args&&... args)
|
||||
: T(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||
: empty_base_(std::forward<U>(value), std::forward<Args>(args)...) { }
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U&& value)
|
||||
: T(std::forward<U>(value)) { }
|
||||
: empty_base_(std::forward<U>(value)) { }
|
||||
#endif
|
||||
#else
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, const U& value)
|
||||
: T(value) { }
|
||||
: empty_base_(value) { }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONSTEXPR empty_value(boost::empty_init_t, U& value)
|
||||
: T(value) { }
|
||||
: empty_base_(value) { }
|
||||
#endif
|
||||
|
||||
BOOST_CONSTEXPR const T& get() const BOOST_NOEXCEPT {
|
||||
|
@ -153,6 +153,7 @@ inline void no_throw_failed_impl(const char* expr, const char* what, const char*
|
||||
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
# pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
|
||||
// specialize test output for char pointers to avoid printing as cstring
|
||||
|
@ -37,7 +37,7 @@ namespace boost
|
||||
/**
|
||||
* Casts a scoped enum to its underlying type.
|
||||
*
|
||||
* This function is useful when working with scoped enum classes, which doens't implicitly convert to the underlying type.
|
||||
* This function is useful when working with scoped enum classes, which doesn't implicitly convert to the underlying type.
|
||||
* @param v A scoped enum.
|
||||
* @returns The underlying type.
|
||||
* @throws No-throws.
|
||||
|
@ -8,6 +8,7 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
#ifndef BOOST_CORE_SPAN_HPP
|
||||
#define BOOST_CORE_SPAN_HPP
|
||||
|
||||
#include <boost/core/detail/assert.hpp>
|
||||
#include <boost/core/data.hpp>
|
||||
#include <array>
|
||||
#include <iterator>
|
||||
@ -274,17 +275,21 @@ public:
|
||||
}
|
||||
|
||||
constexpr span<T, dynamic_extent> first(size_type c) const {
|
||||
return span<T, dynamic_extent>(s_.p, c);
|
||||
return BOOST_CORE_DETAIL_ASSERT(c <= size()),
|
||||
span<T, dynamic_extent>(s_.p, c);
|
||||
}
|
||||
|
||||
constexpr span<T, dynamic_extent> last(size_type c) const {
|
||||
return span<T, dynamic_extent>(s_.p + (s_.n - c), c);
|
||||
return BOOST_CORE_DETAIL_ASSERT(c <= size()),
|
||||
span<T, dynamic_extent>(s_.p + (s_.n - c), c);
|
||||
}
|
||||
|
||||
constexpr span<T, dynamic_extent> subspan(size_type o,
|
||||
size_type c = dynamic_extent) const {
|
||||
return span<T, dynamic_extent>(s_.p + o,
|
||||
c == dynamic_extent ? s_.n - o : c);
|
||||
return BOOST_CORE_DETAIL_ASSERT(o <= size() &&
|
||||
(c == dynamic_extent || c + o <= size())),
|
||||
span<T, dynamic_extent>(s_.p + o,
|
||||
c == dynamic_extent ? s_.n - o : c);
|
||||
}
|
||||
|
||||
constexpr size_type size() const noexcept {
|
||||
@ -300,15 +305,15 @@ public:
|
||||
}
|
||||
|
||||
constexpr reference operator[](size_type i) const {
|
||||
return s_.p[i];
|
||||
return BOOST_CORE_DETAIL_ASSERT(i < size()), s_.p[i];
|
||||
}
|
||||
|
||||
constexpr reference front() const {
|
||||
return *s_.p;
|
||||
return BOOST_CORE_DETAIL_ASSERT(!empty()), *s_.p;
|
||||
}
|
||||
|
||||
constexpr reference back() const {
|
||||
return s_.p[s_.n - 1];
|
||||
return BOOST_CORE_DETAIL_ASSERT(!empty()), s_.p[s_.n - 1];
|
||||
}
|
||||
|
||||
constexpr pointer data() const noexcept {
|
||||
@ -351,8 +356,10 @@ private:
|
||||
detail::span_store<T, E> s_;
|
||||
};
|
||||
|
||||
#if defined(BOOST_NO_CXX17_INLINE_VARIABLES)
|
||||
template<class T, std::size_t E>
|
||||
constexpr std::size_t span<T, E>::extent;
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_deduction_guides
|
||||
template<class I, class L>
|
||||
|
@ -103,7 +103,8 @@ inline std::string fix_typeid_name( char const* n )
|
||||
}
|
||||
|
||||
// class types can be incomplete
|
||||
template<class T> std::string typeid_name_impl( int T::* )
|
||||
// but also abstract (T[1] doesn't form)
|
||||
template<class T> std::string typeid_name_impl( int T::*, T(*)[1] )
|
||||
{
|
||||
std::string r = fix_typeid_name( typeid(T[1]).name() );
|
||||
return r.substr( 0, r.size() - 4 ); // remove ' [1]' suffix
|
||||
@ -116,7 +117,7 @@ template<class T> std::string typeid_name_impl( ... )
|
||||
|
||||
template<class T> std::string typeid_name()
|
||||
{
|
||||
return typeid_name_impl<T>( 0 );
|
||||
return typeid_name_impl<T>( 0, 0 );
|
||||
}
|
||||
|
||||
// template names
|
||||
@ -345,6 +346,8 @@ template<> struct tn_holder<boost::uint128_type>
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
|
||||
template<> struct tn_holder<wchar_t>
|
||||
{
|
||||
static std::string type_name( std::string const& suffix )
|
||||
@ -353,6 +356,8 @@ template<> struct tn_holder<wchar_t>
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
|
||||
template<> struct tn_holder<char16_t>
|
||||
|
@ -8,17 +8,6 @@ if(HAVE_BOOST_TEST)
|
||||
|
||||
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::core Boost::static_assert Boost::type_traits)
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::type_traits)
|
||||
|
||||
boost_test(TYPE run SOURCES eif_constructors.cpp)
|
||||
boost_test(TYPE run SOURCES eif_dummy_arg_disambiguation.cpp)
|
||||
boost_test(TYPE run SOURCES eif_lazy.cpp)
|
||||
boost_test(TYPE run SOURCES eif_lazy_test.cpp)
|
||||
boost_test(TYPE run SOURCES eif_member_templates.cpp)
|
||||
boost_test(TYPE run SOURCES eif_namespace_disambiguation.cpp)
|
||||
boost_test(TYPE run SOURCES eif_no_disambiguation.cpp)
|
||||
boost_test(TYPE run SOURCES eif_partial_specializations.cpp)
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::throw_exception)
|
||||
|
||||
boost_test(TYPE run SOURCES no_exceptions_support_test.cpp)
|
||||
@ -27,6 +16,10 @@ set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::utility)
|
||||
|
||||
boost_test(TYPE run SOURCES sv_conversion_test2.cpp)
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::container_hash)
|
||||
|
||||
boost_test(TYPE run SOURCES sv_hash_test.cpp)
|
||||
|
||||
set(BOOST_TEST_LINK_LIBRARIES Boost::core Boost::config Boost::move Boost::smart_ptr)
|
||||
|
||||
boost_test(TYPE run SOURCES fclose_deleter_test.cpp)
|
||||
|
138
test/Jamfile.v2
138
test/Jamfile.v2
@ -6,11 +6,15 @@
|
||||
# See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
require-b2 5.0.1 ;
|
||||
import-search /boost/config/checks ;
|
||||
import config : requires ;
|
||||
import modules ;
|
||||
import testing ;
|
||||
|
||||
project : requirements
|
||||
|
||||
<library>/boost/core//boost_core
|
||||
<library>/boost/type_traits//boost_type_traits
|
||||
<warnings>extra
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on
|
||||
@ -22,6 +26,17 @@ local warnings-as-errors-off =
|
||||
"-<toolset>gcc:<warnings-as-errors>on"
|
||||
"-<toolset>clang:<warnings-as-errors>on" ;
|
||||
|
||||
local pedantic-errors = <warnings>pedantic
|
||||
<toolset>gcc:<cxxflags>"-Wconversion"
|
||||
<toolset>gcc:<cxxflags>"-Wsign-conversion"
|
||||
<toolset>clang:<cxxflags>"-Wconversion"
|
||||
<toolset>clang:<cxxflags>"-Wsign-conversion"
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on ;
|
||||
|
||||
local CPP11 = [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_constexpr cxx11_noexcept cxx11_ref_qualifiers ] ;
|
||||
|
||||
# quick test (for CI)
|
||||
run quick.cpp ;
|
||||
|
||||
@ -34,7 +49,8 @@ compile addressof_constexpr_test.cpp ;
|
||||
compile-fail addressof_fail_rvalue.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
run checked_delete_test.cpp ;
|
||||
run checked_delete_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
compile-fail checked_delete_fail.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
compile-fail checked_delete_fail2.cpp
|
||||
@ -69,14 +85,14 @@ compile-fail ref_implicit_fail4.cpp
|
||||
run ref_cv_test.cpp ;
|
||||
run ref_conversion_test.cpp ;
|
||||
|
||||
run eif_constructors.cpp : ;
|
||||
run eif_dummy_arg_disambiguation.cpp : ;
|
||||
run eif_lazy.cpp : ;
|
||||
run eif_lazy_test.cpp : ;
|
||||
run eif_member_templates.cpp : ;
|
||||
run eif_namespace_disambiguation.cpp : ;
|
||||
run eif_no_disambiguation.cpp : ;
|
||||
run eif_partial_specializations.cpp : ;
|
||||
run eif_constructors.cpp ;
|
||||
run eif_dummy_arg_disambiguation.cpp ;
|
||||
run eif_lazy.cpp ;
|
||||
run eif_lazy_test.cpp ;
|
||||
run eif_member_templates.cpp ;
|
||||
run eif_namespace_disambiguation.cpp ;
|
||||
run eif_no_disambiguation.cpp ;
|
||||
run eif_partial_specializations.cpp ;
|
||||
|
||||
compile-fail noncopyable_compile_fail.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
@ -101,13 +117,6 @@ run visit_each_test.cpp ;
|
||||
|
||||
run get_pointer_test.cpp ;
|
||||
|
||||
local pedantic-errors = <warnings>pedantic
|
||||
<toolset>gcc:<cxxflags>"-Wconversion"
|
||||
<toolset>clang:<cxxflags>"-Wconversion"
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on ;
|
||||
|
||||
run lightweight_test_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run lightweight_test_test.cpp : : :
|
||||
@ -194,7 +203,13 @@ run underlying_type.cpp ;
|
||||
compile-fail null_deleter_compile_fail_adl.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
run fclose_deleter_test.cpp : : : <target-os>windows:<define>_CRT_SECURE_NO_WARNINGS <target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE ;
|
||||
run fclose_deleter_test.cpp : : :
|
||||
$(CPP11)
|
||||
<library>/boost/move//boost_move
|
||||
<library>/boost/smart_ptr//boost_smart_ptr
|
||||
<target-os>windows:<define>_CRT_SECURE_NO_WARNINGS
|
||||
<target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE ;
|
||||
|
||||
compile-fail fclose_deleter_compile_fail_adl.cpp
|
||||
: <target-os>windows:<define>_CRT_SECURE_NO_WARNINGS <target-os>windows:<define>_CRT_SECURE_NO_DEPRECATE $(warnings-as-errors-off) ;
|
||||
|
||||
@ -202,7 +217,6 @@ run functor_test.cpp ;
|
||||
compile-fail functor_compile_fail_adl.cpp
|
||||
: $(warnings-as-errors-off) ;
|
||||
|
||||
|
||||
run pointer_traits_pointer_test.cpp ;
|
||||
run pointer_traits_element_type_test.cpp ;
|
||||
run pointer_traits_difference_type_test.cpp ;
|
||||
@ -223,6 +237,8 @@ run empty_value_test.cpp ;
|
||||
run empty_value_size_test.cpp ;
|
||||
run empty_value_final_test.cpp ;
|
||||
run empty_value_constexpr_test.cpp ;
|
||||
compile empty_value_nested_test.cpp ;
|
||||
compile-fail empty_value_compile_fail_casting.cpp ;
|
||||
|
||||
run quick_exit_test.cpp ;
|
||||
run-fail quick_exit_fail.cpp ;
|
||||
@ -334,33 +350,51 @@ run type_name_test.cpp ;
|
||||
|
||||
run snprintf_test.cpp ;
|
||||
|
||||
run sv_types_test.cpp ;
|
||||
run sv_construct_test.cpp ;
|
||||
run sv_iteration_test.cpp ;
|
||||
run sv_element_access_test.cpp ;
|
||||
run sv_modifiers_test.cpp ;
|
||||
run sv_copy_test.cpp ;
|
||||
run sv_substr_test.cpp ;
|
||||
run sv_compare_test.cpp ;
|
||||
run sv_starts_with_test.cpp ;
|
||||
run sv_ends_with_test.cpp ;
|
||||
run sv_find_test.cpp ;
|
||||
run sv_rfind_test.cpp ;
|
||||
run sv_types_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_construct_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_iteration_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_element_access_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_modifiers_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_copy_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_substr_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_compare_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_starts_with_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_ends_with_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_find_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_rfind_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_find_first_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_find_last_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_find_first_not_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_find_last_not_of_test.cpp
|
||||
: : : <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_contains_test.cpp ;
|
||||
run sv_eq_test.cpp ;
|
||||
run sv_lt_test.cpp ;
|
||||
run sv_stream_insert_test.cpp ;
|
||||
run sv_conversion_test.cpp ;
|
||||
run sv_conversion_test2.cpp : ;
|
||||
run sv_common_reference_test.cpp ;
|
||||
: : : $(pedantic-errors) <toolset>gcc-4.4:<cxxflags>-Wno-type-limits ;
|
||||
run sv_contains_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_eq_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_lt_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_stream_insert_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_conversion_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
run sv_conversion_test2.cpp : : : <library>/boost/utility//boost_utility ;
|
||||
run sv_common_reference_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
compile sv_common_reference_test2.cpp ;
|
||||
compile sv_windows_h_test.cpp ;
|
||||
compile-fail sv_nullptr_fail.cpp
|
||||
@ -369,10 +403,13 @@ compile-fail sv_nullptr_fail.cpp
|
||||
compile sv_construct_test_cx.cpp ;
|
||||
compile sv_construct_test_cx2.cpp ;
|
||||
|
||||
run sv_hash_test.cpp : : : $(CPP11) <library>/boost/container_hash//boost_container_hash ;
|
||||
|
||||
run span_test.cpp ;
|
||||
run span_types_test.cpp ;
|
||||
run span_constructible_test.cpp ;
|
||||
run span_deduction_guide_test.cpp ;
|
||||
run span_constexpr_test.cpp ;
|
||||
run as_bytes_test.cpp ;
|
||||
run as_writable_bytes_test.cpp ;
|
||||
compile span_boost_begin_test.cpp ;
|
||||
@ -396,11 +433,15 @@ run memory_resource_test.cpp ;
|
||||
run data_test.cpp ;
|
||||
run size_test.cpp ;
|
||||
|
||||
import ../../config/checks/config : requires ;
|
||||
|
||||
local CPP11 = [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_constexpr cxx11_noexcept ] ;
|
||||
|
||||
local with-serialization = <library>/boost//serialization/<warnings>off $(warnings-as-errors-off) <undefined-sanitizer>norecover:<link>static $(CPP11) ;
|
||||
local with-serialization =
|
||||
<library>/boost/serialization//boost_serialization/<warnings>off
|
||||
$(warnings-as-errors-off)
|
||||
<undefined-sanitizer>norecover:<link>static
|
||||
$(CPP11)
|
||||
# Serialization no longer builds under classic MinGW
|
||||
# and <toolset>gcc,<target-os>windows,<address-model>32 fails for some reason
|
||||
<toolset>gcc,<target-os>windows:<build>no
|
||||
;
|
||||
|
||||
run serialization_nvp_test.cpp : : : $(with-serialization) <undefined-sanitizer>norecover:<build>no ;
|
||||
run serialization_split_free_test.cpp : : : $(with-serialization) ;
|
||||
@ -419,5 +460,8 @@ run yield_prim_pthread_cancel_test.cpp : ;
|
||||
run pointer_in_range_test.cpp ;
|
||||
compile pointer_in_range_constexpr_test.cpp ;
|
||||
|
||||
run minstd_rand_test.cpp
|
||||
: : : $(pedantic-errors) ;
|
||||
|
||||
use-project /boost/core/swap : ./swap ;
|
||||
build-project ./swap ;
|
||||
|
@ -19,14 +19,15 @@ template<class T> void test_bit_ceil( T x )
|
||||
|
||||
T y = boost::core::bit_ceil( x );
|
||||
|
||||
BOOST_TEST( boost::core::has_single_bit( y ) );
|
||||
BOOST_TEST_GE( +y, +x );
|
||||
|
||||
if( x == 0 )
|
||||
{
|
||||
BOOST_TEST_EQ( y, 0 );
|
||||
BOOST_TEST_EQ( y, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_TEST( boost::core::has_single_bit( y ) );
|
||||
BOOST_TEST_GE( +y, +x );
|
||||
BOOST_TEST_LT( y >> 1, +x );
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,4 @@ target_link_libraries(quick Boost::core)
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
@ -18,4 +18,4 @@ target_link_libraries(quick Boost::core)
|
||||
enable_testing()
|
||||
add_test(quick quick)
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||
|
@ -31,7 +31,7 @@ using std::distance;
|
||||
|
||||
*/
|
||||
|
||||
// struct C {} doesn't wotk with libc++.
|
||||
// struct C {} doesn't work with libc++.
|
||||
typedef std::forward_iterator_tag C;
|
||||
|
||||
struct T
|
||||
|
20
test/empty_value_compile_fail_casting.cpp
Normal file
20
test/empty_value_compile_fail_casting.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2024 Braden Ganetsky
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/empty_value.hpp>
|
||||
|
||||
struct empty {};
|
||||
|
||||
// This test ensures private inheritance of `boost::empty_value<T>` for empty `T`.
|
||||
// With public inheritance, `boost::empty_value<empty>*` could cast to `empty*`.
|
||||
void test_empty_not_convertible_to_base()
|
||||
{
|
||||
const boost::empty_value<empty> x(boost::empty_init);
|
||||
const empty* x2 = static_cast<const empty*>(&x);
|
||||
(void)x2;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
45
test/empty_value_nested_test.cpp
Normal file
45
test/empty_value_nested_test.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright 2024 Braden Ganetsky
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#include <boost/core/empty_value.hpp>
|
||||
|
||||
/*
|
||||
Tests workaround for MSVC bug:
|
||||
https://developercommunity.visualstudio.com/t/Compiler-bug:-Incorrect-C2247-and-C2248/10690025
|
||||
*/
|
||||
template<class T>
|
||||
struct derived
|
||||
: boost::empty_value<T> {
|
||||
typedef typename boost::empty_value<T>::type type;
|
||||
derived(boost::empty_init_t e)
|
||||
: boost::empty_value<T>(e) { }
|
||||
};
|
||||
|
||||
struct outer {
|
||||
struct inner_empty { };
|
||||
struct inner_non_empty {
|
||||
inner_non_empty()
|
||||
: value() { }
|
||||
int value;
|
||||
};
|
||||
};
|
||||
|
||||
void test()
|
||||
{
|
||||
const boost::empty_value<outer> x1(boost::empty_init);
|
||||
(void)x1;
|
||||
const boost::empty_value<outer::inner_empty> x2(boost::empty_init);
|
||||
(void)x2;
|
||||
const boost::empty_value<outer::inner_non_empty> x3(boost::empty_init);
|
||||
(void)x3;
|
||||
const derived<outer> x4(boost::empty_init);
|
||||
(void)x4;
|
||||
const derived<outer::inner_empty> x5(boost::empty_init);
|
||||
(void)x5;
|
||||
const derived<outer::inner_non_empty> x6(boost::empty_init);
|
||||
(void)x6;
|
||||
}
|
38
test/minstd_rand_test.cpp
Normal file
38
test/minstd_rand_test.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Test for boost/core/detail/minstd_rand.hpp
|
||||
//
|
||||
// Copyright 2022, 2024 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/detail/minstd_rand.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::detail::minstd_rand rng;
|
||||
|
||||
boost::uint_least32_t r1 = rng(), x1 = 48271;
|
||||
BOOST_TEST_EQ( r1, x1 );
|
||||
|
||||
for( int i = 0; i < 1000; ++i ) rng();
|
||||
|
||||
boost::uint_least32_t r2 = rng(), x2 = 2076422031;
|
||||
BOOST_TEST_EQ( r2, x2 );
|
||||
}
|
||||
|
||||
{
|
||||
boost::detail::minstd_rand rng( 12345 );
|
||||
|
||||
boost::uint_least32_t r1 = rng(), x1 = 595905495;
|
||||
BOOST_TEST_EQ( r1, x1 );
|
||||
|
||||
for( int i = 0; i < 1000; ++i ) rng();
|
||||
|
||||
boost::uint_least32_t r2 = rng(), x2 = 1065162103;
|
||||
BOOST_TEST_EQ( r2, x2 );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
72
test/span_constexpr_test.cpp
Normal file
72
test/span_constexpr_test.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright 2025 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#include <boost/config.hpp>
|
||||
#if !defined(BOOST_NO_CXX11_CONSTEXPR)
|
||||
#include <boost/core/span.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
constexpr const int array[4]{ 5, 10, 15, 20 };
|
||||
|
||||
void test_first()
|
||||
{
|
||||
constexpr boost::span<const int> s =
|
||||
boost::span<const int>(array, 4).first(2);
|
||||
BOOST_TEST_EQ(s.data(), &array[0]);
|
||||
BOOST_TEST_EQ(s.size(), 2);
|
||||
}
|
||||
|
||||
void test_last()
|
||||
{
|
||||
constexpr boost::span<const int> s =
|
||||
boost::span<const int>(array, 4).last(2);
|
||||
BOOST_TEST_EQ(s.data(), &array[2]);
|
||||
BOOST_TEST_EQ(s.size(), 2);
|
||||
}
|
||||
|
||||
void test_subspan()
|
||||
{
|
||||
constexpr boost::span<const int> s =
|
||||
boost::span<const int>(array, 4).subspan(1, 2);
|
||||
BOOST_TEST_EQ(s.data(), &array[1]);
|
||||
BOOST_TEST_EQ(s.size(), 2);
|
||||
}
|
||||
|
||||
void test_index()
|
||||
{
|
||||
constexpr const int i = boost::span<const int>(array, 4)[1];
|
||||
BOOST_TEST_EQ(i, 10);
|
||||
}
|
||||
|
||||
void test_front()
|
||||
{
|
||||
constexpr const int i = boost::span<const int>(array, 4).front();
|
||||
BOOST_TEST_EQ(i, 5);
|
||||
}
|
||||
|
||||
void test_back()
|
||||
{
|
||||
constexpr const int i = boost::span<const int>(array, 4).back();
|
||||
BOOST_TEST_EQ(i, 20);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_first();
|
||||
test_last();
|
||||
test_subspan();
|
||||
test_index();
|
||||
test_front();
|
||||
test_back();
|
||||
return boost::report_errors();
|
||||
}
|
||||
#else
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
@ -494,7 +494,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
@ -503,22 +503,22 @@ int main()
|
||||
|
||||
std::string str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i );
|
||||
}
|
||||
@ -538,22 +538,22 @@ int main()
|
||||
|
||||
std::wstring str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i );
|
||||
}
|
||||
|
@ -426,14 +426,14 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_first_of( needle ), i );
|
||||
}
|
||||
|
||||
@ -441,7 +441,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_first_of( needle ), 255 - i );
|
||||
}
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
@ -503,22 +503,22 @@ int main()
|
||||
|
||||
std::string str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_last_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<char>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_last_not_of( str3 ), 255 - i );
|
||||
}
|
||||
@ -538,22 +538,22 @@ int main()
|
||||
|
||||
std::wstring str2( sv.data(), sv.size() );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), i );
|
||||
}
|
||||
|
||||
std::reverse( str, str + 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
for( std::size_t i = 0; i < 256; ++i )
|
||||
{
|
||||
std::wstring str3( str2 );
|
||||
|
||||
str3[ i ] = ~str3[ i ];
|
||||
str3[ i ] = static_cast<wchar_t>( ~str3[ i ] );
|
||||
|
||||
BOOST_TEST_EQ( sv.find_first_not_of( str3 ), 255 - i );
|
||||
}
|
||||
|
@ -444,14 +444,14 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
str[ i ] = static_cast< unsigned char >( i );
|
||||
str[ i ] = static_cast<char>( static_cast< unsigned char >( i ) );
|
||||
}
|
||||
|
||||
boost::core::string_view sv( str, 256 );
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_last_of( needle ), i );
|
||||
}
|
||||
|
||||
@ -459,7 +459,7 @@ int main()
|
||||
|
||||
for( int i = 0; i < 256; ++i )
|
||||
{
|
||||
std::string needle( 12, static_cast< unsigned char >( i ) );
|
||||
std::string needle( 12, static_cast<char>( static_cast< unsigned char >( i ) ) );
|
||||
BOOST_TEST_EQ( sv.find_last_of( needle ), 255 - i );
|
||||
}
|
||||
}
|
||||
|
48
test/sv_hash_test.cpp
Normal file
48
test/sv_hash_test.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
// Copyright 2021-2024 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <string>
|
||||
|
||||
template<class T> std::size_t hv( T const& t )
|
||||
{
|
||||
return boost::hash<T>()( t );
|
||||
}
|
||||
|
||||
template<class Ch> void test( Ch const* p )
|
||||
{
|
||||
std::basic_string<Ch> s( p );
|
||||
boost::core::basic_string_view<Ch> sv( s );
|
||||
|
||||
BOOST_TEST_EQ( hv( s ), hv( sv ) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test( "123" );
|
||||
test( L"123" );
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR16_T)
|
||||
|
||||
test( u"123" );
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CHAR32_T)
|
||||
|
||||
test( U"123" );
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L
|
||||
|
||||
test( u8"123" );
|
||||
|
||||
#endif
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
// objects to be swapped would themselves be from the boost namespace.
|
||||
// If so, boost::core::invoke_swap itself might be found by argument dependent lookup.
|
||||
// The implementation of boost::core::invoke_swap resolves this issue by giving
|
||||
// boost::core::invoke_swap two template argumetns, thereby making it less specialized
|
||||
// boost::core::invoke_swap two template arguments, thereby making it less specialized
|
||||
// than std::swap.
|
||||
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
|
@ -12,7 +12,7 @@
|
||||
//Put test class in the global namespace
|
||||
#include "./swap_test_class.hpp"
|
||||
|
||||
//Provide swap function in gloabl namespace
|
||||
//Provide swap function in global namespace
|
||||
void swap(swap_test_class& left, swap_test_class& right)
|
||||
{
|
||||
left.swap(right);
|
||||
|
@ -55,6 +55,13 @@ template<class T1, class T2> struct X
|
||||
|
||||
template<class T1, class T2> struct Y;
|
||||
|
||||
class W
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void f() = 0;
|
||||
};
|
||||
|
||||
enum E1
|
||||
{
|
||||
e1
|
||||
@ -122,6 +129,7 @@ int main()
|
||||
TEST(A);
|
||||
TEST(B);
|
||||
TEST(C);
|
||||
TEST(W);
|
||||
|
||||
TEST(E1);
|
||||
|
||||
@ -143,6 +151,9 @@ int main()
|
||||
TEST(C&);
|
||||
TEST(C const&);
|
||||
|
||||
TEST(W const);
|
||||
TEST(W&);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
TEST(B&&);
|
||||
@ -156,6 +167,8 @@ int main()
|
||||
TEST(C*);
|
||||
TEST(C const* volatile*);
|
||||
|
||||
TEST(W volatile*);
|
||||
|
||||
TEST(void*);
|
||||
TEST(void const* volatile*);
|
||||
|
||||
@ -307,6 +320,8 @@ int main()
|
||||
|
||||
TEST(std::pair<C, C>);
|
||||
|
||||
TEST(std::pair<W, W>);
|
||||
|
||||
TEST(std::pair<void, void>);
|
||||
TEST(std::pair<std::pair<void, void>, void>);
|
||||
|
||||
@ -336,9 +351,11 @@ int main()
|
||||
TEST(X<A const&, B&> volatile&);
|
||||
|
||||
TEST(X<C, C>);
|
||||
TEST(X<W, W>);
|
||||
|
||||
TEST(Y<A, B>);
|
||||
TEST(Y<C, C>);
|
||||
TEST(Y<W, W>);
|
||||
|
||||
TEST(X<std::pair<void, void>, void>);
|
||||
|
||||
|
Reference in New Issue
Block a user