Compare commits

...

57 Commits

Author SHA1 Message Date
Peter Dimov
4959611e09 Avoid msvc-14.0 constexpr errors in enum_to_string 2025-12-15 19:39:46 +02:00
Peter Dimov
a722380b2a Update revision history 2025-12-15 13:16:33 +02:00
Peter Dimov
dfd9182bf3 Replace the lambda in enum_to_string with a struct to enable C++14 constexpr. Refs #60. Refs #61. 2025-12-15 12:37:40 +02:00
Peter Dimov
f1774f3d02 Make enum_to_string constexpr; add enum_to_string_test_cx.cpp. Refs #60. Refs #61. 2025-12-15 12:28:44 +02:00
Peter Dimov
7c0d234267 Update ci.yml 2025-12-11 15:49:41 +02:00
Peter Dimov
6e4b7f5a07 Update .drone.jsonnet 2025-11-14 23:19:03 +02:00
Peter Dimov
0a40d3b824 Move C++20 detection to detail/config.hpp; disable C++20 use for Clang < 13. 2025-11-14 23:10:11 +02:00
Peter Dimov
644a984a61 Avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122688 2025-11-14 23:10:11 +02:00
Peter Dimov
43ee545507 Move enum descriptors computation into decltype under C++20. Fixes #58. 2025-11-14 23:10:11 +02:00
Peter Dimov
54b73c7ca7 Add test for describe_enumerators on a nested enum before the enclosing class is complete. Refs #58. 2025-11-14 23:10:11 +02:00
Peter Dimov
ee215421cb Update appveyor.yml 2025-11-14 14:32:49 +02:00
Peter Dimov
2864875eef Disable C4996 from JSON on msvc-14.0 2025-10-22 16:03:41 +03:00
Peter Dimov
1a63fc6ffb Update cmake_subdir_test/CMakeLists.txt to reflect Core changes 2025-10-22 11:24:17 +03:00
Peter Dimov
373db78411 Make mod_any_access an inline variable, because of modules. Closes #57. 2025-10-22 11:00:36 +03:00
Peter Dimov
5858ccb775 Merge pull request #56 from sigbjorn/feature/extend-pp-for-each-limit
Extended limit for describe/detail/pp_for_each.hpp from 52 to 64
2025-08-17 10:18:55 +03:00
Peter Dimov
ba01c60d56 Update .drone.jsonnet 2025-08-17 01:16:13 +03:00
Peter Dimov
ecd2b0456b Remove windows-2019 from GHA 2025-08-16 21:35:16 +03:00
sigbjorn
362a266b7d Extended limit for describe/detail/pp_for_each.hpp from 52 to 64 including test, #55 2025-08-08 10:52:00 +02:00
Peter Dimov
b64177c39f Update ci.yml 2025-05-25 17:11:44 +03:00
Peter Dimov
ddff876eea Update .drone.jsonnet 2024-12-13 13:47:35 +02:00
Peter Dimov
112c33a793 Apply Node20 workaround 2024-12-13 13:46:26 +02:00
Peter Dimov
22f497d1ad Update ci.yml 2024-12-13 13:45:37 +02:00
Peter Dimov
3da6a1e295 Update ci.yml 2024-10-14 02:06:21 +03:00
Peter Dimov
ff76bbb90b Merge pull request #47 from qchateau/develop
Support parameter packs for bases in BOOST_DESCRIBE_CLASS
2024-10-14 01:51:27 +03:00
Peter Dimov
18e7c01359 Update JSON examples for JSON 1.81+ 2024-09-09 20:23:58 +03:00
Peter Dimov
777bdec2e9 Update examples.adoc for JSON 1.81+ 2024-09-09 20:21:03 +03:00
Peter Dimov
f39d32150d Use link=static for JSON, Serialization under UBSan 2024-08-22 01:53:28 +03:00
Peter Dimov
f8f7af29d5 Update .drone.jsonnet 2024-08-21 21:51:41 +03:00
Peter Dimov
89b5caef8d Add VERBATIM to add_custom_target 2024-08-21 21:49:52 +03:00
Peter Dimov
2fb95498ea Update build.jam, test/Jamfile 2024-08-21 20:59:01 +03:00
Peter Dimov
8a0ade0ad0 Merge branch 'modular' of https://github.com/grafikrobot/boostorg.describe into feature/modular-b2 2024-08-21 20:54:19 +03:00
Peter Dimov
1508f66184 Update .drone.jsonnet 2024-08-21 19:01:46 +03:00
Peter Dimov
ac298922b0 Update ci.yml 2024-08-21 18:18:20 +03:00
Rene Rivera
86099f1d78 Move inter-lib dependencies to a project variable and into the build targets. 2024-07-23 22:34:24 -05:00
Rene Rivera
d25e48348e Update copyright dates. 2024-07-20 22:52:05 -05:00
Rene Rivera
76c036a2d7 Change all <source> references to <library>. 2024-07-20 19:38:12 -05:00
Rene Rivera
879d4b2a22 Bump B2 require to 5.2 2024-06-14 11:33:55 -05:00
Rene Rivera
202203112b Add requires-b2 check to top-level build file. 2024-05-05 09:00:01 -05:00
Rene Rivera
882b168de8 Sync from upstream. 2024-04-20 15:34:25 -05:00
Peter Dimov
1ddee6c39a Revert "Update doc/Jamfile"
This reverts commit 9899acb4c9.
2024-04-16 22:36:26 +03:00
Peter Dimov
9899acb4c9 Update doc/Jamfile 2024-04-16 22:17:19 +03:00
Rene Rivera
84ce044885 Switch to library requirements instead of source. As source puts extra source in install targets. 2024-03-29 21:15:58 -05:00
Rene Rivera
120b9edaed Sync from upstream. 2024-03-23 16:03:15 -05:00
Peter Dimov
50719b2123 Update .drone.jsonnet 2024-03-23 20:27:08 +02:00
Peter Dimov
8f3b04a3d9 Disable warnings-as-errors=on in serialization.cpp for MSVC as well 2024-03-23 20:22:22 +02:00
Quentin Chateau
2e63564776 Support parameter packs for bases in BOOST_DESCRIBE_CLASS 2024-03-22 22:47:46 +01:00
Rene Rivera
9da33c4629 Make the library modular usable. 2024-03-11 08:32:57 -05:00
Peter Dimov
fad199e782 Merge pull request #44 from denzor200/actualize_fmt
Actualize examples to build with latest `fmt`
2023-12-13 17:29:06 +02:00
Peter Dimov
e005f6950c Update ci.yml 2023-12-13 17:12:12 +02:00
Denis Mikhailov
2e5dcc80b2 Update fmtlib_enum_formatter.cpp 2023-11-25 22:22:10 +01:00
Denis Mikhailov
ba1459ac84 Update fmtlib_class_formatter.cpp 2023-11-25 22:21:33 +01:00
Peter Dimov
c89e4dd3db Update json_rpc example to work on both versions of Boost.JSON 2023-09-26 00:53:40 +03:00
Peter Dimov
3047e5a72f Document the new overload of enum_from_string 2023-09-09 19:07:05 +03:00
Peter Dimov
cfddb57d3a Add an overload of enum_from_string that takes a string-like type (such as string_view). Fixes #41. 2023-09-09 18:52:41 +03:00
Peter Dimov
6e7d49c6e1 Do not use -Werror with Serialization under GCC 2023-09-09 17:57:18 +03:00
Peter Dimov
cc2281054e {"world"} is now string in Boost.JSON, not array 2023-09-09 17:23:26 +03:00
Peter Dimov
215042b480 Update ci.yml 2023-09-09 17:03:54 +03:00
28 changed files with 653 additions and 110 deletions

View File

@@ -32,7 +32,8 @@ local linux_pipeline(name, image, environment, packages = "", sources = [], arch
commands:
[
'set -e',
'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -',
'uname -a',
'echo $DRONE_STAGE_MACHINE',
] +
(if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) +
(if packages != "" then [ 'apt-get update', 'apt-get -y install ' + packages ] else []) +
@@ -186,6 +187,34 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
"g++-12",
),
linux_pipeline(
"Linux 24.04 GCC 13",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-13', CXXSTD: '03,11,14,17,20,2b' },
"g++-13",
),
linux_pipeline(
"Linux 24.04 GCC 14 UBSAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
"g++-14",
),
linux_pipeline(
"Linux 24.04 GCC 14 ASAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-14', CXXSTD: '03,11,14,17,20,2b' } + asan,
"g++-14",
),
linux_pipeline(
"Linux 25.04 GCC 15",
"cppalliance/droneubuntu2504:1",
{ TOOLSET: 'gcc', COMPILER: 'g++-15', CXXSTD: '03,11,14,17,20,23,2c' },
"g++-15",
),
linux_pipeline(
"Linux 16.04 Clang 3.5",
"cppalliance/droneubuntu1604:1",
@@ -231,7 +260,7 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
linux_pipeline(
"Linux 18.04 Clang 5.0",
"cppalliance/droneubuntu1804:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-5.0', CXXSTD: '03,11,14,1z' },
{ TOOLSET: 'clang', COMPILER: 'clang++-5.0', CXXSTD: '03,11,14' },
"clang-5.0",
),
@@ -303,18 +332,107 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
"cppalliance/droneubuntu2204:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-15', CXXSTD: '03,11,14,17,20,2b' },
"clang-15",
["deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main"],
),
linux_pipeline(
"Linux 24.04 Clang 16",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-16', CXXSTD: '03,11,14,17,20,2b' },
"clang-16",
),
linux_pipeline(
"Linux 24.04 Clang 17",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-17', CXXSTD: '03,11,14,17,20,2b' },
"clang-17",
),
linux_pipeline(
"Linux 24.04 Clang 18 UBSAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
"clang-18",
),
linux_pipeline(
"Linux 24.04 Clang 18 ASAN",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-18', CXXSTD: '03,11,14,17,20,2b' } + asan,
"clang-18",
),
linux_pipeline(
"Linux 24.04 Clang 19",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-19', CXXSTD: '03,11,14,17,20,2b' },
"clang-19",
),
linux_pipeline(
"Linux 24.04 Clang 20",
"cppalliance/droneubuntu2404:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-20', CXXSTD: '03,11,14,17,20,23,2c' },
"clang-20",
),
linux_pipeline(
"Linux 25.10 Clang 21",
"cppalliance/droneubuntu2510:1",
{ TOOLSET: 'clang', COMPILER: 'clang++-21', CXXSTD: '03,11,14,17,20,23,2c' },
"clang-21",
),
macos_pipeline(
"MacOS 10.15 Xcode 12.2",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,1z' },
"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.2.1 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
xcode_version = "13.2.1", osx_version = "monterey", arch = "arm64",
),
macos_pipeline(
"MacOS 12.4 Xcode 13.2.1 ASAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + asan,
xcode_version = "13.2.1", osx_version = "monterey", arch = "arm64",
),
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",
),
macos_pipeline(
"MacOS 14 Xcode 16.2.0 UBSAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + ubsan,
xcode_version = "16.2.0", osx_version = "sonoma", arch = "arm64",
),
macos_pipeline(
"MacOS 14 Xcode 16.2.0 ASAN",
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,17,20,2b' } + asan,
xcode_version = "16.2.0", osx_version = "sonoma", arch = "arm64",
),
windows_pipeline(
"Windows VS2015 msvc-14.0",
"cppalliance/dronevs2015",
{ TOOLSET: 'msvc-14.0', CXXSTD: '14,latest' },
{ TOOLSET: 'msvc-14.0', CXXSTD: '14,latest', B2_DONT_EMBED_MANIFEST: '1' },
),
windows_pipeline(

View File

@@ -5,6 +5,7 @@
# https://www.boost.org/LICENSE_1_0.txt
set -ex
export PATH=~/.local/bin:/usr/local/bin:$PATH
DRONE_BUILD_DIR=$(pwd)

View File

@@ -19,30 +19,33 @@ jobs:
include:
- toolset: gcc-4.8
cxxstd: "03,11"
os: ubuntu-latest
container: ubuntu:18.04
os: ubuntu-latest
install: g++-4.8
- toolset: gcc-5
cxxstd: "03,11,14,14-gnu,1z,1z-gnu"
os: ubuntu-latest
container: ubuntu:18.04
os: ubuntu-latest
install: g++-5
- toolset: gcc-6
cxxstd: "03,11,14,14-gnu,1z,1z-gnu"
os: ubuntu-latest
container: ubuntu:18.04
os: ubuntu-latest
install: g++-6
- toolset: gcc-7
cxxstd: "03,11,14,14-gnu,17,17-gnu"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
install: g++-7
- toolset: gcc-8
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
install: g++-8
- toolset: gcc-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
- toolset: gcc-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-22.04
@@ -54,100 +57,178 @@ jobs:
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04
install: g++-12
- toolset: gcc-13
cxxstd: "03,11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: g++-13
- toolset: gcc-14
cxxstd: "03,11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: g++-14
- toolset: gcc-15
cxxstd: "03,11,14,17,20,23,2c"
container: ubuntu:25.10
os: ubuntu-latest
install: g++-15
- toolset: clang
compiler: clang++-3.9
cxxstd: "03,11,14"
os: ubuntu-latest
container: ubuntu:18.04
os: ubuntu-latest
install: clang-3.9
- toolset: clang
compiler: clang++-4.0
cxxstd: "03,11,14"
os: ubuntu-latest
container: ubuntu:18.04
os: ubuntu-latest
install: clang-4.0
- toolset: clang
compiler: clang++-5.0
cxxstd: "03,11,14,1z"
os: ubuntu-latest
cxxstd: "03,11,14"
container: ubuntu:18.04
os: ubuntu-latest
install: clang-5.0
- toolset: clang
compiler: clang++-6.0
cxxstd: "03,11,14,17"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
install: clang-6.0
- toolset: clang
compiler: clang++-7
cxxstd: "03,11,14,17"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
install: clang-7
- toolset: clang
compiler: clang++-8
cxxstd: "03,11,14,17"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
install: clang-8
- toolset: clang
compiler: clang++-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
install: clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
install: clang-10
- toolset: clang
compiler: clang++-11
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
install: clang-11
- toolset: clang
compiler: clang++-12
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
container: ubuntu:20.04
os: ubuntu-latest
install: clang-12
- toolset: clang
compiler: clang++-13
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04
container: ubuntu:22.04
os: ubuntu-latest
install: clang-13
- toolset: clang
compiler: clang++-14
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04
container: ubuntu:22.04
os: ubuntu-latest
install: clang-14
- toolset: clang
compiler: clang++-15
cxxstd: "03,11,14,17,20,2b"
os: ubuntu-22.04
container: ubuntu:22.04
os: ubuntu-latest
install: clang-15
- toolset: clang
cxxstd: "03,11,14,17,2a"
os: macos-11
compiler: clang++-16
cxxstd: "03,11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: clang-16
- toolset: clang
compiler: clang++-17
cxxstd: "03,11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: clang-17
- toolset: clang
compiler: clang++-18
cxxstd: "03,11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: clang-18
- toolset: clang
compiler: clang++-19
cxxstd: "03,11,14,17,20,2b"
container: ubuntu:24.04
os: ubuntu-latest
install: clang-19
- toolset: clang
compiler: clang++-20
cxxstd: "03,11,14,17,20,23,2c"
container: ubuntu:24.04
os: ubuntu-latest
install: clang-20
- toolset: clang
compiler: clang++-21
cxxstd: "03,11,14,17,20,23,2c"
container: ubuntu:25.10
os: ubuntu-latest
install: clang-21
- toolset: clang
cxxstd: "03,11,14,17,20,2b"
os: macos-12
os: macos-14
- toolset: clang
cxxstd: "03,11,14,17,20,2b"
os: macos-15
- toolset: clang
cxxstd: "03,11,14,17,20,23,2c"
os: macos-26
runs-on: ${{matrix.os}}
container: ${{matrix.container}}
container:
image: ${{matrix.container}}
volumes:
- /node20217:/node20217:rw,rshared
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Setup container environment
if: matrix.container
run: |
apt-get update
apt-get -y install sudo python git g++
apt-get -y install sudo python3 git g++ curl xz-utils
- name: Install nodejs20glibc2.17
if: ${{ startsWith( matrix.container, 'ubuntu:1' ) }}
run: |
curl -LO https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
ldd /__e/node20/bin/node
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
run: sudo apt-get -y install ${{matrix.install}}
run: |
sudo apt-get update
sudo apt-get -y install ${{matrix.install}}
- name: Setup Boost
run: |
@@ -168,7 +249,7 @@ jobs:
mkdir -p libs/$LIBRARY
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" -I example $LIBRARY
python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" -I example $LIBRARY
./bootstrap.sh
./b2 -d0 headers
@@ -187,19 +268,6 @@ jobs:
fail-fast: false
matrix:
include:
- toolset: msvc-14.0
cxxstd: "14,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.2
cxxstd: "14,17,20,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.2
cxxstd: "14,17,20,latest"
addrmd: 32,64
cxxflags: "-Zc:preprocessor"
os: windows-2019
- toolset: msvc-14.3
cxxstd: "14,17,20,latest"
addrmd: 32,64
@@ -216,12 +284,12 @@ jobs:
- toolset: gcc
cxxstd: "03,11,14,17,2a"
addrmd: 64
os: windows-2019
os: windows-2022
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
@@ -257,15 +325,16 @@ 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-14
- os: macos-15
- os: macos-26
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
@@ -304,15 +373,16 @@ 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-14
- os: macos-15
- os: macos-26
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
@@ -361,15 +431,16 @@ 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-14
- os: macos-15
- os: macos-26
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install packages
if: matrix.install
@@ -416,13 +487,12 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
- os: windows-latest
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
@@ -465,13 +535,12 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
- os: windows-latest
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd
@@ -532,13 +601,12 @@ jobs:
fail-fast: false
matrix:
include:
- os: windows-2019
- os: windows-2022
- os: windows-latest
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Boost
shell: cmd

View File

@@ -24,9 +24,13 @@ environment:
TOOLSET: msvc-14.1
CXXSTD: 14,17,latest
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
TOOLSET: msvc-14.2
CXXSTD: 14,17,20,latest
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
TOOLSET: clang-win
CXXSTD: 14,17,latest
CXXSTD: 14,17,20,latest
ADDRMD: 32,64
install:

20
build.jam Normal file
View File

@@ -0,0 +1,20 @@
# 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/mp11//boost_mp11
;
project /boost/describe ;
explicit
[ alias boost_describe : : : : <include>include <library>$(boost_dependencies) ]
[ alias all : boost_describe test ]
;
call-if : boost-library describe
;

View File

@@ -8,6 +8,16 @@ https://www.boost.org/LICENSE_1_0.txt
# Revision History
:idprefix:
## Changes in Boost 1.91.0
* Under {cpp}20, described nested enums now work when the enclosing class is still incomplete. (Thanks to Julien Blanc.)
* Made `enum_to_string` constexpr. (Thanks to Julien Blanc.)
## Changes in Boost 1.84.0
* Added an overload of `enum_from_string` that takes a string view, to avoid
the need for null termination.
## Changes in Boost 1.81.0
* To allow the inclusion of `enumerators.hpp`, `bases.hpp`, and `members.hpp`

View File

@@ -263,6 +263,11 @@ The presence of private members is taken as an indication that
a universal conversion is not suitable, so the overload is
disabled in this case using `std::enable_if_t`.
NOTE: Since release 1.81.0, Boost.JSON provides its
own, built-in, support for described classes. Consequently,
when using Boost 1.81.0 or later, you don't need the below
`tag_invoke` function.
[source]
----
include::../../example/to_json.cpp[lines=5..-1]
@@ -282,6 +287,11 @@ Like the previous example, but in the other direction. Defines
a `tag_invoke` overload that converts a `boost::json::value` to
an annotated struct.
NOTE: Since release 1.81.0, Boost.JSON provides its
own, built-in, support for described classes. Consequently,
when using Boost 1.81.0 or later, you don't need the below
`tag_invoke` function.
[source]
----
include::../../example/from_json.cpp[lines=5..-1]

View File

@@ -362,6 +362,7 @@ namespace boost {
namespace describe {
template<class E> bool enum_from_string( char const * name, E & e ) noexcept;
template<class S, class E> bool enum_from_string( S const & name, E & e ) noexcept;
} }
```
@@ -372,6 +373,11 @@ The function `enum_from_string` assigns to `e` the enumerator value correspondin
to `name` and returns `true`. `E` must be a described enumeration type. If `name`
does not correspond to one of the described values, the function returns `false`.
The second overload only participates in overload resolution when `S` is a
string-like type such as `std::string` or `std::string_view`. String-like types
are recognized by the presence of nested `value_type` and `traits_type` typedefs
and are expected to have a non-throwing `operator==` taking `char const*`.
## <boost/describe/operators.hpp>
```

View File

@@ -18,7 +18,7 @@ template<class T> struct fmt::formatter<T, char, std::enable_if_t<
if( it != end && *it != '}' )
{
ctx.error_handler().on_error( "invalid format" );
throw_format_error( "invalid format" );
}
return it;

View File

@@ -25,7 +25,7 @@ public:
if( i1 != i2 )
{
ctx.error_handler().on_error( "invalid format" );
throw_format_error( "invalid format" );
}
return i1;

View File

@@ -5,11 +5,14 @@
#include <boost/describe.hpp>
#include <boost/mp11.hpp>
#include <boost/json.hpp>
#include <boost/version.hpp>
#include <type_traits>
namespace app
{
#if BOOST_VERSION < 108100
template<class T> void extract( boost::json::object const & obj, char const * name, T & value )
{
value = boost::json::value_to<T>( obj.at( name ) );
@@ -36,6 +39,8 @@ template<class T,
return t;
}
#endif
struct A
{
int x;

View File

@@ -34,7 +34,7 @@ template<class C1, class C2, class R, class... A>
template<class C>
boost::json::value
call( C & c, boost::string_view method, boost::json::value const & args )
call( C & c, boost::string_view method, boost::json::array const & args )
{
using Fd = boost::describe::describe_members<C,
boost::describe::mod_public | boost::describe::mod_function>;
@@ -46,7 +46,7 @@ template<class C>
if( !found && method == D.name)
{
result = call_impl( c, D.pointer, args.as_array() );
result = call_impl( c, D.pointer, args );
found = true;
}

View File

@@ -5,6 +5,7 @@
#include <boost/describe.hpp>
#include <boost/mp11.hpp>
#include <boost/json.hpp>
#include <boost/version.hpp>
#include <type_traits>
#include <vector>
#include <map>
@@ -12,6 +13,8 @@
namespace app
{
#if BOOST_VERSION < 108100
template<class T,
class D1 = boost::describe::describe_members<T,
boost::describe::mod_public | boost::describe::mod_protected>,
@@ -29,6 +32,8 @@ template<class T,
});
}
#endif
struct A
{
int x;

View File

@@ -30,24 +30,18 @@ template<class C, class B> struct base_descriptor
template<class C, class B> constexpr unsigned base_descriptor<C, B>::modifiers;
#endif
template<class... T> auto base_descriptor_fn_impl( int, T... )
// bases_descriptor
template<typename ...>
struct bases_descriptor_impl;
template<class C, class ...Bs>
struct bases_descriptor_impl<C, list<Bs...>>
{
return list<T...>();
}
#define BOOST_DESCRIBE_BASE_IMPL(C, B) , boost::describe::detail::base_descriptor<C, B>()
#if defined(_MSC_VER) && !defined(__clang__)
using type = list<base_descriptor<C, Bs>...>;
};
#define BOOST_DESCRIBE_BASES(C, ...) inline auto boost_base_descriptor_fn( C** ) \
{ return boost::describe::detail::base_descriptor_fn_impl( 0 BOOST_DESCRIBE_PP_FOR_EACH(BOOST_DESCRIBE_BASE_IMPL, C, __VA_ARGS__) ); }
#else
#define BOOST_DESCRIBE_BASES(C, ...) inline auto boost_base_descriptor_fn( C** ) \
{ return boost::describe::detail::base_descriptor_fn_impl( 0 BOOST_DESCRIBE_PP_FOR_EACH(BOOST_DESCRIBE_BASE_IMPL, C, ##__VA_ARGS__) ); }
#endif
{ return typename boost::describe::detail::bases_descriptor_impl<C, boost::describe::detail::list<__VA_ARGS__>>::type(); }
} // namespace detail
} // namespace describe

View File

@@ -37,4 +37,28 @@
# define BOOST_DESCRIBE_MAYBE_UNUSED
#endif
#if defined(__cpp_inline_variables) && __cpp_inline_variables >= 201606L
# define BOOST_DESCRIBE_INLINE_VARIABLE inline
#else
# define BOOST_DESCRIBE_INLINE_VARIABLE
#endif
#define BOOST_DESCRIBE_INLINE_CONSTEXPR BOOST_DESCRIBE_INLINE_VARIABLE BOOST_DESCRIBE_CONSTEXPR_OR_CONST
#if __cplusplus >= 202002L || ( defined(_MSVC_LANG) && _MSVC_LANG >= 202002L )
# define BOOST_DESCRIBE_CXX20
// Clang 13.0 is needed for unevaluated lambdas
# if defined(__clang__) && __clang_major__ < 13
# undef BOOST_DESCRIBE_CXX20
# endif
// Apple Clang 13.1 is Clang 13.0
# if defined(__clang__) && defined(__apple_build_version__) && __clang_major__ == 13 && __clang_minor__ < 1
# undef BOOST_DESCRIBE_CXX20
# endif
#endif
#endif // #ifndef BOOST_DESCRIBE_DETAIL_CONFIG_HPP_INCLUDED

View File

@@ -60,11 +60,35 @@
#define BOOST_DESCRIBE_PP_FOR_EACH_50(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_49(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_51(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_50(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_52(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_51(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_53(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_52(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_54(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_53(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_55(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_54(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_56(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_55(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_57(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_56(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_58(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_57(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_59(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_58(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_60(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_59(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_61(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_60(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_62(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_61(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_63(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_62(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FOR_EACH_64(F, a, x, ...) BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_CALL(F, a, x) BOOST_DESCRIBE_PP_FOR_EACH_63(F, a, __VA_ARGS__))
#define BOOST_DESCRIBE_PP_FE_EXTRACT(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, V, ...) V
#define BOOST_DESCRIBE_PP_FE_EXTRACT(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, V, ...) V
#define BOOST_DESCRIBE_PP_FOR_EACH(F, ...) \
BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_EXPAND(BOOST_DESCRIBE_PP_FE_EXTRACT(__VA_ARGS__, \
BOOST_DESCRIBE_PP_FOR_EACH_64, \
BOOST_DESCRIBE_PP_FOR_EACH_63, \
BOOST_DESCRIBE_PP_FOR_EACH_62, \
BOOST_DESCRIBE_PP_FOR_EACH_61, \
BOOST_DESCRIBE_PP_FOR_EACH_60, \
BOOST_DESCRIBE_PP_FOR_EACH_59, \
BOOST_DESCRIBE_PP_FOR_EACH_58, \
BOOST_DESCRIBE_PP_FOR_EACH_57, \
BOOST_DESCRIBE_PP_FOR_EACH_56, \
BOOST_DESCRIBE_PP_FOR_EACH_55, \
BOOST_DESCRIBE_PP_FOR_EACH_54, \
BOOST_DESCRIBE_PP_FOR_EACH_53, \
BOOST_DESCRIBE_PP_FOR_EACH_52, \
BOOST_DESCRIBE_PP_FOR_EACH_51, \
BOOST_DESCRIBE_PP_FOR_EACH_50, \

View File

@@ -43,6 +43,23 @@ template<class... T> auto enum_descriptor_fn_impl( int, T... )
return list<enum_descriptor<T>...>();
}
#if defined(BOOST_DESCRIBE_CXX20)
template<auto V, auto N> struct enum_desc
{
static constexpr auto value() noexcept { return V; }
static constexpr auto name() noexcept { return N(); }
};
#define BOOST_DESCRIBE_ENUM_BEGIN(E) \
inline decltype( boost::describe::detail::enum_descriptor_fn_impl( 0
#define BOOST_DESCRIBE_ENUM_ENTRY(E, e) , boost::describe::detail::enum_desc<E::e, []{ return #e; }>{}
#define BOOST_DESCRIBE_ENUM_END(E) ) ) boost_enum_descriptor_fn( E** ) { return {}; }
#else
#define BOOST_DESCRIBE_ENUM_BEGIN(E) \
inline auto boost_enum_descriptor_fn( E** ) \
{ return boost::describe::detail::enum_descriptor_fn_impl( 0
@@ -53,6 +70,8 @@ template<class... T> auto enum_descriptor_fn_impl( int, T... )
#define BOOST_DESCRIBE_ENUM_END(E) ); }
#endif
} // namespace detail
#if defined(_MSC_VER) && !defined(__clang__)

View File

@@ -12,6 +12,7 @@
#include <boost/describe/enumerators.hpp>
#include <boost/mp11/algorithm.hpp>
#include <cstring>
#include <type_traits>
#if defined(_MSC_VER) && _MSC_VER == 1900
# pragma warning(push)
@@ -41,6 +42,29 @@ bool enum_from_string( char const* name, E& e ) noexcept
return found;
}
template<class S, class E, class De = describe_enumerators<E>,
class En = std::enable_if_t<
std::is_same<typename S::value_type, char>::value &&
std::is_same<typename S::traits_type::char_type, char>::value
>
>
bool enum_from_string( S const& name, E& e ) noexcept
{
bool found = false;
mp11::mp_for_each<De>([&](auto D){
if( !found && name == D.name )
{
found = true;
e = D.value;
}
});
return found;
}
} // namespace describe
} // namespace boost

View File

@@ -1,7 +1,7 @@
#ifndef BOOST_DESCRIBE_ENUM_TO_STRING_HPP_INCLUDED
#define BOOST_DESCRIBE_ENUM_TO_STRING_HPP_INCLUDED
// Copyright 2020, 2021 Peter Dimov
// Copyright 2020, 2021, 2025 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
@@ -22,16 +22,34 @@ namespace boost
namespace describe
{
template<class E, class De = describe_enumerators<E>>
char const * enum_to_string( E e, char const* def ) noexcept
namespace detail
{
char const * r = def;
mp11::mp_for_each<De>([&](auto D){
// [&](auto D){ if( e == D.value ) r = D.name; }
// except constexpr under C++14
if( e == D.value ) r = D.name;
template<class E> struct ets_lambda
{
E e;
char const** pr;
});
template<class D> constexpr void operator()( D d ) const noexcept
{
if( e == d.value ) *pr = d.name;
}
};
} // namespace detail
template<class E, class De = describe_enumerators<E>>
#if !( defined(_MSC_VER) && _MSC_VER == 1900 )
constexpr
#endif
char const* enum_to_string( E e, char const* def ) noexcept
{
char const* r = def;
mp11::mp_for_each<De>( detail::ets_lambda<E>{ e, &r } );
return r;
}

View File

@@ -25,7 +25,7 @@ enum modifiers
mod_hidden = 256
};
BOOST_DESCRIBE_CONSTEXPR_OR_CONST modifiers mod_any_access = static_cast<modifiers>( mod_public | mod_protected | mod_private );
BOOST_DESCRIBE_INLINE_CONSTEXPR modifiers mod_any_access = static_cast<modifiers>( mod_public | mod_protected | mod_private );
} // namespace describe
} // namespace boost

View File

@@ -4,11 +4,16 @@
import testing ;
local WERROR = <toolset>msvc:<warnings-as-errors>on <toolset>clang:<warnings-as-errors>on <toolset>gcc:<warnings-as-errors>on ;
project : requirements
<library>/boost/describe//boost_describe
<library>/boost/container_hash//boost_container_hash
<library>/boost/core//boost_core
<library>/boost/variant2//boost_variant2
<warnings>extra
<toolset>msvc:<warnings-as-errors>on
<toolset>clang:<warnings-as-errors>on
<toolset>gcc:<warnings-as-errors>on
$(WERROR)
<toolset>clang:<cxxflags>"-Wno-unused-private-field" ;
run quick.cpp ;
@@ -78,6 +83,12 @@ run pedantic_bases_test.cpp
run pedantic_members_test.cpp
: : : <warnings>pedantic ;
run enum_from_string_test2.cpp ;
compile nested_enum_test2.cpp ;
compile enum_to_string_test_cx.cpp ;
# examples
obj describe_cxx14 : describe_cxx14.cpp ;
@@ -85,8 +96,8 @@ explicit describe_cxx14 ;
local CXX14 = [ check-target-builds describe_cxx14 describe_cxx14 : : <build>no ] "<toolset>msvc-14.0:<cxxflags>-wd4100" ;
local JSON = <library>/boost//json/<warnings>off "<toolset>msvc-14.2:<cxxflags>-wd5104" ;
local SERIALIZATION = <library>/boost//serialization/<warnings>off "-<toolset>clang:<warnings-as-errors>on" ;
local JSON = <library>/boost/json//boost_json/<warnings>off "<toolset>msvc-14.2:<cxxflags>-wd5104" "<toolset>msvc-14.0:<cxxflags>-wd4996" <undefined-sanitizer>norecover:<link>static ;
local SERIALIZATION = <library>/boost/serialization//boost_serialization/<warnings>off -$(WERROR) <undefined-sanitizer>norecover:<link>static ;
run ../example/printing_enums_ct.cpp : : : $(CXX14) ;
run ../example/printing_enums_rt.cpp : : : $(CXX14) ;
@@ -96,9 +107,10 @@ run ../example/print_function.cpp : : : $(CXX14) ;
run ../example/to_json.cpp : : : $(CXX14) $(JSON) ;
run ../example/from_json.cpp : : : $(CXX14) $(JSON) ;
run ../example/serialization.cpp : : : $(CXX14) $(SERIALIZATION) ;
run ../example/json_rpc.cpp : : : $(CXX14) $(JSON) ;
run ../example/json_rpc.cpp : : : $(CXX14) $(JSON) <library>/boost/utility//boost_utility
"<toolset>gcc-14,<cxxstd>14:<build>no" ; # mysterious segmentation fault
run ../example/hash_value.cpp : : : $(CXX14) ;
run ../example/equality.cpp : : : $(CXX14) ;
link ../example/console.cpp : $(CXX14) $(JSON) ;
link ../example/console.cpp : $(CXX14) $(JSON) <library>/boost/utility//boost_utility ;
run ../example/struct_to_tuple.cpp : : : $(CXX14) ;
run ../example/pm_to_string.cpp : : : $(CXX14) ;

View File

@@ -62,6 +62,14 @@ int main() {}
#include <boost/mp11.hpp>
template<typename ...Bases>
struct ZT: Bases...
{
BOOST_DESCRIBE_CLASS(ZT, (Bases...), (), (), ());
};
using Z = ZT<X1, X2, X3>;
int main()
{
using namespace boost::describe;
@@ -151,6 +159,21 @@ int main()
BOOST_TEST_EQ( (mp_at_c<L, 1>::modifiers), mod_private | mod_virtual );
}
{
using L = describe_bases<Z, mod_any_access>;
BOOST_TEST_EQ( mp_size<L>::value, 3 );
BOOST_TEST_TRAIT_SAME( typename mp_at_c<L, 0>::type, X1 );
BOOST_TEST_EQ( (mp_at_c<L, 0>::modifiers), mod_public );
BOOST_TEST_TRAIT_SAME( typename mp_at_c<L, 1>::type, X2 );
BOOST_TEST_EQ( (mp_at_c<L, 1>::modifiers), mod_public );
BOOST_TEST_TRAIT_SAME( typename mp_at_c<L, 2>::type, X3 );
BOOST_TEST_EQ( (mp_at_c<L, 2>::modifiers), mod_public );
}
return boost::report_errors();
}

View File

@@ -14,4 +14,4 @@ target_link_libraries(main Boost::describe)
enable_testing()
add_test(main main)
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>)

View File

@@ -11,7 +11,6 @@ add_subdirectory(../../../assert boostorg/assert)
add_subdirectory(../../../config boostorg/config)
add_subdirectory(../../../core boostorg/core)
add_subdirectory(../../../mp11 boostorg/mp11)
add_subdirectory(../../../static_assert boostorg/static_assert)
add_subdirectory(../../../throw_exception boostorg/throw_exception)
add_executable(quick ../quick.cpp)
@@ -20,4 +19,4 @@ target_link_libraries(quick Boost::describe Boost::core)
enable_testing()
add_test(quick quick)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --no-tests=error -C $<CONFIG>)
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --no-tests=error -C $<CONFIG>)

View File

@@ -0,0 +1,78 @@
// Copyright 2021 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/describe/enum_from_string.hpp>
#include <boost/describe/enum.hpp>
#include <boost/core/detail/string_view.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp>
#if !defined(BOOST_DESCRIBE_CXX14)
#include <boost/config/pragma_message.hpp>
BOOST_PRAGMA_MESSAGE("Skipping test because C++14 is not available")
int main() {}
#else
enum E1 { v101 = 101, v102 = 102 };
BOOST_DESCRIBE_ENUM(E1, v101, v102)
enum class E2 { v201 = 201, v202 = 202 };
BOOST_DESCRIBE_ENUM(E2, v201, v202)
BOOST_DEFINE_ENUM(E3, v301, v302)
BOOST_DEFINE_ENUM_CLASS(E4, v401, v402)
template<class St> void test()
{
using boost::describe::enum_from_string;
{
E1 w{};
BOOST_TEST( enum_from_string( St( "v101" ), w ) ) && BOOST_TEST_EQ( w, v101 );
BOOST_TEST( enum_from_string( St( "v102" ), w ) ) && BOOST_TEST_EQ( w, v102 );
BOOST_TEST_NOT( enum_from_string( St( "v103" ), w ) );
}
{
E2 w{};
BOOST_TEST( enum_from_string( St( "v201" ), w ) ) && BOOST_TEST_EQ( (int)w, (int)E2::v201 );
BOOST_TEST( enum_from_string( St( "v202" ), w ) ) && BOOST_TEST_EQ( (int)w, (int)E2::v202 );
BOOST_TEST_NOT( enum_from_string( St( "v203" ), w ) );
}
{
E3 w{};
BOOST_TEST( enum_from_string( St( "v301" ), w ) ) && BOOST_TEST_EQ( w, v301 );
BOOST_TEST( enum_from_string( St( "v302" ), w ) ) && BOOST_TEST_EQ( w, v302 );
BOOST_TEST_NOT( enum_from_string( St( "v303" ), w ) );
}
{
E4 w{};
BOOST_TEST( enum_from_string( St( "v401" ), w ) ) && BOOST_TEST_EQ( (int)w, (int)E4::v401 );
BOOST_TEST( enum_from_string( St( "v402" ), w ) ) && BOOST_TEST_EQ( (int)w, (int)E4::v402 );
BOOST_TEST_NOT( enum_from_string( St( "v403" ), w ) );
}
}
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
# include <string_view>
#endif
int main()
{
test<std::string>();
test<boost::core::string_view>();
#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW)
test<std::string_view>();
#endif
return boost::report_errors();
}
#endif // !defined(BOOST_DESCRIBE_CXX14)

View File

@@ -0,0 +1,32 @@
// Copyright 2021, 2025 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/describe/enum_to_string.hpp>
#include <boost/describe/enum.hpp>
#include <boost/describe/detail/cx_streq.hpp>
#include <boost/config/pragma_message.hpp>
#if !defined(BOOST_DESCRIBE_CXX14)
BOOST_PRAGMA_MESSAGE("Skipping test because C++14 is not available")
#elif defined(_MSC_VER) && _MSC_VER == 1900
BOOST_PRAGMA_MESSAGE("Skipping test because _MSC_VER == 1900")
#else
#define STATIC_ASSERT(...) static_assert(__VA_ARGS__, #__VA_ARGS__)
BOOST_DEFINE_ENUM_CLASS(E, v1, v2, v3)
using boost::describe::enum_to_string;
using boost::describe::detail::cx_streq;
STATIC_ASSERT( cx_streq( enum_to_string( E::v1, "" ), "v1" ) );
STATIC_ASSERT( cx_streq( enum_to_string( E::v2, "" ), "v2" ) );
STATIC_ASSERT( cx_streq( enum_to_string( E::v3, "" ), "v3" ) );
STATIC_ASSERT( cx_streq( enum_to_string( (E)17, "def" ), "def" ) );
#endif // !defined(BOOST_DESCRIBE_CXX14)

View File

@@ -0,0 +1,24 @@
// Copyright 2025 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/describe/enumerators.hpp>
#include <boost/describe/enum.hpp>
#include <boost/config.hpp>
#include <boost/config/pragma_message.hpp>
#if !defined(BOOST_DESCRIBE_CXX20)
BOOST_PRAGMA_MESSAGE("Skipping test because BOOST_DESCRIBE_CXX20 isn't defined")
#else
struct X
{
enum E { v1 };
BOOST_DESCRIBE_NESTED_ENUM(E, v1)
using L = boost::describe::describe_enumerators<E>;
};
#endif

View File

@@ -70,6 +70,19 @@ char const * s49 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i,
char const * s50 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X);
char const * s51 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y);
char const * s52 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z);
char const * s53 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1);
char const * s54 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2);
char const * s55 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3);
char const * s56 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3, 4);
char const * s57 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3, 4, 5);
char const * s58 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3, 4, 5, 6);
char const * s59 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3, 4, 5, 6, 7);
char const * s60 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3, 4, 5, 6, 7, 8);
char const * s61 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3, 4, 5, 6, 7, 8, 9);
char const * s62 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0);
char const * s63 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, @);
char const * s64 = BOOST_DESCRIBE_PP_FOR_EACH(F1, ~, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, @, _);
int main()
{
@@ -126,6 +139,18 @@ int main()
BOOST_TEST_CSTR_EQ( s50, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX" );
BOOST_TEST_CSTR_EQ( s51, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY" );
BOOST_TEST_CSTR_EQ( s52, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" );
BOOST_TEST_CSTR_EQ( s53, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1" );
BOOST_TEST_CSTR_EQ( s54, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12" );
BOOST_TEST_CSTR_EQ( s55, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123" );
BOOST_TEST_CSTR_EQ( s56, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234" );
BOOST_TEST_CSTR_EQ( s57, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345" );
BOOST_TEST_CSTR_EQ( s58, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456" );
BOOST_TEST_CSTR_EQ( s59, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567" );
BOOST_TEST_CSTR_EQ( s60, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678" );
BOOST_TEST_CSTR_EQ( s61, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789" );
BOOST_TEST_CSTR_EQ( s62, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" );
BOOST_TEST_CSTR_EQ( s63, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@" );
BOOST_TEST_CSTR_EQ( s64, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890@_" );
return boost::report_errors();
}