2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-01-20 04:42:22 +00:00

Compare commits

...

69 Commits
2.0.0 ... 2.0.3

Author SHA1 Message Date
Antony Polukhin
10848f71ae add missing include 2021-10-01 14:59:18 +03:00
Antony Polukhin
7d925660bb fix -Wzero-length-array warning 2021-09-29 11:38:07 +03:00
Antony Polukhin
87e77b9b43 do not use depth 1 for checkouts in CI 2021-09-20 21:47:01 +03:00
Antony Polukhin
b331ef58f5 docs cleanup 2021-09-11 19:25:18 +03:00
Antony Polukhin
5579d11588 minor update of the docs 2021-09-11 18:00:46 +03:00
Antony Polukhin
51f6422c07 update CI setup 2021-09-11 14:16:53 +03:00
Antony Polukhin
87c9c2d76c Merge pull request #88 from alexey-romanov/develop
workaround for msvc compilers <= 1920
2021-07-24 21:35:04 +03:00
Aleksei Romanov
d1e7e87a31 workaround for msvc compilers <= 1920 2021-07-15 12:16:17 +03:00
Antony Polukhin
0436e48a79 Restore inspect tool runs 2021-06-12 19:42:09 +03:00
Antony Polukhin
4d9294cb1f final polishings for of boost-free version 2021-06-10 18:47:18 +03:00
Antony Polukhin
e75c066ddc freestanding docs anc CI fixes 2021-06-10 18:12:22 +03:00
Antony Polukhin
e51a594dbb fix strip_boost_namespace.sh work if target pathh is missing 2021-06-10 11:42:19 +03:00
Antony Polukhin
12f2b3a365 CI fixes 2021-06-10 11:18:25 +03:00
Antony Polukhin
2a1b206244 temporary disable inspect tool, as it is broken in develop 2021-06-10 10:10:38 +03:00
Antony Polukhin
b4bee46c54 Merge github.com:boostorg/pfr into develop 2021-06-09 21:06:07 +03:00
Antony Polukhin
444094f20d add helper script to remove boost namespace from the library and smoke-test the result 2021-06-09 21:05:19 +03:00
Peter Dimov
da12b52759 Add CMakeLists.txt 2021-05-28 00:10:03 +03:00
Antony Polukhin
94315117fa disable clang-9 CI tests in c++2a mode because of the issues with comparisons in chrono 2021-05-19 11:07:28 +03:00
Antony Polukhin
9c812d4217 add missing include 2021-05-18 22:12:36 +03:00
Antony Polukhin
c9674f6164 use a murmur based implementation of hash_combine() to reduce collisions count 2021-05-18 22:04:30 +03:00
Antony Polukhin
ed82d60966 Merge pull request #79 from denzor200/develop
Visual Studio 2017 with C++14
2021-05-02 17:52:01 +03:00
Denis Mikhailov
5ffd7f6317 Update config.hpp 2021-05-02 17:04:46 +04:00
Denis Mikhailov
81d33f5bc6 Update read_write_non_literal.cpp 2021-05-02 16:25:56 +04:00
Denis Mikhailov
a6e50ccf07 Update core14_classic.hpp 2021-05-02 15:51:45 +04:00
Denis Mikhailov
a7b6dd71a6 Update Jamfile.v2 2021-05-02 03:43:43 +04:00
denzor200
a3adfcf44b Revert "Update ci.yml"
This reverts commit 7ac8beae4c.
2021-05-02 03:21:34 +04:00
Denis Mikhailov
fbfb8e4abd Update Jamfile.v2 2021-05-02 03:09:28 +04:00
Denis Mikhailov
7ac8beae4c Update ci.yml 2021-05-02 02:51:16 +04:00
Denis Mikhailov
42d96c04fb Update functional.hpp 2021-05-02 02:35:15 +04:00
Denis Mikhailov
4301765f61 Update config.hpp 2021-05-02 02:25:15 +04:00
Denis Mikhailov
5ce264629c Update config.hpp 2021-05-02 02:18:21 +04:00
Denis Mikhailov
994bc05610 Update ci.yml 2021-05-02 01:59:06 +04:00
Antony Polukhin
b14939376d CI fixes for Windows 2021-04-30 01:34:44 +03:00
Antony Polukhin
861cc9d6af CI fixes 2021-04-30 01:29:00 +03:00
Antony Polukhin
2c4bfdbc68 CI fixes 2021-04-30 00:20:52 +03:00
Antony Polukhin
3660cf4c83 make the GithubActions CI work well with apolukhin/magic_get repo 2021-04-30 00:01:34 +03:00
Antony Polukhin
a3c71ae77d gather coverage from GithubAction CI runs only 2021-04-29 23:49:38 +03:00
Antony Polukhin
22f85d8e90 Update links in Readme and add GithubActions badge 2021-04-29 23:47:23 +03:00
Antony Polukhin
be8e2c65bc download inspect tool dependencies in CI runs 2021-04-27 11:15:39 +03:00
Antony Polukhin
3b967a5fa7 CI fixes 2021-04-27 09:56:28 +03:00
Antony Polukhin
33250407db disable C++14 CI runst for MSVC 2021-04-26 21:51:39 +03:00
Antony Polukhin
8aa4e0712a fix issues found by inspect tool 2021-04-26 20:53:56 +03:00
Antony Polukhin
4e05688247 copy GithubAction CI setup from Boost.Conversion 2021-04-26 20:53:29 +03:00
Antony Polukhin
b24b7f6d62 Update links to docs in Readme 2021-04-17 18:16:22 +03:00
Antony Polukhin
e94b247698 remove extra semicolons (fixes #72) 2021-04-09 10:03:59 +03:00
Antony Polukhin
ea4c6e85f7 Tweak the inheritance check to do less instantiations and to work on more compilers 2021-03-28 19:34:29 +03:00
Antony Polukhin
180db174ad Merge branch 'INHERITED_DETECTOR' of github.com:denzor200/pfr into develop 2021-03-28 10:47:22 +03:00
Antony Polukhin
186d6aacb6 Merge pull request #73 from denzor200/PATCH_1
Spell checking
2021-03-27 14:45:16 +03:00
denzor200
5646daebad Spell checking 2021-03-26 21:24:14 +04:00
Antony Polukhin
f33c357af6 Workaround MSVC issue for the guaranteed copy elision 2021-03-26 11:24:59 +03:00
denzor200
9390106145 Merge remote-tracking branch 'upstream/develop' into INHERITED_DETECTOR
Conflicts:
	include/boost/pfr/detail/fields_count.hpp
2021-03-25 23:40:16 +04:00
Antony Polukhin
3b6d3a4cb9 Merge github.com:boostorg/pfr into develop 2021-03-24 09:59:29 +03:00
Antony Polukhin
638fefedd0 Allow reflection of aggregates with non movable fields if guaranteed copy elision is on 2021-03-24 09:58:20 +03:00
denzor200
2506fbceb8 Detector for inherited structs was implemented for C++17 2021-03-13 18:55:47 +04:00
Antony Polukhin
d2e5b44aec Merge pull request #70 from jatin-25/patch-1
Spelling is corrected in quick_examples.cpp
2021-03-01 12:53:38 +03:00
jatin-25
bbffc61524 Spelling is corrected in quick_examples.cpp
This is my first contribution in Open Source. I have corrected the spelling of "variable" in a comment. I am looking forward to contribute to Boost.
2021-02-24 16:25:37 +05:30
Antony Polukhin
36c020b032 update copyright years 2021-01-03 17:33:29 +03:00
Antony Polukhin
4b38e4a243 Make test C++14 compatible 2020-12-20 16:04:19 +03:00
Antony Polukhin
9ef5a5646d add test from #45 2020-12-20 12:22:50 +03:00
Antony Polukhin
3daf98c9e9 change "std" status to "proposal" due to https:/wg21.link/p2141 2020-12-18 13:45:16 +03:00
Antony Polukhin
a5f84b38a6 Disable constexpr_ops test on MSVC 2020-12-17 20:28:38 +03:00
Antony Polukhin
e88e44cc14 comparison functions are now constexpr (fixes #52) 2020-12-16 18:42:40 +03:00
Antony Polukhin
f28952c544 fix attempt for #61 2020-12-16 17:38:15 +03:00
Antony Polukhin
eb37b11dfc attempt to fix test 2020-12-16 11:58:39 +03:00
Antony Polukhin
2719abe88c fix typos in SimpleAggregate (fixes #63) 2020-12-16 10:56:53 +03:00
Antony Polukhin
01af26370f Merge pull request #64 from eldiener/develop
Add "cxxstd" json field. The "cxxstd" json field is being added to ea…
2020-12-16 10:53:09 +03:00
Edward Diener
eb7a7a2d92 Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries whose minumum C++ standard compilation level is C++11 on up. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. 2020-12-16 00:42:20 -05:00
Antony Polukhin
33b5003883 fixes 2020-12-15 15:46:17 +03:00
Antony Polukhin
99f5037a00 add test on reflecting structure with std::optional<std::chrono::seconds> (refs #61) 2020-11-28 20:30:22 +03:00
92 changed files with 837 additions and 322 deletions

181
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,181 @@
name: CI
on:
pull_request:
push:
branches:
- master
- develop
- feature/**
env:
UBSAN_OPTIONS: print_stacktrace=1
jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- toolset: gcc-7
cxxstd: "03,11,14,17"
os: ubuntu-18.04
- toolset: gcc-9 # Do not remove! It is the only toolset that tests misc/strip_boost_namespace.sh
cxxstd: "03,11,14,17,2a"
os: ubuntu-18.04
- toolset: gcc-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-18.04
cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined"
linkflags: "linkflags=--coverage -lasan -lubsan"
gcov_tool: "gcov-10"
- toolset: clang
compiler: clang++-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
cxxflags: "cxxflags=-fsanitize=address,undefined,integer -fno-sanitize-recover=undefined"
linkflags: "linkflags=-fsanitize=address,undefined,integer"
- toolset: clang
cxxstd: "03,11,14,17,2a"
os: macos-10.15
cxxflags: "cxxflags=-fsanitize=address,undefined -fno-sanitize-recover=undefined"
linkflags: "linkflags=-fsanitize=address,undefined"
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=pfr # Note: changed from ${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git boost-root
cd boost-root
git submodule update --init --depth 10 --jobs 2 tools/boostdep tools/inspect libs/filesystem
python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 3" filesystem
rm -rf libs/$LIBRARY/*
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--depth 10 --jobs 3" $LIBRARY
./bootstrap.sh
./b2 -d0 headers
./b2 -j4 variant=debug tools/inspect/build
- name: Create user-config.jam
if: matrix.compiler
run: |
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
- name: Run tests
run: |
cd ../boost-root
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release "${{matrix.cxxflags}}" "${{matrix.linkflags}}" "${{matrix.launcher}}"
dist/bin/inspect libs/$LIBRARY
- name: Test boost namespace stripping
if: ${{matrix.toolset == 'gcc-9'}}
run: ../boost-root/libs/$LIBRARY/misc/strip_boost_namespace.sh
- name: Prepare coverage data
if: matrix.gcov_tool
run: |
mkdir -p $GITHUB_WORKSPACE/coveralls
echo -e "#!/bin/bash\nexec ${{matrix.gcov_tool}} \"\$@\"" > $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh
chmod +x $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh
wget https://github.com/linux-test-project/lcov/archive/v1.15.zip
unzip v1.15.zip
LCOV="`pwd`/lcov-1.15/bin/lcov --gcov-tool $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh"
echo "$LCOV --directory ../boost-root/bin.v2/libs/$LIBRARY/ --base-directory `pwd`/libs/$LIBRARY/test --capture --output-file $GITHUB_WORKSPACE/coveralls/coverage.info"
$LCOV --directory ../boost-root/bin.v2/libs/$LIBRARY/ --base-directory ../boost-root/ --capture --output-file $GITHUB_WORKSPACE/coveralls/coverage.info
$LCOV --remove $GITHUB_WORKSPACE/coveralls/coverage.info "/usr*" "*/$LIBRARY/test/*" ${{matrix.ignore_coverage}} "*/$LIBRARY/tests/*" "*/$LIBRARY/examples/*" "*/$LIBRARY/example/*" -o $GITHUB_WORKSPACE/coveralls/coverage.info
cd ../boost-root
OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/$LIBRARY\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'`
echo $OTHER_LIBS
eval "$LCOV --remove $GITHUB_WORKSPACE/coveralls/coverage.info $OTHER_LIBS -o $GITHUB_WORKSPACE/coveralls/coverage.info"
- name: Coveralls
uses: coverallsapp/github-action@master
if: matrix.gcov_tool
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coveralls/coverage.info
parallel: true
windows:
strategy:
fail-fast: false
matrix:
include:
- toolset: msvc-14.1
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2016
# TODO: fails the loophole tests
#- toolset: msvc-14.2
# cxxstd: "14,17,latest"
# addrmd: 32,64
# os: windows-2019
- toolset: gcc
cxxstd: "03,11,14,17,2a"
addrmd: 64
os: windows-2019
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
set LIBRARY=pfr
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 10 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--jobs 3" %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
- name: Run tests
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release
finish:
needs: posix
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true

View File

@@ -1,177 +0,0 @@
# Use, modification, and distribution are
# subject to 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)
#
# Copyright Antony Polukhin 2014-2020.
#
# See https://svn.boost.org/trac/boost/wiki/TravisCoverals for description of this file
# and how it can be used with Boost libraries.
#
# File revision #9 (with DIFF)
language: cpp
os: linux
dist: bionic
# `--coverage` flags required to generate coverage info for Coveralls
matrix:
include:
# - env: B2_ARGS='cxxstd=14,1y toolset=gcc-6 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD -fno-rtti" linkflags="--coverage -lasan -lubsan"'
# name: "GCC-6, no RTTI"
# addons:
# apt:
# sources: ubuntu-toolchain-r-test
# packages: g++-6
- env: B2_ARGS='cxxstd=14,17,2a toolset=gcc-10 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -lasan -lubsan"'
name: "GCC-10"
sudo: required # Required by leak sanitizer
addons:
apt:
sources: ubuntu-toolchain-r-test
packages: g++-10
- env: B2_ARGS='cxxstd=14,17,2a toolset=gcc-8 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -lasan -lubsan"'
name: "GCC-8"
sudo: required # Required by leak sanitizer
addons:
apt:
sources: ubuntu-toolchain-r-test
packages: g++-8
- env: B2_ARGS='cxxstd=1y toolset=gcc-5 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -lasan -lubsan"'
name: "GCC-5"
addons:
apt:
sources: ubuntu-toolchain-r-test
packages: g++-5
# - env: B2_ARGS='cxxstd=14,1y toolset=gcc-8 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD -fno-exceptions" linkflags="--coverage -lasan -lubsan"'
# name: "GCC-8, no exceptions"
# sudo: required # Required by leak sanitizer
# addons:
# apt:
# sources: ubuntu-toolchain-r-test
# packages: g++-8
- env: B2_ARGS='cxxstd=14 toolset=clang-6 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -fsanitize=address,leak,undefined"'
name: "Clang-6"
sudo: required # Required by leak sanitizer
addons:
apt:
sources: llvm-toolchain-trusty-6
packages: clang-6.0
- env: B2_ARGS='cxxstd=14,17,20 toolset=clang-10 cxxflags="-stdlib=libc++ --coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="-stdlib=libc++ --coverage -fsanitize=address,leak,undefined"'
name: "Clang-10, libc++"
sudo: required # Required by leak sanitizer
addons:
apt:
sources: llvm-toolchain-bionic-10
packages:
- clang-10
- libc++-10-dev
- libc++abi-10-dev
# Sanitizers disabled for this toolset as they started causing link troubles:
# hidden symbol `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE11__recommendEm' isn't defined
- env: B2_ARGS='cxxstd=14 toolset=clang-libc++ cxxflags="--coverage -DBOOST_TRAVISCI_BUILD" linkflags="--coverage"'
name: "Clang-3.8, libc++"
addons:
apt:
packages: libc++-dev
###############################################################################################################
# From this point and below code is same for all the Boost libs
###############################################################################################################
# Installing additional tools
addons:
apt:
sources: git-core
packages:
- git
- python-yaml
before_install:
# Autodetect Boost branch by using the following code: - BOOST_BRANCH=$TRAVIS_BRANCH
# or just directly specify it
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
# Files, which coverage results must be ignored (files from other projects).
# Example: - IGNORE_COVERAGE='*/boost/progress.hpp */filesystem/src/*'
- IGNORE_COVERAGE=''
# Explicitly remove the following library from Boost and use the folder for tests. This may be usefull, if you're for example running Travis
# from `Boost.DLL` repo, while Boost already has `dll`.
#
# By default is eaual to - BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR)
# This will force to use local repo content, instead of the Boost's default.
- BOOST_LIBS_FOLDER=pfr #$(basename $TRAVIS_BUILD_DIR)
# Global options for sanitizers
- UBSAN_OPTIONS=print_stacktrace=1
- LSAN_OPTIONS=verbosity=1:log_threads=1
# Cloning minimal set of Boost libraries
- BOOST=$HOME/boost-local
- echo "Testing $BOOST_LIBS_FOLDER, to remove $BOOST/libs/$BOOST_LIBS_FOLDER, testing branch $BOOST_BRANCH"
- git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git $BOOST
- cd $BOOST
- git submodule update --init --depth 10 tools/build tools/boostdep
# Replacing Boost module with this project and installing Boost dependencies
- rm -rf $BOOST/libs/$BOOST_LIBS_FOLDER
- mv $TRAVIS_BUILD_DIR $BOOST/libs/$BOOST_LIBS_FOLDER
- TRAVIS_BUILD_DIR=$BOOST/libs/$BOOST_LIBS_FOLDER
- python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" -I example -I examples $(basename $TRAVIS_BUILD_DIR)
- git status
# Adding missing toolsets and preparing Boost headers
- ./bootstrap.sh
- ./b2 headers
- |-
echo "using gcc ;" >> ~/user-config.jam
echo "using clang ;" >> ~/user-config.jam
echo "using clang : 3.8 : clang++-3.8 ;" >> ~/user-config.jam
echo "using clang : 4 : clang++-4.0 ;" >> ~/user-config.jam
echo "using clang : 5 : clang++-5.0 ;" >> ~/user-config.jam
echo "using clang : 6 : clang++-6.0 ;" >> ~/user-config.jam
echo "using clang : 7 : clang++-7.0 ;" >> ~/user-config.jam
echo "using clang : 8 : clang++-8 ;" >> ~/user-config.jam
echo "using clang : 10 : clang++-10 ;" >> ~/user-config.jam
echo "using clang : libc++ : clang++-libc++ ;" >> ~/user-config.jam
- cd $BOOST/libs/$BOOST_LIBS_FOLDER/test/
script:
- sh -c "../../../b2 -j2 $B2_ARGS"
after_success:
# Copying Coveralls data to a separate folder
- mkdir -p $TRAVIS_BUILD_DIR/coverals
- find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
- find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
- find ../../../bin.v2/ -name "*.da" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
- find ../../../bin.v2/ -name "*.no" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
- wget https://github.com/linux-test-project/lcov/archive/v1.12.zip
- unzip v1.12.zip
- LCOV="`pwd`/lcov-1.12/bin/lcov"
# Preparing Coveralls data by changind data format to a readable one
- echo "$LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info"
- $LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info
# ... erasing /test/ /example/ folder data
- cd $BOOST
- $LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info "/usr*" "*/$BOOST_LIBS_FOLDER/test/*" $IGNORE_COVERAGE "*/$BOOST_LIBS_FOLDER/tests/*" "*/$BOOST_LIBS_FOLDER/examples/*" "*/$BOOST_LIBS_FOLDER/example/*" -o $TRAVIS_BUILD_DIR/coverals/coverage.info
# ... erasing data that is not related to this project directly
- OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/$BOOST_LIBS_FOLDER\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'`
- echo $OTHER_LIBS
- eval "$LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info"
# Sending data to Coveralls
- cd $TRAVIS_BUILD_DIR
- gem install coveralls-lcov
- coveralls-lcov coverals/coverage.info

20
CMakeLists.txt Normal file
View File

@@ -0,0 +1,20 @@
# Generated by `boostdep --cmake pfr`
# Copyright 2020 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_pfr VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_pfr INTERFACE)
add_library(Boost::pfr ALIAS boost_pfr)
target_include_directories(boost_pfr INTERFACE include)
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()

View File

@@ -1,16 +1,19 @@
# Boost.PFR
# [Boost.PFR](https://boost.org/libs/pfr)
This is a C++14 library for very basic reflection that gives you access to structure elements by index and provides other `std::tuple` like methods for user defined types without any macro or boilerplate code.
[Boost.PFR](https://boost.org/libs/pfr) is a part of the [Boost C++ Libraries](https://github.com/boostorg). However, Boost.PFR is a header only library that does not depend on Boost. You can just copy the content of the "include" folder from the github into your project, and the library will work fine.
[Latest documentation](http://apolukhin.github.com/magic_get/index.html)
For a version of the library without `boost::` namespace see [PFR](https://github.com/apolukhin/pfr_non_boost).
### Test results
Branches | Build | Tests coverage | More info
----------------|-------------- | -------------- |-----------
Develop: | [![Build Status](https://travis-ci.org/apolukhin/magic_get.svg?branch=develop)](https://travis-ci.org/apolukhin/magic_get) [![Build status](https://ci.appveyor.com/api/projects/status/3tled9gd24k9paia/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/magic-get/branch/develop) | [![Coverage Status](https://coveralls.io/repos/github/apolukhin/magic_get/badge.png?branch=develop)](https://coveralls.io/github/apolukhin/magic_get?branch=develop) | [details...](http://www.boost.org/development/tests/develop/developer/pfr.html)
Master: | [![Build Status](https://travis-ci.org/apolukhin/magic_get.svg?branch=master)](https://travis-ci.org/apolukhin/magic_get) [![Build status](https://ci.appveyor.com/api/projects/status/3tled9gd24k9paia/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/magic-get/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/apolukhin/magic_get/badge.png?branch=master)](https://coveralls.io/github/apolukhin/magic_get?branch=master) | [details...](http://www.boost.org/development/tests/master/developer/pfr.html)
Develop: | [![CI](https://github.com/boostorg/pfr/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/pfr/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/0mavmnkdmltcdmqa/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/pfr/branch/develop) | [![Coverage Status](https://coveralls.io/repos/github/apolukhin/magic_get/badge.png?branch=develop)](https://coveralls.io/github/apolukhin/magic_get?branch=develop) | [details...](https://www.boost.org/development/tests/develop/developer/pfr.html)
Master: | [![CI](https://github.com/boostorg/pfr/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/pfr/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/0mavmnkdmltcdmqa/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/pfr/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/apolukhin/magic_get/badge.png?branch=master)](https://coveralls.io/github/apolukhin/magic_get?branch=master) | [details...](https://www.boost.org/development/tests/master/developer/pfr.html)
[Latest developer documentation](https://www.boost.org/doc/libs/develop/doc/html/boost_pfr.html)
### Motivating Example #0
```c++
@@ -94,8 +97,8 @@ my_struct has 2 fields: {"Das ist fantastisch!", 100}
### Requirements and Limitations
[See docs](http://apolukhin.github.com/magic_get/index.html).
[See docs](https://www.boost.org/doc/libs/develop/doc/html/boost_pfr.html).
### License
Distributed under the [Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt).
Distributed under the [Boost Software License, Version 1.0](https://boost.org/LICENSE_1_0.txt).

View File

@@ -1,7 +1,7 @@
[library Boost.PFR
[quickbook 1.6]
[version 2.0]
[copyright 2016-2020 Antony Polukhin]
[copyright 2016-2021 Antony Polukhin]
[category Language Features Emulation]
[license
Distributed under the Boost Software License, Version 1.0.
@@ -55,10 +55,10 @@ user_info retrieve_friend(std::string_view name) {
db::insert(
"INSERT INTO user_infos(id, name, email, login) VALUES ($0, $1, $2, $3)",
std::move(friend_info.id), //////////////////////////////////////////////
std::move(friend_info.name), // Users are forced to move individual fields
std::move(friend_info.email), // because your library can not iterate over
std::move(friend_info.login) // the fields of a user provided structure
friend_info.id, /////////////////////////////////////////////////////////
friend_info.name, // Users are forced to enumerate fields because your
friend_info.email, // library can not iterate over the fields of a user
friend_info.login // provided structure
);
return friend_info;
@@ -94,8 +94,8 @@ user_info retrieve_friend(std::string_view name) {
db::insert(
"INSERT INTO user_infos(id, name, email, login) VALUES ($0, $1, $2, $3)",
friend_info ////////////////////////////////////////////////////////////
// Boost.PFR allows you to iterate over all the fields of a
// user provided structure
// Boost.PFR allows you to iterate over all the fields
// of a user provided structure
//
);
@@ -169,7 +169,7 @@ Boost.PFR adds the following out-of-the-box functionality for aggregate initiali
* methods for cooperation with `std::tuple`
* methods to visit each field of the structure
Boost.PFR is a header only library that does not depend on Boost. You can just copy the content of the "include" folder [@https://github.com/boostorg/pfr from the github] into your project, and the library will work fine.
Boost.PFR is a header only library that does not depend on Boost. You can just copy the content of the "include" folder [@https://github.com/boostorg/pfr from the Boost.PFR github] into your project, and the library will work fine. For a version of the library without `boost::` namespace see [@https://github.com/apolukhin/pfr_non_boost PFR].
[caution Recommended C++ Standards are C++17 and above. Library requires at least C++14! Pre C++14 compilers (C++11, C++03...) are not supported]
@@ -438,25 +438,25 @@ error: static_assert failed "====================> Boost.PFR: For safety reasons
[caution Recommended C++ Standards are C++17 and above. Library requires at least C++14! Pre C++14 compilers (C++11, C++03...) are not supported. ]
Boost.PFR library works with types that satisfy the requirements of `SimpleAggregare`: aggregate types without base classes, `const` fields, references, or C arrays:
Boost.PFR library works with types that satisfy the requirements of `SimpleAggregate`: aggregate types without base classes, `const` fields, references, or C arrays:
```
struct simple_aggregate { // SimpleAggregare
struct simple_aggregate { // SimpleAggregate
std::string name;
int age;
boost::uuids::uuid uuid;
};
struct empty { // SimpleAggregare
struct empty { // SimpleAggregate
};
struct aggregate : empty { // not a SimpleAggregare
struct aggregate : empty { // not a SimpleAggregate
std::string name;
int age;
boost::uuids::uuid uuid;
};
```
The library may work with aggregates that don't satisfy the requirements of `SimpleAggregare`, but the behavior tends to be non-portable.
The library may work with aggregates that don't satisfy the requirements of `SimpleAggregate`, but the behavior tends to be non-portable.
[h2 Configuration Macro]
@@ -466,6 +466,7 @@ By default Boost.PFR [*auto-detects your compiler abilities] and automatically d
[[*BOOST_PFR_USE_CPP17*] [Define to `1` if you wish to override Boost.PFR choice and use C++17 structured bindings for reflection. Define to `0` to override Boost.PFR choice and disable C++17 structured bindings usage.]]
[[*BOOST_PFR_USE_LOOPHOLE*] [Define to `1` if you wish to override Boost.PFR choice and exploit [@http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2118 CWG 2118] for reflection. Define to `0` to override Boost.PFR choice and disable CWG 2118 usage.]]
[[*BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE*] [Define to `0` if you are hit by the template instantiation depth issues with `std::make_integer_sequence` and wish to use Boost.PFR version of that metafunction. Define to `1` to override Boost.PFR detection logic. ]]
[[*BOOST_PFR_HAS_GUARANTEED_COPY_ELISION*] [Define to `0` if your compiler does not implement C++17 guaranteed copy elision properly and fails to reflect aggregates with non-movable fields. Define to `1` to override Boost.PFR detection logic. ]]
]

View File

@@ -1,4 +1,4 @@
// Copyright 2016-2020 Antony Polukhin
// Copyright 2016-2021 Antony Polukhin
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright 2016-2020 Antony Polukhin
// Copyright 2016-2021 Antony Polukhin
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
@@ -12,6 +12,7 @@
#include <boost/pfr.hpp>
#include <boost/type_index.hpp>
// boost-no-inspect
void test_examples() {
#if BOOST_PFR_USE_CPP17
@@ -55,7 +56,7 @@ void test_examples() {
{
//[pfr_quick_examples_for_each_idx
// Iterate over fields of a varible and output index and
// Iterate over fields of a variable and output index and
// type of a variable.
struct tag0{};

View File

@@ -1,4 +1,4 @@
// Copyright 2016-2020 Antony Polukhin
// Copyright 2016-2021 Antony Polukhin
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -45,15 +45,18 @@
# define BOOST_PFR_USE_CPP17 1
# else
# define BOOST_PFR_USE_CPP17 0
# if !BOOST_PFR_USE_LOOPHOLE
# error Boost.PFR requires /std:c++latest or /std:c++17 flags on your compiler.
# endif
# endif
# else
# define BOOST_PFR_USE_CPP17 0
# endif
#endif
#if (!BOOST_PFR_USE_CPP17 && !BOOST_PFR_USE_LOOPHOLE)
# if (defined(_MSC_VER) && _MSC_VER < 1916) ///< in Visual Studio 2017 v15.9 PFR library with classic engine normally works
# error Boost.PFR requires /std:c++latest or /std:c++17 flags on your compiler.
# endif
#endif
#ifndef BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE
// Assume that libstdc++ since GCC-7.3 does not have linear instantiation depth in std::make_integral_sequence
# if defined( __GLIBCXX__) && __GLIBCXX__ >= 20180101
@@ -66,6 +69,14 @@
# endif
#endif
#ifndef BOOST_PFR_HAS_GUARANTEED_COPY_ELISION
# if defined(__cpp_guaranteed_copy_elision) && (!defined(_MSC_VER) || _MSC_VER > 1928)
# define BOOST_PFR_HAS_GUARANTEED_COPY_ELISION 1
# else
# define BOOST_PFR_HAS_GUARANTEED_COPY_ELISION 0
# endif
#endif
#if defined(__has_cpp_attribute)
# if __has_cpp_attribute(maybe_unused)
# define BOOST_PFR_MAYBE_UNUSED [[maybe_unused]]

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -549,6 +549,11 @@ constexpr bool is_flat_refelectable(std::index_sequence<I...>) noexcept {
return true;
}
template<class T>
constexpr bool is_flat_refelectable(std::index_sequence<>) noexcept {
return true; ///< all empty structs always flat refelectable
}
template <class T>
auto tie_as_flat_tuple(T& lvalue) noexcept {
static_assert(

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2017-2018 Alexandr Poltavsky, Antony Polukhin.
// Copyright (c) 2019-2020 Antony Polukhin.
// Copyright (c) 2019-2021 Antony Polukhin.
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -29,17 +29,21 @@ namespace boost { namespace pfr { namespace detail {
///////////////////// Structure that can be converted to reference to anything
struct ubiq_lref_constructor {
std::size_t ignore;
template <class Type> constexpr operator Type&() const && noexcept { // Allows initialization of reference fields (T& and const T&)
template <class Type> constexpr operator Type&() const && noexcept { // tweak for template_unconstrained.cpp like cases
return detail::unsafe_declval<Type&>();
};
}
template <class Type> constexpr operator Type&() const & noexcept { // tweak for optional_chrono.cpp like cases
return detail::unsafe_declval<Type&>();
}
};
///////////////////// Structure that can be converted to rvalue reference to anything
struct ubiq_rref_constructor {
std::size_t ignore;
template <class Type> /*constexpr*/ operator Type&&() const && noexcept { // Allows initialization of rvalue reference fields and move-only types
return detail::unsafe_declval<Type&&>();
};
template <class Type> /*constexpr*/ operator Type() const && noexcept { // Allows initialization of rvalue reference fields and move-only types
return detail::unsafe_declval<Type>();
}
};
@@ -89,6 +93,60 @@ struct is_aggregate_initializable_n {
#endif // #ifndef __cpp_lib_is_aggregate
///////////////////// Detect aggregates with inheritance
template <class Derived, class U>
constexpr bool static_assert_non_inherited() noexcept {
static_assert(
!std::is_base_of<U, Derived>::value,
"====================> Boost.PFR: Boost.PFR: Inherited types are not supported."
);
return true;
}
template <class Derived>
struct ubiq_lref_base_asserting {
template <class Type> constexpr operator Type&() const && // tweak for template_unconstrained.cpp like cases
noexcept(detail::static_assert_non_inherited<Derived, Type>()) // force the computation of assert function
{
return detail::unsafe_declval<Type&>();
}
template <class Type> constexpr operator Type&() const & // tweak for optional_chrono.cpp like cases
noexcept(detail::static_assert_non_inherited<Derived, Type>()) // force the computation of assert function
{
return detail::unsafe_declval<Type&>();
}
};
template <class Derived>
struct ubiq_rref_base_asserting {
template <class Type> /*constexpr*/ operator Type() const && // Allows initialization of rvalue reference fields and move-only types
noexcept(detail::static_assert_non_inherited<Derived, Type>()) // force the computation of assert function
{
return detail::unsafe_declval<Type>();
}
};
template <class T, std::size_t I0, std::size_t... I, class /*Enable*/ = typename std::enable_if<std::is_copy_constructible<T>::value>::type>
constexpr auto assert_first_not_base(std::index_sequence<I0, I...>) noexcept
-> typename std::add_pointer<decltype(T{ ubiq_lref_base_asserting<T>{}, ubiq_lref_constructor{I}... })>::type
{
return nullptr;
}
template <class T, std::size_t I0, std::size_t... I, class /*Enable*/ = typename std::enable_if<!std::is_copy_constructible<T>::value>::type>
constexpr auto assert_first_not_base(std::index_sequence<I0, I...>) noexcept
-> typename std::add_pointer<decltype(T{ ubiq_rref_base_asserting<T>{}, ubiq_rref_constructor{I}... })>::type
{
return nullptr;
}
template <class T>
constexpr void* assert_first_not_base(std::index_sequence<>) noexcept
{
return nullptr;
}
///////////////////// Helper for SFINAE on fields count
template <class T, std::size_t... I, class /*Enable*/ = typename std::enable_if<std::is_copy_constructible<T>::value>::type>
constexpr auto enable_if_constructible_helper(std::index_sequence<I...>) noexcept
@@ -206,6 +264,7 @@ constexpr std::size_t fields_count() noexcept {
"====================> Boost.PFR: Attempt to get fields count on a reference. This is not allowed because that could hide an issue and different library users expect different behavior in that case."
);
#if !BOOST_PFR_HAS_GUARANTEED_COPY_ELISION
static_assert(
std::is_copy_constructible<std::remove_all_extents_t<type>>::value || (
std::is_move_constructible<std::remove_all_extents_t<type>>::value
@@ -213,6 +272,7 @@ constexpr std::size_t fields_count() noexcept {
),
"====================> Boost.PFR: Type and each field in the type must be copy constructible (or move constructible and move assignable)."
);
#endif // #if !BOOST_PFR_HAS_GUARANTEED_COPY_ELISION
static_assert(
!std::is_polymorphic<type>::value,
@@ -235,9 +295,17 @@ constexpr std::size_t fields_count() noexcept {
// );
//#endif
#if defined(_MSC_VER) && (_MSC_VER <= 1920)
// Workaround for msvc compilers. Versions <= 1920 have a limit of max 1024 elements in template parameter pack
constexpr std::size_t max_fields_count = (sizeof(type) * CHAR_BIT >= 1024 ? 1024 : sizeof(type) * CHAR_BIT);
#else
constexpr std::size_t max_fields_count = (sizeof(type) * CHAR_BIT); // We multiply by CHAR_BIT because the type may have bitfields in T
#endif
constexpr std::size_t result = detail::detect_fields_count_dispatch<type>(size_t_<max_fields_count>{}, 1L, 1L);
detail::assert_first_not_base<type>(detail::make_index_sequence<result>{});
#ifndef __cpp_lib_is_aggregate
static_assert(
is_aggregate_initializable_n<type, result>::value,

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -31,7 +31,7 @@ void for_each_field_impl_apply(T&& v, F&& f, I /*i*/, int) {
template <class T, class F, std::size_t... I>
void for_each_field_impl(T& t, F&& f, std::index_sequence<I...>, std::false_type /*move_values*/) {
const int v[] = {(
const int v[] = {0, (
detail::for_each_field_impl_apply(sequence_tuple::get<I>(t), std::forward<F>(f), size_t_<I>{}, 1L),
0
)...};
@@ -41,7 +41,7 @@ void for_each_field_impl(T& t, F&& f, std::index_sequence<I...>, std::false_type
template <class T, class F, std::size_t... I>
void for_each_field_impl(T& t, F&& f, std::index_sequence<I...>, std::true_type /*move_values*/) {
const int v[] = {(
const int v[] = {0, (
detail::for_each_field_impl_apply(sequence_tuple::get<I>(std::move(t)), std::forward<F>(f), size_t_<I>{}, 1L),
0
)...};

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -10,6 +10,7 @@
#include <boost/pfr/detail/config.hpp>
#include <functional>
#include <cstdint>
#include <boost/pfr/detail/sequence_tuple.hpp>
@@ -116,11 +117,57 @@ namespace boost { namespace pfr { namespace detail {
}
};
// Hash combine functions copied from Boost.ContainerHash
// https://github.com/boostorg/container_hash/blob/171c012d4723c5e93cc7cffe42919afdf8b27dfa/include/boost/container_hash/hash.hpp#L311
// that is based on Peter Dimov's proposal
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
// issue 6.18.
//
// This also contains public domain code from MurmurHash. From the
// MurmurHash header:
//
// MurmurHash3 was written by Austin Appleby, and is placed in the public
// domain. The author hereby disclaims copyright to this source code.
template <typename SizeT>
constexpr void hash_combine(SizeT& seed, SizeT value) noexcept {
seed ^= value + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
constexpr auto rotl(std::uint32_t x, std::uint32_t r) noexcept {
return (x << r) | (x >> (32 - r));
}
constexpr void hash_combine(std::uint32_t& h1, std::uint32_t k1) noexcept {
const std::uint32_t c1 = 0xcc9e2d51;
const std::uint32_t c2 = 0x1b873593;
k1 *= c1;
k1 = detail::rotl(k1,15);
k1 *= c2;
h1 ^= k1;
h1 = detail::rotl(h1,13);
h1 = h1*5+0xe6546b64;
}
#if defined(INT64_MIN) && defined(UINT64_MAX)
constexpr void hash_combine(std::uint64_t& h, std::uint64_t k) noexcept {
const std::uint64_t m = 0xc6a4a7935bd1e995ULL;
const int r = 47;
k *= m;
k ^= k >> r;
k *= m;
h ^= k;
h *= m;
// Completely arbitrary number, to prevent 0's
// from hashing to 0.
h += 0xe6546b64;
}
#endif
template <typename T>
auto compute_hash(const T& value, long /*priority*/)
-> decltype(std::hash<T>()(value))
@@ -158,7 +205,7 @@ namespace boost { namespace pfr { namespace detail {
}
template <template <std::size_t, std::size_t> class Visitor, class T, class U>
bool binary_visit(const T& x, const U& y) {
constexpr bool binary_visit(const T& x, const U& y) {
constexpr std::size_t fields_count_lhs = detail::fields_count<std::remove_reference_t<T>>();
constexpr std::size_t fields_count_rhs = detail::fields_count<std::remove_reference_t<U>>();
constexpr std::size_t fields_count_min = detail::min_size(fields_count_lhs, fields_count_rhs);
@@ -171,12 +218,13 @@ namespace boost { namespace pfr { namespace detail {
::boost::pfr::detail::for_each_field_dispatcher(
x,
[&result, &y](const auto& lhs) {
constexpr std::size_t fields_count_rhs_ = detail::fields_count<std::remove_reference_t<U>>();
::boost::pfr::detail::for_each_field_dispatcher(
y,
[&result, &lhs](const auto& rhs) {
result = visitor_t::cmp(lhs, rhs);
},
detail::make_index_sequence<fields_count_rhs>{}
detail::make_index_sequence<fields_count_rhs_>{}
);
},
detail::make_index_sequence<fields_count_lhs>{}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2018 Sergei Fedorov
// Copyright (c) 2019-2020 Antony Polukhin
// Copyright (c) 2019-2021 Antony Polukhin
//
// 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)

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2017-2018 Chris Beck
// Copyright (c) 2019-2020 Antony Polukhin
// Copyright (c) 2019-2021 Antony Polukhin
//
// 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)
@@ -12,6 +12,7 @@
#include <type_traits>
#include <utility>
#include <memory> // std::addressof
#include <boost/pfr/detail/sequence_tuple.hpp>
#include <boost/pfr/detail/rvalue_t.hpp>
#include <boost/pfr/detail/size_t_.hpp>

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2018 Adam Butcher, Antony Polukhin
// Copyright (c) 2019-2020 Antony Polukhin
// Copyright (c) 2019-2021 Antony Polukhin
//
// 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)
@@ -39,6 +39,6 @@ struct tie_from_structure_tuple : std::tuple<Elements&...> {
}
};
}}} // boost::pfr::detail
}}} // namespace boost::pfr::detail
#endif // BOOST_PFR_DETAIL_TIE_FROM_STRUCTURE_TUPLE_HPP

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2020 Antony Polukhin.
// Copyright (c) 2019-2021 Antony Polukhin.
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -120,13 +120,13 @@ std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& i
template <class Char, class Traits, class T>
std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& in, io_fields_impl<const T&>&& ) {
static_assert(sizeof(T) && false, "====================> Boost.PFR: Atetmpt to use istream operator on a boost::pfr::io_fields wrapped type T with const qualifier.");
static_assert(sizeof(T) && false, "====================> Boost.PFR: Attempt to use istream operator on a boost::pfr::io_fields wrapped type T with const qualifier.");
return in;
}
template <class Char, class Traits, class T>
std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& in, io_fields_impl<T>&& ) {
static_assert(sizeof(T) && false, "====================> Boost.PFR: Atetmpt to use istream operator on a boost::pfr::io_fields wrapped temporary of type T.");
static_assert(sizeof(T) && false, "====================> Boost.PFR: Attempt to use istream operator on a boost::pfr::io_fields wrapped temporary of type T.");
return in;
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -82,13 +82,13 @@ namespace detail {
///
/// \returns true if lhs is equal to rhs; false otherwise
template <class T, class U>
detail::enable_not_eq_comp_t<T, U> eq(const T& lhs, const U& rhs) noexcept {
constexpr detail::enable_not_eq_comp_t<T, U> eq(const T& lhs, const U& rhs) noexcept {
return boost::pfr::eq_fields(lhs, rhs);
}
/// \overload eq
template <class T, class U>
detail::enable_eq_comp_t<T, U> eq(const T& lhs, const U& rhs) {
constexpr detail::enable_eq_comp_t<T, U> eq(const T& lhs, const U& rhs) {
return lhs == rhs;
}
@@ -97,13 +97,13 @@ detail::enable_eq_comp_t<T, U> eq(const T& lhs, const U& rhs) {
///
/// \returns true if lhs is not equal to rhs; false otherwise
template <class T, class U>
detail::enable_not_ne_comp_t<T, U> ne(const T& lhs, const U& rhs) noexcept {
constexpr detail::enable_not_ne_comp_t<T, U> ne(const T& lhs, const U& rhs) noexcept {
return boost::pfr::ne_fields(lhs, rhs);
}
/// \overload ne
template <class T, class U>
detail::enable_ne_comp_t<T, U> ne(const T& lhs, const U& rhs) {
constexpr detail::enable_ne_comp_t<T, U> ne(const T& lhs, const U& rhs) {
return lhs != rhs;
}
@@ -112,13 +112,13 @@ detail::enable_ne_comp_t<T, U> ne(const T& lhs, const U& rhs) {
///
/// \returns true if lhs is less than rhs; false otherwise
template <class T, class U>
detail::enable_not_lt_comp_t<T, U> lt(const T& lhs, const U& rhs) noexcept {
constexpr detail::enable_not_lt_comp_t<T, U> lt(const T& lhs, const U& rhs) noexcept {
return boost::pfr::lt_fields(lhs, rhs);
}
/// \overload lt
template <class T, class U>
detail::enable_lt_comp_t<T, U> lt(const T& lhs, const U& rhs) {
constexpr detail::enable_lt_comp_t<T, U> lt(const T& lhs, const U& rhs) {
return lhs < rhs;
}
@@ -127,13 +127,13 @@ detail::enable_lt_comp_t<T, U> lt(const T& lhs, const U& rhs) {
///
/// \returns true if lhs is greater than rhs; false otherwise
template <class T, class U>
detail::enable_not_gt_comp_t<T, U> gt(const T& lhs, const U& rhs) noexcept {
constexpr detail::enable_not_gt_comp_t<T, U> gt(const T& lhs, const U& rhs) noexcept {
return boost::pfr::gt_fields(lhs, rhs);
}
/// \overload gt
template <class T, class U>
detail::enable_gt_comp_t<T, U> gt(const T& lhs, const U& rhs) {
constexpr detail::enable_gt_comp_t<T, U> gt(const T& lhs, const U& rhs) {
return lhs > rhs;
}
@@ -142,13 +142,13 @@ detail::enable_gt_comp_t<T, U> gt(const T& lhs, const U& rhs) {
///
/// \returns true if lhs is less or equal to rhs; false otherwise
template <class T, class U>
detail::enable_not_le_comp_t<T, U> le(const T& lhs, const U& rhs) noexcept {
constexpr detail::enable_not_le_comp_t<T, U> le(const T& lhs, const U& rhs) noexcept {
return boost::pfr::le_fields(lhs, rhs);
}
/// \overload le
template <class T, class U>
detail::enable_le_comp_t<T, U> le(const T& lhs, const U& rhs) {
constexpr detail::enable_le_comp_t<T, U> le(const T& lhs, const U& rhs) {
return lhs <= rhs;
}
@@ -157,13 +157,13 @@ detail::enable_le_comp_t<T, U> le(const T& lhs, const U& rhs) {
///
/// \returns true if lhs is greater or equal to rhs; false otherwise
template <class T, class U>
detail::enable_not_ge_comp_t<T, U> ge(const T& lhs, const U& rhs) noexcept {
constexpr detail::enable_not_ge_comp_t<T, U> ge(const T& lhs, const U& rhs) noexcept {
return boost::pfr::ge_fields(lhs, rhs);
}
/// \overload ge
template <class T, class U>
detail::enable_ge_comp_t<T, U> ge(const T& lhs, const U& rhs) {
constexpr detail::enable_ge_comp_t<T, U> ge(const T& lhs, const U& rhs) {
return lhs >= rhs;
}
@@ -172,13 +172,13 @@ detail::enable_ge_comp_t<T, U> ge(const T& lhs, const U& rhs) {
///
/// \returns std::size_t with hash of the value
template <class T>
detail::enable_not_hashable_t<T> hash_value(const T& value) noexcept {
constexpr detail::enable_not_hashable_t<T> hash_value(const T& value) noexcept {
return boost::pfr::hash_fields(value);
}
/// \overload hash_value
template <class T>
detail::enable_hashable_t<T> hash_value(const T& value) {
constexpr detail::enable_hashable_t<T> hash_value(const T& value) {
return std::hash<T>{}(value);
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -39,7 +39,7 @@ namespace boost { namespace pfr {
/// `R` are the results of calling `std::tie` on first `N` fields of `lhs` and
// `rhs` respectively; `N` is `std::min(tuple_size_v<T>, tuple_size_v<U>)`.
template <class T, class U>
bool eq_fields(const T& lhs, const U& rhs) noexcept {
constexpr bool eq_fields(const T& lhs, const U& rhs) noexcept {
return detail::binary_visit<detail::equal_impl>(lhs, rhs);
}
@@ -50,7 +50,7 @@ namespace boost { namespace pfr {
/// `R` are the results of calling `std::tie` on first `N` fields of `lhs` and
// `rhs` respectively; `N` is `std::min(tuple_size_v<T>, tuple_size_v<U>)`.
template <class T, class U>
bool ne_fields(const T& lhs, const U& rhs) noexcept {
constexpr bool ne_fields(const T& lhs, const U& rhs) noexcept {
return detail::binary_visit<detail::not_equal_impl>(lhs, rhs);
}
@@ -60,7 +60,7 @@ namespace boost { namespace pfr {
/// `R` are the results of calling `std::tie` on first `N` fields of `lhs` and
// `rhs` respectively; `N` is `std::min(tuple_size_v<T>, tuple_size_v<U>)`.
template <class T, class U>
bool gt_fields(const T& lhs, const U& rhs) noexcept {
constexpr bool gt_fields(const T& lhs, const U& rhs) noexcept {
return detail::binary_visit<detail::greater_impl>(lhs, rhs);
}
@@ -71,7 +71,7 @@ namespace boost { namespace pfr {
/// `R` are the results of calling `std::tie` on first `N` fields of `lhs` and
// `rhs` respectively; `N` is `std::min(tuple_size_v<T>, tuple_size_v<U>)`.
template <class T, class U>
bool lt_fields(const T& lhs, const U& rhs) noexcept {
constexpr bool lt_fields(const T& lhs, const U& rhs) noexcept {
return detail::binary_visit<detail::less_impl>(lhs, rhs);
}
@@ -82,7 +82,7 @@ namespace boost { namespace pfr {
/// `R` are the results of calling `std::tie` on first `N` fields of `lhs` and
// `rhs` respectively; `N` is `std::min(tuple_size_v<T>, tuple_size_v<U>)`.
template <class T, class U>
bool ge_fields(const T& lhs, const U& rhs) noexcept {
constexpr bool ge_fields(const T& lhs, const U& rhs) noexcept {
return detail::binary_visit<detail::greater_equal_impl>(lhs, rhs);
}
@@ -93,7 +93,7 @@ namespace boost { namespace pfr {
/// `R` are the results of calling `std::tie` on first `N` fields of `lhs` and
// `rhs` respectively; `N` is `std::min(tuple_size_v<T>, tuple_size_v<U>)`.
template <class T, class U>
bool le_fields(const T& lhs, const U& rhs) noexcept {
constexpr bool le_fields(const T& lhs, const U& rhs) noexcept {
return detail::binary_visit<detail::less_equal_impl>(lhs, rhs);
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,13 +1,35 @@
<!DOCTYPE html>
<!--
Copyright (c) 2014-2021 Antony Polukhin
antoshkka at gmail dot com
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)
-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=../../doc/html/boost_pfr.html">
<title>Boost.PFR</title>
<meta http-equiv="refresh" content="0; url=https://www.boost.org/doc/libs/master/doc/html/boost_pfr.html">
<title>Boost.Stacktrace</title>
<style>
body {
background: #fff;
color: #000;
}
a {
color: #00f;
text-decoration: none;
}
</style>
</head>
<body>
<p>
Redirecting you to <a href="../../doc/html/boost_pfr.html">Boost.PFR</a>
</p>
<p>
Automatic redirection failed, please go to
<a href="https://www.boost.org/doc/libs/master/doc/html/boost_pfr.html">https://www.boost.org/doc/libs/master/doc/html/boost_pfr.html</a>
</p>
<p>
&copy; 2014-2021 Antony Polukhin
</p>
</body>
</html>

View File

@@ -11,5 +11,7 @@
"category": [
"Data",
"Metaprogramming"
]
],
"std": [ "proposal" ],
"cxxstd": "14"
}

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
# Copyright (c) 2016-2020 Antony Polukhin
# Copyright (c) 2016-2021 Antony Polukhin
#
# 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)

64
misc/strip_boost_namespace.sh Executable file
View File

@@ -0,0 +1,64 @@
#!/bin/bash
# Copyright (c) 2021 Antony Polukhin
#
# 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)
echo "***** Making target path"
TARGET_PATH="`dirname \"$0\"`/../../pfr_non_boost"
rm -rf ${TARGET_PATH}/*
mkdir -p ${TARGET_PATH}
TARGET_PATH=`cd "${TARGET_PATH}";pwd`
SOURCE_PATH="`dirname \"$0\"`/.."
SOURCE_PATH=`cd "${SOURCE_PATH}";pwd`
echo "***** Copying from ${SOURCE_PATH} to ${TARGET_PATH}"
cp -rf ${SOURCE_PATH}/* ${TARGET_PATH}
mv ${TARGET_PATH}/include/boost/* ${TARGET_PATH}/include/
rm -rf ${TARGET_PATH}/include/boost
rm -rf ${TARGET_PATH}/test
rm ${TARGET_PATH}/misc/strip_boost_namespace.sh
rm -rf ${TARGET_PATH}/meta
echo "***** Changing sources"
find ${TARGET_PATH} -type f | xargs sed -i 's|namespace boost { ||g'
find ${TARGET_PATH} -type f | xargs sed -i 's|namespace boost {||g'
find ${TARGET_PATH} -type f | xargs sed -i 's|} // namespace boost::| // namespace |g'
find ${TARGET_PATH} -type f | xargs sed -i 's/::boost::pfr/::pfr/g'
find ${TARGET_PATH} -type f | xargs sed -i 's/boost::pfr/pfr/g'
find ${TARGET_PATH} -type f | xargs sed -i 's/BOOST_PFR_/PFR_/g'
find ${TARGET_PATH} -type f | xargs sed -i 's|boost/pfr|pfr|g'
find ${TARGET_PATH}/doc -type f | xargs sed -i 's|boost.pfr.|pfr.|g'
find ${TARGET_PATH}/doc -type f | xargs sed -i 's|Boost.PFR|PFR|g'
sed -i 's|# \[Boost.PFR\](https://boost.org/libs/pfr)|# [PFR](https://apolukhin.github.io/pfr_non_boost/)|g' ${TARGET_PATH}/README.md
echo -n "***** Testing: "
if g++-9 -std=c++17 -DPFR_USE_LOOPHOLE=0 -DPFR_USE_CPP17=1 -I ${TARGET_PATH}/include/ ${TARGET_PATH}/example/motivating_example0.cpp && ./a.out > /dev/null; then
echo -n "OK"
else
echo -n "FAIL"
exit 2
fi
if g++-9 -std=c++17 -DPFR_USE_LOOPHOLE=1 -DPFR_USE_CPP17=0 -I ${TARGET_PATH}/include/ ${TARGET_PATH}/example/motivating_example0.cpp && ./a.out > /dev/null; then
echo -n ", OK"
else
echo -n ", FAIL"
exit 3
fi
if g++-9 -std=c++17 -DPFR_USE_LOOPHOLE=0 -DPFR_USE_CPP17=0 -I ${TARGET_PATH}/include/ ${TARGET_PATH}/example/get.cpp && ./a.out > /dev/null; then
echo -e ", OK"
else
echo -e ", FAIL"
exit 4
fi
rm a.out || :
echo "***** Done"

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2016-2020, Antony Polukhin.
# Copyright (C) 2016-2021 Antony Polukhin.
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -12,7 +12,6 @@ import ../../config/checks/config : requires ;
project
: source-location .
: requirements
<toolset>msvc:<cxxflags>"/std:c++latest"
<define>BOOST_PFR_DETAIL_STRICT_RVALUE_TESTING=1
[ requires cxx14_constexpr ]
;
@@ -39,7 +38,7 @@ explicit compiler_supports_loophole ;
########## END of helpers to detect Loophole trick support
local DISABLE_ON_MSVC = <toolset>msvc:<build>no ;
local DISABLE_ON_MSVC = ; #<toolset>msvc:<build>no ;
local REQUIRE_LOOPHOLE =
[ check-target-builds ../test//compiler_supports_loophole : : <build>no ]
;
@@ -67,7 +66,9 @@ test-suite pfr_tests
;
local BLACKLIST_TESTS_FOR_LOOPHOLE =
constexpr_ops # Loophole is not constexpr usable because of the reinterpret_cast usage
get_const_field # boost::pfr::get gives compile time error on const fields
optional_chrono # boost::pfr::* has problems with std::optional, produces compile time error
template_constructor # Template constructor in one of the fields of the aggregate
tie_anonymous_const_field # boost::pfr::structure_tie gives compile time error on const fields
;
@@ -76,6 +77,7 @@ local BLACKLIST_TESTS_FOR_LOOPHOLE =
# * reflecting a non literal type
# * or calling boost::pfr::get and the result is a user defined structure
local BLACKLIST_TESTS_FOR_CLASSIC =
constexpr_ops
get_const_field
get_non_default_constructible
get_rvalue
@@ -83,6 +85,7 @@ local BLACKLIST_TESTS_FOR_CLASSIC =
issue33
motivating_example0
motivating_example2
optional_chrono
optional_like
read_write_non_literal
template_constructor

View File

@@ -2,7 +2,7 @@
# subject to 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)
#
# Copyright Antony Polukhin 2016-2019.
# Copyright Antony Polukhin 2016-2021.
#
# See https://svn.boost.org/trac/boost/wiki/TravisCoverals for description of this file

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -0,0 +1,21 @@
// Copyright (c) 2021 Denis Mikhailov
// Copyright (c) 2021 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/pfr/core.hpp>
struct A
{};
struct B : A
{
int one;
int two;
};
int main() {
(void)boost::pfr::tuple_size<B>::value; // Must be a compile time error
}

View File

@@ -0,0 +1,20 @@
// Copyright (c) 2021 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/pfr/core.hpp>
struct A {
int zero;
};
struct B : public A {
int one;
int two;
};
int main() {
(void)boost::pfr::tuple_size<B>::value; // Must be a compile time error
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2020 Antony Polukhin
// Copyright (c) 2020-2021 Antony Polukhin
// Copyright (c) 2020 Richard Hodges
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2020 Antony Polukhin
// Copyright (c) 2020-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2020 Antony Polukhin
// Copyright (c) 2020-2021 Antony Polukhin
//
// 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)

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2019 Ilya Kiselev
// Copyright (c) 2019-2020 Antony Polukhin
// Copyright (c) 2019-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -12,6 +12,7 @@ int main() {
<< "BOOST_PFR_USE_CPP17 == " << BOOST_PFR_USE_CPP17 << '\n'
<< "BOOST_PFR_USE_LOOPHOLE == " << BOOST_PFR_USE_LOOPHOLE << '\n'
<< "BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE == " << BOOST_PFR_USE_STD_MAKE_INTEGRAL_SEQUENCE << '\n'
<< "BOOST_PFR_HAS_GUARANTEED_COPY_ELISION == " << BOOST_PFR_HAS_GUARANTEED_COPY_ELISION << '\n'
<< "__cplusplus == " << __cplusplus << '\n'
#ifdef __cpp_structured_bindings
<< "__cpp_structured_bindings == " << __cpp_structured_bindings << '\n'

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -0,0 +1,81 @@
// Copyright (c) 2016-2021 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/pfr/ops.hpp>
#include <boost/pfr/io.hpp>
#include <iostream>
#include <typeinfo>
#include <tuple>
#include <sstream>
#include <set>
#include <string>
#include <boost/config.hpp>
#include <boost/core/lightweight_test.hpp>
#ifdef __clang__
# pragma clang diagnostic ignored "-Wmissing-braces"
#endif
union test_union {
int i;
float f;
};
constexpr bool operator< (test_union l, test_union r) noexcept { return l.i < r.i; }
constexpr bool operator<=(test_union l, test_union r) noexcept { return l.i <= r.i; }
constexpr bool operator> (test_union l, test_union r) noexcept { return l.i > r.i; }
constexpr bool operator>=(test_union l, test_union r) noexcept { return l.i >= r.i; }
constexpr bool operator==(test_union l, test_union r) noexcept { return l.i == r.i; }
constexpr bool operator!=(test_union l, test_union r) noexcept { return l.i != r.i; }
template <class T>
void test_constexpr_comparable() {
using namespace boost::pfr;
constexpr T s1 {110, 1, true, 6,17,8,9,10,11};
constexpr T s2 = s1;
constexpr T s3 {110, 1, true, 6,17,8,9,10,11111};
static_assert(eq(s1, s2), "");
static_assert(le(s1, s2), "");
static_assert(ge(s1, s2), "");
static_assert(!ne(s1, s2), "");
static_assert(!eq(s1, s3), "");
static_assert(ne(s1, s3), "");
static_assert(lt(s1, s3), "");
static_assert(gt(s3, s2), "");
static_assert(le(s1, s3), "");
static_assert(ge(s3, s2), "");
}
namespace foo {
struct comparable_struct {
int i; short s; bool bl; int a,b,c,d,e,f;
};
}
int main() {
// MSVC fails to use strucutred bindings in constexpr:
//
// error C2131: expression did not evaluate to a constant
// pfr/detail/functional.hpp(21): note: failure was caused by a read of a variable outside its lifetime
#if !defined(_MSC_VER) || (_MSC_VER >= 1927) || !BOOST_PFR_USE_CPP17
test_constexpr_comparable<foo::comparable_struct>();
struct local_comparable_struct {
int i; short s; bool bl; int a,b,c,d,e,f;
};
test_constexpr_comparable<local_comparable_struct>();
struct local_comparable_struct_with_union {
int i; short s; bool bl; int a,b,c,d,e; test_union u;
};
test_constexpr_comparable<local_comparable_struct>();
#endif
return boost::report_errors();
}

View File

@@ -1,5 +1,5 @@
// Copyright (c) 2018 Adam Butcher, Antony Polukhin
// Copyright (c) 2019-2020 Antony Polukhin
// Copyright (c) 2019-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -54,6 +54,8 @@ struct simple {
short d;
};
struct empty{};
int main () {
std::size_t control = 0;
@@ -108,6 +110,13 @@ int main () {
ss << val << ' ';
});
BOOST_TEST_EQ("42 a 3 ", ss.str());
ss.str("");
boost::pfr::for_each_field(empty{}, [&ss](auto&& val) {
ss << val << ' ';
});
BOOST_TEST_EQ("", ss.str());
ss.str("");
return boost::report_errors();
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -73,7 +73,7 @@ void test_empty_struct() {
namespace foo {
struct testing { bool b1, b2; int i; };
BOOST_PFR_FUNCTIONS_FOR(testing);
BOOST_PFR_FUNCTIONS_FOR(testing)
}
template <class Comparator>

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2020 Antony Polukhin
// Copyright (c) 2020-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2020 Antony Polukhin
// Copyright (c) 2020-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)
@@ -18,6 +18,12 @@ struct Message2 {
std::unique_ptr<int> data42 = std::make_unique<int>(42);
};
// Example from duplicate issue #45
struct UniquePtr {
std::unique_ptr<int> a;
};
static_assert (boost::pfr::tuple_size_v<UniquePtr> == 1, "");
int main() {
Message message;
auto& ptr = boost::pfr::get<0>(message);

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

45
test/run/non_movable.cpp Normal file
View File

@@ -0,0 +1,45 @@
// Copyright (c) 2018-2021 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/pfr/tuple_size.hpp>
#include <boost/core/lightweight_test.hpp>
struct X {
X() = default;
X(X&&) = delete;
X(const X&) = delete;
X& operator=(X&&) = delete;
X& operator=(const X&) = delete;
};
struct S { X x0; X x1; int x2; X x3; };
int main() {
#if BOOST_PFR_HAS_GUARANTEED_COPY_ELISION
static_assert(boost::pfr::tuple_size_v<S> == 4, "");
struct S5_0 { int x0; int x1; int x2; int x3; X x4; };
static_assert(boost::pfr::tuple_size_v<S5_0> == 5, "");
struct S5_1 { X x0; int x1; int x2; int x3; int x4; };
static_assert(boost::pfr::tuple_size_v<S5_1> == 5, "");
struct S5_2 { int x0; int x1; X x2; int x3; int x4; };
static_assert(boost::pfr::tuple_size_v<S5_2> == 5, "");
struct S5_3 { int x0; int x1; X x2; int x3; X x4; };
static_assert(boost::pfr::tuple_size_v<S5_3> == 5, "");
struct S5_4 { X x0; X x1; X x2; X x3; X x4; };
static_assert(boost::pfr::tuple_size_v<S5_4> == 5, "");
struct S6 { X x0; X x1; X x2; X x3; X x4; X x5;};
static_assert(boost::pfr::tuple_size_v<S6> == 6, "");
#endif // #if BOOST_PFR_HAS_GUARANTEED_COPY_ELISION
return boost::report_errors();
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2018-2020 Antony Polukhin
// Copyright (c) 2018-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -0,0 +1,78 @@
// Copyright (c) 2020-2021 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/core/lightweight_test.hpp>
#include <boost/pfr/core.hpp>
#include <chrono>
#include <optional>
// This class mimics libc++ implementation of std::chrono::duration with unfxed LWG3050
template <class Rep, class Period>
class bogus_duration {
public:
bogus_duration() = default;
template <class T>
explicit bogus_duration(const T& val,
typename std::enable_if<
std::is_convertible<T, Rep>::value // <= libstdc++ fix for LWG3050 is 's/T/const T&/g'
>::type* = nullptr)
: rep_(val)
{}
template <class Rep2, class Period2>
bogus_duration(const bogus_duration<Rep2, Period2>& val,
typename std::enable_if<std::is_convertible<Period2, Rep>::value>::type* = nullptr)
: rep_(val)
{}
Rep get_rep() const { return rep_; }
private:
Rep rep_{0};
};
struct struct_with_bogus_duration {
std::optional<bogus_duration<long, char>> d0;
std::optional<bogus_duration<long, char>> d1;
};
struct struct_with_optional {
std::optional<std::chrono::seconds> a;
std::optional<std::chrono::milliseconds> b;
std::optional<std::chrono::microseconds> c;
std::optional<std::chrono::nanoseconds> d;
std::optional<std::chrono::steady_clock::duration> e;
std::optional<std::chrono::system_clock::duration> f;
};
int main() {
struct_with_optional val{
std::chrono::seconds{1},
std::chrono::seconds{2},
std::chrono::seconds{3},
std::chrono::seconds{4},
std::chrono::seconds{5},
std::chrono::seconds{6},
};
using boost::pfr::get;
BOOST_TEST(get<0>(val) == std::chrono::seconds{1});
BOOST_TEST(get<1>(val) == std::chrono::seconds{2});
BOOST_TEST(get<2>(val) == std::chrono::seconds{3});
BOOST_TEST(get<3>(val) == std::chrono::seconds{4});
BOOST_TEST(get<3>(val) > std::chrono::seconds{0});
BOOST_TEST(get<3>(val) > std::chrono::seconds{0});
struct_with_bogus_duration val2{bogus_duration<long, char>{1}, bogus_duration<long, char>{2}};
BOOST_TEST(get<0>(val2)->get_rep() == 1);
BOOST_TEST(get<1>(val2)->get_rep() == 2);
return boost::report_errors();
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -38,7 +38,6 @@ void test_type(const T& value, const char* ethalon) {
int main() {
#if !defined(_MSC_VER) /* TODO: remove after fixing strange errors https://ci.appveyor.com/project/apolukhin/magic-get/build/1.65.108-develop */
struct test4 {
int f0;
std::string f1;
@@ -67,7 +66,6 @@ int main() {
"{1, \"my o my\", 3, 4, \"hello there!\"}"
);
#endif
#endif
return boost::report_errors();
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2020 Antony Polukhin.
// Copyright (c) 2019-2021 Antony Polukhin.
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2020 Antony Polukhin
// Copyright (c) 2019-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2019-2020 Antony Polukhin
// Copyright (c) 2019-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2020 Antony Polukhin
// Copyright (c) 2020-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2020 Antony Polukhin
// Copyright (c) 2020-2021 Antony Polukhin
//
// 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)

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)
@@ -12,5 +12,8 @@ int main() {
struct with_reference { int& i; char data; };
static_assert(boost::pfr::tuple_size_v<with_reference> == 2, "");
struct empty {};
static_assert(boost::pfr::tuple_size_v<empty> == 0, "");
}

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2016-2020 Antony Polukhin
// Copyright (c) 2016-2021 Antony Polukhin
//
// 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)