Compare commits

..

104 Commits

Author SHA1 Message Date
Peter Dimov e8cb128f99 Merge pull request #115 from Lastique/feature/remove_static_assert
Remove dependencies on Boost.StaticAssert
2026-04-25 20:51:34 +03:00
Andrey Semashev 5e1fe395b6 Remove dependencies on Boost.StaticAssert.
Boost.StaticAssert has been merged into Boost.Config, so remove
the dependency.
2026-01-22 22:52:11 +03:00
Antony Polukhin fdf2c0f646 Update copyright years 2026-01-04 11:27:21 +03:00
dependabot[bot] 0d822a9b73 Bump actions/checkout from 2 to 6 (#114)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-29 12:31:14 +03:00
Antony Polukhin cf72f05cef Add dependabot 2025-12-24 20:23:02 +03:00
Antony Polukhin 9738f5733b CI fixes (#113) 2025-09-13 13:52:35 +03:00
Alexander Grund a803f3f1dd Update Link to regression test matrix in README (#112) 2025-08-26 13:00:54 +03:00
Antony Polukhin 1fd7271d2e Update copyright years 2025-01-08 19:52:10 +03:00
Antony Polukhin 36fc992f51 Do not test on MinGW 32-bit any more 2024-12-19 18:56:14 +03:00
René Ferdinand Rivera Morell 0fd179fbd8 Add support for modular build structure. (#111)
This is part of the effort to make the Boost libraries "modular" for build and consumption. See https://lists.boost.org/Archives/boost/2024/01/255704.php and https://github.com/grafikrobot/boost-b2-modular/blob/b2-modular/README.adoc for more information.

This PR depends on the following other PRs being merged to both develop and master branches of the respective repos:

- https://github.com/boostorg/boost/pull/854
2024-08-24 12:40:30 +03:00
Antony Polukhin b33ff4f811 Remove obsolete code (#109) 2024-01-08 20:13:32 +03:00
Antony Polukhin e37df948d7 Update copyright years 2024-01-07 12:56:27 +03:00
Andrey Semashev 9d1e62f33c Remove deprecated boost/swap.hpp include. (#108)
This header is deprecated and will be removed. There is
boost/core/invoke_swap.hpp as a replacement, but it isn't needed in this case.
2023-09-03 11:23:14 +03:00
Antony Polukhin 7b45064ed8 Drop C++03 support (#107)
Drop boost::move and boost::bind dependencies. Use Boost.PP in less cases
2023-08-25 16:02:34 +03:00
Antony Polukhin d48711fb84 update CI 2023-05-22 09:18:54 +03:00
Antony Polukhin a3368f0cf8 add C++03 deprecation warnings 2023-05-14 20:10:13 +03:00
Antony Polukhin e4447e892f Update copyright years 2023-01-19 10:24:10 +03:00
Antony Polukhin db54469549 Merge pull request #105 from fanquake/core_addressof
refactor: use core/addressof over utility/addressof
2023-01-17 15:29:41 +03:00
fanquake 8bad74942d refactor: use core/addressof over utility/addressof
The later is deprecated.
2022-12-07 16:23:37 +00:00
Antony Polukhin 78856c049d Remove MacOS run from CI as it almost always hits CI limits 2022-09-02 19:18:52 +03:00
Antony Polukhin 738e53c83b Update CI 2022-09-02 17:47:11 +03:00
Antony Polukhin 40621b1256 fix c++03 compilation 2022-09-02 16:24:24 +03:00
Antony Polukhin bab78044e4 add tests from #100 2022-09-01 14:20:47 +03:00
Antony Polukhin 73753b3d9e avoid recursive inclusion of multivisitors_cpp14_based.hpp
Fixes #101
2022-09-01 11:21:55 +03:00
Antony Polukhin a104ef5f8a Merge pull request #96 from fanquake/core_checked_delete
refactor: use core/checked_delete over checked_delete
2022-08-31 21:40:54 +03:00
Antony Polukhin edec2ffb3b Merge pull request #98 from ecatmur/patch-1
clang/c++23: disable converting move assignment
2022-08-31 21:38:26 +03:00
Ed Catmur 70ff3706c5 clang/c++23: disable converting move assignment
Workaround https://github.com/boostorg/variant/issues/97
2022-06-29 12:36:16 +01:00
fanquake 281c1791b1 refactor: use core/checked_delete over checked_delete
The later has been deprecated:
```cpp

// The header file at this path is deprecated;
// use boost/core/checked_delete.hpp instead.

```
2022-04-08 14:48:21 +01:00
Antony Polukhin d2fdf2384b update copyright years 2022-01-30 15:03:18 +03:00
Antony Polukhin 18853a6bfb disable fusion_interop test for compilers with no variadic templates 2021-09-20 22:08:50 +03:00
Antony Polukhin 2d490e74bf update the Readme 2021-09-20 21:44:48 +03:00
Antony Polukhin 445d790b2f add a test for trac issue 8721 2021-09-20 20:27:43 +03:00
Antony Polukhin 39d38baf29 remove outdated CI scripts 2021-09-20 20:14:39 +03:00
Antony Polukhin fce20c67fb simplify test to produce smaller binary 2021-09-20 18:03:27 +03:00
Antony Polukhin a8e42245e1 fix b2 warning 2021-09-20 18:02:42 +03:00
Antony Polukhin afe0914af5 disable test that is broken since C++20 2021-09-20 13:30:23 +03:00
Antony Polukhin 15f2eefbc4 Update ci.yml 2021-09-13 13:57:34 +03:00
Peter Dimov 4962a5307c Update CMakeLists.txt 2021-06-10 00:44:42 +03:00
Antony Polukhin d80cb48f02 fix issues found by inspect tool 2021-04-26 21:44:35 +03:00
Antony Polukhin 95ddf424e5 update CI from Boost.Conversion 2021-04-26 21:44:05 +03:00
Antony Polukhin 2969e124bc Merge pull request #91 from sdarwin/githubactions
GitHub Actions config
2021-04-18 14:10:16 +03:00
sdarwin 3a46150c0f Add GitHub Actions config [ci skip] 2021-03-04 18:23:02 +00:00
Antony Polukhin 8942489244 Merge pull request #89 from sdarwin/drone
Drone config
2021-01-27 10:30:36 +03:00
Antony Polukhin 5f90f71e1b Merge pull request #88 from eldiener/develop
[skip ci] Add "cxxstd" json field
2021-01-27 10:24:40 +03:00
sdarwin 4c9b00be1a add drone config [ci skip] 2021-01-26 15:29:55 +00:00
Edward Diener 945331a312 [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. 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. 2021-01-20 02:57:30 -05:00
Antony Polukhin dcaa5ba5ef Specify address model for MSVC
Relates boostorg/build#659
2021-01-04 11:06:38 +03:00
Antony Polukhin 9221b1513c update copyright years 2021-01-03 20:10:23 +03:00
Antony Polukhin 688a7db652 Merge pull request #87 from sdarwin/lcov
update lcov in .travis.yml
2021-01-03 12:49:52 +03:00
sdarwin 8da93b3259 update lcov in .travis.yml 2020-12-31 00:29:18 +00:00
Antony Polukhin 5e989572ae Merge pull request #83 from camolezi/camolezi-missing-include
Added missing <tuple> include
2020-07-29 19:17:54 +03:00
Lucas Camolezi b948c1a486 Added missing <tuple> include
This makes the header able to be built standalone, making possible C++ clang modules builds.
2020-07-24 11:03:10 -03:00
Antony Polukhin 03035b2f6b Fix wrong usage of boost::move (fixes #53, #82) 2020-07-23 15:28:07 +03:00
Antony Polukhin 5bd7870560 Merge pull request #81 from vgvassilev/patch-1
Add missing include
2020-07-19 10:43:24 +03:00
Vassil Vassilev 9bd4ae5684 Add missing include
Allow header file to be built standalone, in a clang C++ modules context.
2020-07-19 02:45:36 +03:00
Antony Polukhin 619d3dcc0f Merge pull request #80 from Lastique/fix_deprecated_headers
Update header locations to avoid warnings about using deprecated headers
2020-05-13 12:55:30 +03:00
Andrey Semashev 351b812267 Updated header locations to avoid warnings about using deprecated headers.
The warnings are generated by no_exceptions_support.hpp. While at it, this
commit also updates locations of several other headers that were moved and
don't generate warnings (yet).

Deprecated headers will be removed in a future release.
2020-05-11 17:28:26 +03:00
Antony Polukhin 2605aa4bff Apply BOOST_OVERRIDE to boost::bad_get::what() and boost::bad_visit::what() (fixes #78) 2020-05-05 20:22:58 +03:00
Antony Polukhin 167b5ff373 Merge pull request #79 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74
2020-05-02 07:54:57 +03:00
Edward Diener 1fa5aa0e0a Merge branch 'develop' of https://github.com/eldiener/variant into cppbuilder 2020-04-08 20:45:11 -04:00
Antony Polukhin 5cbe9b7e19 CI fixes 2020-04-06 11:45:47 +03:00
Antony Polukhin 38bc003df0 Update .travis.yml 2020-04-06 01:41:02 +03:00
Antony Polukhin a816eb6202 Diagnose CI issue 2020-04-05 16:12:51 +03:00
Antony Polukhin 1ba33a580e Merge pull request #77 from BartSiwek/fix_zero_as_null_pointer_constant
Fix GCC zero-as-null-pointer-constat warnings
2020-04-03 13:35:51 +03:00
Edward Diener a3f266706b Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-31 22:52:39 -04:00
Bart Siwek 74a9d7691c Fix GCC zero-as-null-pointer-constat warnings 2020-03-28 11:42:56 +01:00
Antony Polukhin bee77d42a8 update copyright year 2020-01-11 19:35:53 +03:00
Antony Polukhin 206d1d2bb2 Merge pull request #74 from Kojoley/remove-unused-includes
Remove unused includes
2019-12-02 07:21:33 +03:00
Nikita Kniazev 93c21189e6 Remove unused includes 2019-12-01 19:06:41 +03:00
Antony Polukhin c401edba70 fix typos 2019-06-28 22:44:06 +03:00
Antony Polukhin f34376e115 Merge pull request #66 from Kojoley/partly-mitigate-bad-clang-inlining-decision
Partly mitigate bad Clang inlining decision
2019-05-09 10:01:59 +03:00
Antony Polukhin 15a846fba0 CI fixes 2019-05-02 10:45:09 +03:00
Antony Polukhin 8f52f879b5 CI scripts update to deal with container changes 2019-05-02 10:44:06 +03:00
Antony Polukhin 3ed28d2cc5 Merge pull request #71 from boostorg/antoshkka/revert-recursive-move
Revert "Merge pull request #59 from Kojoley/recursive_wrapper-move-co…
2019-05-02 10:32:31 +03:00
Antony Polukhin b18c22a8ff Revert "Merge pull request #59 from Kojoley/recursive_wrapper-move-constructor-pointer-stealing"
This reverts commit dcbfeb9892, reversing
changes made to 055487c5bb.

Reverts adding a pointer stealing to the recursive_wrapper.
2019-05-01 20:57:40 +03:00
Antony Polukhin 0e122c38fe Merge pull request #67 from HDembinski/fix_warning
fix for unused argument warning
2019-04-23 08:56:28 +03:00
Antony Polukhin 31ed2a3b70 Merge pull request #68 from ecatmur/apply-visitor-copy-cv-ref
Copy variant cvref when determining result type
2019-04-23 08:55:00 +03:00
Ed Catmur 7331d648f4 Add test. 2019-04-21 00:50:00 +01:00
Ed Catmur 2e32903579 Merge remote-tracking branch 'origin/develop' into apply-visitor-copy-cv-ref 2019-04-20 22:22:12 +01:00
Antony Polukhin 5be655d46f Update appveyor.yml 2019-04-17 21:23:36 +03:00
Edward Catmur cbdb354a27 Copy variant cvref when determining result type
Ensures that we can e.g. call apply_visitor on a lvalue variant
2019-04-17 15:05:37 +01:00
Antony Polukhin b1d66215e1 Update appveyor.yml 2019-04-14 21:58:31 +03:00
Hans Dembinski 66ef97f655 fix_warning 2019-04-14 14:02:19 +02:00
Nikita Kniazev dd9b0c9b84 Partly mitigate bad Clang inlining decision
Because a visitor is wrapped several times during visitation it cases extra
temporaries usage and useless store and loads that can only be optimized if
the `visitation_impl` is inlined into the function that creates the wrapper.
Clang inliner decides not to inline functions even with small-sized switches,
resulting in a poor visitation code. Forceinline mark on those internal functions perceptibly improves the situation, though does not mitigate it
completely.

LLVM ticket https://bugs.llvm.org/show_bug.cgi?id=41491
2019-04-14 04:26:31 +03:00
Antony Polukhin 74ea828cde Merge pull request #65 from boostorg/feature/std-hash
Add std::hash specialization for variant (refs #49)
2019-04-12 10:55:46 +03:00
Antony Polukhin 7cc18f356c Merge pull request #63 from Kojoley/do-not-call-abort
Do not call abort in forced_return
2019-04-12 10:54:17 +03:00
Antony Polukhin dcbfeb9892 Merge pull request #59 from Kojoley/recursive_wrapper-move-constructor-pointer-stealing
recursive_wrapper move constructor pointer stealing
2019-04-12 10:52:35 +03:00
Antony Polukhin 055487c5bb Avoid git clone issues 2019-04-02 09:23:59 +03:00
Antony Polukhin 31dcc43faf Add std::hash specialization for variant (refs #49) 2019-04-01 23:45:21 +03:00
Antony Polukhin c80759d265 Merge pull request #64 from Kojoley/suppress-warnings-in-tests
Suppress warnings in tests
2019-03-27 10:19:55 +03:00
Nikita Kniazev e20f5eb7b8 Suppress warnings in tests 2019-03-26 17:43:32 +03:00
Nikita Kniazev 3cc73fe162 Do not call abort in forced_return
Reduces code bloating on Clang and MSVC, saves a branch on GCC.
2019-03-26 04:46:43 +03:00
Antony Polukhin 7ecf721f2b Merge pull request #62 from gjasny/static-visitor-public-dtor
static_visitor: Make destructor public
2019-03-16 17:59:28 +03:00
Antony Polukhin 90e7fbae48 Merge pull request #61 from Mike-Devel/min_cmake
[CMake] Add minimal cmake support
2019-03-09 21:57:30 +03:00
Gregor Jasny dd728220b0 static_visitor: Make destructor public
otherwise in C++ 17 mode Clang 8 will complain about the
protected destructor:

```
main.cpp:16:33: error: temporary of type 'boost::static_visitor<>' has protected destructor
    boost::apply_visitor(output{}, v);
                                ^
/usr/local/opt/boost/include/boost/variant/static_visitor.hpp:53:5: note: declared protected here
    ~static_visitor() = default;
    ^
```

See also discussion in https://reviews.llvm.org/D53860
2019-03-09 15:25:03 +01:00
Mike Dev 98e2674467 [CMake] Add minimal cmake support
- CMake file only supports add_subdirectory workflow.
- Provides target Boost::variant, but
  no installation and no unit tests
2019-03-08 16:23:41 +01:00
Nikita Kniazev 5c10399096 Added note about pointer stealing to never-empty guarantee design docs 2019-03-04 01:49:35 +03:00
Nikita Kniazev 11d03f3b51 Added macro to docs 2019-02-24 03:42:11 +03:00
Nikita Kniazev df4e29cf1e Use boost type_traits 2019-02-24 01:44:02 +03:00
Nikita Kniazev 32794c2340 More work done 2019-02-24 00:21:54 +03:00
Nikita Kniazev 754eaf824f Updated the documentation 2019-02-16 18:55:42 +03:00
Nikita Kniazev af07139502 refine precondition check to a function 2019-02-09 16:20:26 +03:00
Nikita Kniazev 3e93fd428c followup to recursive_wrapper pointer stealing
- Added macro to switch to the old behavior
  - Added valueless_recursive method
  - Removed nullptr and exchange

TODO:
  - Docs
2019-02-08 20:19:21 +03:00
Nikita Kniazev 1364d3ff5f recursive_wrapper move constructor pointer stealing
Instead of allocating a new object just steal the pointer from the other
recursive_wrapper. It is much cheaper and allows to mark the move constructor
noexcept (allows variant to move the object without backup copying it).
2019-01-31 21:15:10 +03:00
73 changed files with 709 additions and 1562 deletions
+11
View File
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
+168
View File
@@ -0,0 +1,168 @@
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-12
cxxstd: "03,11,14,17,2a"
os: ubuntu-22.04
cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined"
linkflags: "linkflags=--coverage -lasan -lubsan"
gcov_tool: "gcov-12"
launcher: "testing.launcher=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.8"
- toolset: gcc-11
cxxstd: "03,11,14,17,2a"
os: ubuntu-22.04
cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined"
linkflags: "linkflags=--coverage -lasan -lubsan"
gcov_tool: "gcov-11"
launcher: "testing.launcher=LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.7"
- toolset: clang
compiler: clang++
cxxstd: "03,11,14,17,2a"
os: ubuntu-24.04
cxxflags: "cxxflags=-fsanitize=address,undefined,integer -fno-sanitize-recover=undefined"
linkflags: "linkflags=-fsanitize=address,undefined,integer"
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v6
- name: Install packages
if: matrix.install
run: sudo apt install ${{matrix.install}}
- name: Setup Boost
run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${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
- 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: 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.16.zip
unzip v1.16.zip
LCOV="`pwd`/lcov-1.16/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
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2022
- toolset: msvc
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2025
- toolset: gcc
cxxstd: "03,11,14,17,2a"
addrmd: 64
os: windows-2025
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v6
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 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
-156
View File
@@ -1,156 +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-2019.
#
# 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
sudo: false
language: cpp
os: linux
env:
global:
# 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=''
# boost-local/libs/ folder to put this library into. This may be useful, if you're for example running Travis
# from `Boost.DLL` repo while Boost already has `dll` and with to replace `dll` with content of`Boost.DLL`.
#
# Otherwise just leave the default value - BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR)
- BOOST_LIBS_FOLDER=$(basename $TRAVIS_BUILD_DIR)
# Global options for sanitizers
- UBSAN_OPTIONS=print_stacktrace=1
- LSAN_OPTIONS=verbosity=1:log_threads=1
# `--coverage` flags required to generate coverage info for Coveralls
matrix:
include:
- env: B2_ARGS='cxxstd=98,03,11,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=98,03,11,14,1z 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=98,0x toolset=gcc-4.6 cxxflags="--coverage -DBOOST_TRAVISCI_BUILD" linkflags="--coverage"'
name: "GCC-4.6"
addons:
apt:
sources: ubuntu-toolchain-r-test
packages: g++-4.6
# - env: B2_ARGS='cxxstd=98,03,11,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=98,03,11,14,1z toolset=clang-5 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -fsanitize=address,leak,undefined"'
name: "Clang-5"
sudo: required # Required by leak sanitizer
addons:
apt:
sources: llvm-toolchain-trusty-5.0
packages: clang-5.0
- env: B2_ARGS='cxxstd=03,11,14 toolset=clang-libc++ cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -fsanitize=address,leak,undefined"'
name: "Clang-3.8, libc++"
sudo: required # Required by leak sanitizer
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:
# Cloning minimal set of Boost libraries
- BOOST=$HOME/boost-local
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git $BOOST
- cd $BOOST
- git submodule update --init --depth 1 tools/build tools/boostdep
# Replacing Boost module with this project and installing Boost dependencies
- echo "Testing $BOOST/libs/$BOOST_LIBS_FOLDER moved from $TRAVIS_BUILD_DIR, branch $BOOST_BRANCH"
- rm -rf $BOOST/libs/$BOOST_LIBS_FOLDER || true
- mv $TRAVIS_BUILD_DIR $BOOST/libs/$BOOST_LIBS_FOLDER
- python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST_LIBS_FOLDER
- 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.0 ;" >> ~/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 --gcov-tool gcov-6"
# 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
+27
View File
@@ -0,0 +1,27 @@
# Copyright 2019 Mike Dev
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required( VERSION 3.5...3.20 )
project( boost_variant VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX )
add_library( boost_variant INTERFACE )
add_library( Boost::variant ALIAS boost_variant )
target_include_directories( boost_variant INTERFACE include )
target_link_libraries( boost_variant
INTERFACE
Boost::assert
Boost::config
Boost::container_hash
Boost::core
Boost::detail
Boost::integer
Boost::mpl
Boost::preprocessor
Boost::throw_exception
Boost::type_index
Boost::type_traits
Boost::utility
)
+6 -6
View File
@@ -1,16 +1,16 @@
# [Boost.Variant](http://boost.org/libs/variant)
Boost.Variant, part of collection of the [Boost C++ Libraries](http://github.com/boostorg). It is a safe, generic, stack-based discriminated union container, offering a simple solution for manipulating an object from a heterogeneous set of types in a uniform manner.
# [Boost.Variant](https://boost.org/libs/variant)
Boost.Variant, part of collection of the [Boost C++ Libraries](https://github.com/boostorg). It is a safe, generic, stack-based discriminated union container, offering a simple solution for manipulating an object from a heterogeneous set of types in a uniform manner.
### Test results
@ | Build | Tests coverage | More info
----------------|-------------- | -------------- |-----------
Develop branch: | [![Build Status](https://travis-ci.org/boostorg/variant.svg?branch=develop)](https://travis-ci.org/boostorg/variant) [![Build status](https://ci.appveyor.com/api/projects/status/bijfdoy7byfgc6e2/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/variant-ykfti/branch/develop) | [![Coverage Status](https://coveralls.io/repos/boostorg/variant/badge.png?branch=develop)](https://coveralls.io/r/apolukhin/variant?branch=develop) | [details...](http://www.boost.org/development/tests/develop/developer/variant.html)
Master branch: | [![Build Status](https://travis-ci.org/boostorg/variant.svg?branch=master)](https://travis-ci.org/boostorg/variant) [![Build status](https://ci.appveyor.com/api/projects/status/bijfdoy7byfgc6e2/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/variant-ykfti/branch/master) | [![Coverage Status](https://coveralls.io/repos/boostorg/variant/badge.png?branch=master)](https://coveralls.io/r/apolukhin/variant?branch=master) | [details...](http://www.boost.org/development/tests/master/developer/variant.html)
Develop branch: | [![CI](https://github.com/boostorg/variant/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/variant/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/bijfdoy7byfgc6e2/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/variant-ykfti/branch/develop) | [![Coverage Status](https://coveralls.io/repos/boostorg/variant/badge.png?branch=develop)](https://coveralls.io/r/apolukhin/variant?branch=develop) | [details...](https://regression.boost.io/develop/developer/variant.html)
Master branch: | [![CI](https://github.com/boostorg/variant/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/variant/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/bijfdoy7byfgc6e2/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/variant-ykfti/branch/master) | [![Coverage Status](https://coveralls.io/repos/boostorg/variant/badge.png?branch=master)](https://coveralls.io/r/apolukhin/variant?branch=master) | [details...](https://regression.boost.io/master/developer/variant.html)
[Open Issues](https://svn.boost.org/trac/boost/query?status=!closed&component=variant)
[Latest developer documentation](https://www.boost.org/doc/libs/develop/doc/html/variant.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).
+34
View File
@@ -0,0 +1,34 @@
# Copyright René Ferdinand Rivera Morell 2023-2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
constant boost_dependencies :
/boost/assert//boost_assert
/boost/config//boost_config
/boost/container_hash//boost_container_hash
/boost/core//boost_core
/boost/detail//boost_detail
/boost/integer//boost_integer
/boost/mpl//boost_mpl
/boost/preprocessor//boost_preprocessor
/boost/throw_exception//boost_throw_exception
/boost/type_index//boost_type_index
/boost/type_traits//boost_type_traits
/boost/utility//boost_utility ;
project /boost/variant
: common-requirements
<include>include
;
explicit
[ alias boost_variant : : : : <library>$(boost_dependencies) ]
[ alias all : boost_variant test ]
;
call-if : boost-library variant
;
+2 -5
View File
@@ -3,7 +3,7 @@
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<!--
Copyright 2003, Eric Friedman, Itay Maman.
Copyright 2013-2019 Antony Polukhin.
Copyright 2013-2026 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)
@@ -91,8 +91,6 @@
<code><functionname>apply_visitor</functionname></code> on the
stored visitor using the given operands.</simpara>
</description>
<notes>Version with variadic templates is used by default if
<macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname> is not defined.</notes>
</overloaded-method>
</method-group>
</class>
@@ -111,8 +109,7 @@
<simpara>See <code><classname>apply_visitor_delayed_t</classname></code>
which is used when <code>Visitor</code> has <code>result_type</code>
typedef.</simpara>
<simpara>Available only if macro
<macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname> is not defined and
<simpara>Available only if
compiler supports <code>decltype(auto)</code> and <code>decltype(some-expression)</code>.</simpara>
</description>
+1 -17
View File
@@ -2,7 +2,7 @@
<!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<!--
Copyright 2013-2019 Antony Polukhin.
Copyright 2013-2026 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)
@@ -13,22 +13,6 @@
<para>Provides declarations of <functionname>apply_visitor</functionname> for three or more
<code><classname>variant</classname></code> parameters.</para>
<macro name="BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS">
<purpose>
<simpara>Controls maximum amount of <code><classname>variant</classname></code>
parameters for multi visistors. Not used when <code>std::tuple</code> is available and
<code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname></code>
is not defined.</simpara>
</purpose>
<description>
<para><emphasis role="bold">Note</emphasis>: Default amount is 4. Define it
to bigger value before including &lt;boost/variant/multivisitors.hpp&gt; to
increase maximum amount of <code><classname>variant</classname></code>
parameters for <functionname>apply_visitor</functionname>.</para>
</description>
</macro>
<namespace name="boost">
<overloaded-function name="apply_visitor /*three or more variant parameters*/">
<description>
+1 -1
View File
@@ -2,7 +2,7 @@
<!DOCTYPE header PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<!--
Copyright 2013-2019 Antony Polukhin.
Copyright 2013-2026 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)
-5
View File
@@ -104,11 +104,6 @@
<listitem><code>Sequence</code> must meet the requirements of
<libraryname>MPL</libraryname>'s <emphasis>Sequence</emphasis>
concept.</listitem>
<listitem>Due to standard conformance problems in several compilers,
<code>make_recursive_variant_over</code> may not be supported on
your compiler. See
<code><macroname>BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT</macroname></code>
for more information.</listitem>
</itemizedlist>
</description>
</class>
-5
View File
@@ -951,11 +951,6 @@
<listitem><code>Sequence</code> must meet the requirements of
<libraryname>MPL</libraryname>'s <emphasis>Sequence</emphasis>
concept.</listitem>
<listitem>Due to standard conformance problems in several compilers,
<code>make_variant_over</code> may not be supported on your
compiler. See
<code><macroname>BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT</macroname></code>
for more information.</listitem>
</itemizedlist>
</description>
</class>
+6 -48
View File
@@ -3,7 +3,7 @@
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<!--
Copyright 2003, Eric Friedman, Itay Maman.
Copyright 2016-2019 Antony Polukhin.
Copyright 2016-2026 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)
@@ -19,36 +19,6 @@
class templates and the <code>boost::recursive_variant_</code> tag type.
Also defines several preprocessor symbols, as described below.</para>
<macro name="BOOST_VARIANT_LIMIT_TYPES">
<purpose>
<simpara>Expands to the length of the
template parameter list for
<code><classname>variant</classname></code>. Not used if
<code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname></code>
is not defined.
</simpara>
</purpose>
<description>
<para><emphasis role="bold">Note</emphasis>: Conforming
implementations of <code>variant</code> must allow at least ten
template arguments. That is, BOOST_VARIANT_LIMIT_TYPES must be greater
or equal to <code>10</code>.</para>
</description>
</macro>
<macro name="BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES">
<purpose>
<simpara>If this macro is defined, then library won't use C++11 variadic templates.
Users may define this macro to make
<code><macroname>BOOST_VARIANT_ENUM_PARAMS</macroname></code>
and <code><macroname>BOOST_VARIANT_ENUM_SHIFTED_PARAMS</macroname></code> expand
to a comma-separated sequence instead of variadic templates. Define this macro if
your compiler has problems with compilation of variadic templates.
</simpara>
</purpose>
</macro>
<macro name="BOOST_VARIANT_ENUM_PARAMS" kind="functionlike">
<macro-parameter name="param"/>
@@ -58,9 +28,7 @@
</purpose>
<description>
<para> When variadic templates are available and
<code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname></code>
is not defined, expands to variadic template list in the following manner:
<para> Expands to variadic template list in the following manner:
<code><programlisting>
BOOST_VARIANT_ENUM_PARAMS(T) => T0, TN...
BOOST_VARIANT_ENUM_PARAMS(class T) => class T0, class... TN
@@ -97,9 +65,7 @@
</purpose>
<description>
<para> When variadic templates are available and
<code><macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname></code>
is not defined, expands to variadic template list in the following manner:
<para> Expands to variadic template list in the following manner:
<code><programlisting>
BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T) => TN...
BOOST_VARIANT_ENUM_SHIFTED_PARAMS(class T) => class... TN
@@ -125,19 +91,11 @@
</description>
</macro>
<macro name="BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT">
<macro name="BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH">
<purpose>
<simpara>Indicates absence of support for specifying the bounded types
of a <code><classname>variant</classname></code> by the elements of a
type sequence.</simpara>
<simpara>Define this macro if you do not wish to have a <code><classname>std::hash</classname></code> specialization for
<code><classname>boost::variant</classname></code>.</simpara>
</purpose>
<description>
<para>Defined only if
<code><classname>make_variant_over</classname></code> and
<code><classname>make_recursive_variant_over</classname></code>
are not supported for some reason on the target compiler.</para>
</description>
</macro>
<macro name="BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT">
+1 -14
View File
@@ -3,7 +3,7 @@
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<!--
Copyright 2003, Eric Friedman, Itay Maman.
Copyright 2013-2019 Antony Polukhin.
Copyright 2013-2026 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)
@@ -90,13 +90,6 @@ typedef <classname>mpl::push_front</classname>&lt; types_initial, int &gt;::type
</para>
<para><emphasis role="bold">Portability</emphasis>: Unfortunately, due to
standard conformance issues in several compilers,
<code>make_variant_over</code> is not universally available. On these
compilers the library indicates its lack of support for the syntax via the
definition of the preprocessor symbol
<code><macroname>BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT</macroname></code>.</para>
</section>
<section id="variant.tutorial.recursive">
@@ -407,12 +400,6 @@ assert(
</programlisting>
</para>
<para>Finally, we must note that multi visitation does not support
&quot;delayed&quot; form of
<code><functionname>apply_visitor</functionname> if
<macroname>BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES</macroname> is defined</code>.
</para>
</section>
+1 -1
View File
@@ -27,7 +27,7 @@
</copyright>
<copyright>
<year>2014-2019</year>
<year>2014-2026</year>
<holder>Antony Polukhin</holder>
</copyright>
<legalnotice>
+3 -1
View File
@@ -13,6 +13,8 @@
#ifndef BOOST_VARIANT_BAD_VISIT_HPP
#define BOOST_VARIANT_BAD_VISIT_HPP
#include <boost/config.hpp>
#include <exception>
namespace boost {
@@ -28,7 +30,7 @@ struct BOOST_SYMBOL_VISIBLE bad_visit
{
public: // std::exception interface
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
{
return "boost::bad_visit: "
"failed visitation using boost::apply_visitor";
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2002-2003 Eric Friedman
// Copyright (c) 2014-2019 Antony Polukhin
// Copyright (c) 2014-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -21,13 +21,10 @@
# include <boost/variant/detail/has_result_type.hpp>
#endif
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
# include <boost/core/enable_if.hpp>
# include <boost/type_traits/is_lvalue_reference.hpp>
# include <boost/type_traits/is_same.hpp>
# include <boost/move/move.hpp>
# include <boost/move/utility.hpp>
#endif
#include <boost/core/enable_if.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
#include <boost/type_traits/is_same.hpp>
#include <utility>
namespace boost {
@@ -64,33 +61,20 @@ public: // structors
public: // visitor interfaces
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Value2>
typename enable_if_c<MoveSemantics && is_same<Value2, Value2>::value, result_type>::type
operator()(Value2&& value2)
{
return visitor_(::boost::move(value1_), ::boost::forward<Value2>(value2));
return visitor_(std::move(value1_), std::forward<Value2>(value2));
}
template <typename Value2>
typename disable_if_c<MoveSemantics && is_same<Value2, Value2>::value, result_type>::type
operator()(Value2&& value2)
{
return visitor_(value1_, ::boost::forward<Value2>(value2));
return visitor_(value1_, std::forward<Value2>(value2));
}
#else
template <typename Value2>
result_type
operator()(Value2& value2)
{
return visitor_(value1_, value2);
}
#endif
private:
apply_visitor_binary_invoke& operator=(const apply_visitor_binary_invoke&);
};
@@ -118,8 +102,6 @@ public: // structors
public: // visitor interfaces
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Value1>
typename enable_if_c<MoveSemantics && is_same<Value1, Value1>::value, result_type>::type
operator()(Value1&& value1)
@@ -130,7 +112,7 @@ public: // visitor interfaces
, ! ::boost::is_lvalue_reference<Value1>::value
> invoker(visitor_, value1);
return boost::apply_visitor(invoker, ::boost::move(visitable2_));
return boost::apply_visitor(invoker, std::move(visitable2_));
}
template <typename Value1>
@@ -146,23 +128,6 @@ public: // visitor interfaces
return boost::apply_visitor(invoker, visitable2_);
}
#else
template <typename Value1>
result_type
operator()(Value1& value1)
{
apply_visitor_binary_invoke<
Visitor
, Value1
, false
> invoker(visitor_, value1);
return boost::apply_visitor(invoker, visitable2_);
}
#endif
private:
apply_visitor_binary_unwrap& operator=(const apply_visitor_binary_unwrap&);
@@ -174,8 +139,6 @@ private:
// nonconst-visitor version:
//
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Visitor, typename Visitable1, typename Visitable2>
inline typename Visitor::result_type
apply_visitor( Visitor& visitor, Visitable1&& visitable1, Visitable2&& visitable2)
@@ -184,29 +147,13 @@ apply_visitor( Visitor& visitor, Visitable1&& visitable1, Visitable2&& visitable
Visitor, Visitable2, ! ::boost::is_lvalue_reference<Visitable2>::value
> unwrapper(visitor, visitable2);
return boost::apply_visitor(unwrapper, ::boost::forward<Visitable1>(visitable1));
return boost::apply_visitor(unwrapper, std::forward<Visitable1>(visitable1));
}
#else
template <typename Visitor, typename Visitable1, typename Visitable2>
inline typename Visitor::result_type
apply_visitor( Visitor& visitor, Visitable1& visitable1, Visitable2& visitable2)
{
::boost::detail::variant::apply_visitor_binary_unwrap<
Visitor, Visitable2, false
> unwrapper(visitor, visitable2);
return boost::apply_visitor(unwrapper, visitable1);
}
#endif
//
// const-visitor version:
//
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Visitor, typename Visitable1, typename Visitable2>
inline typename Visitor::result_type
@@ -216,24 +163,9 @@ apply_visitor( const Visitor& visitor , Visitable1&& visitable1 , Visitable2&& v
const Visitor, Visitable2, ! ::boost::is_lvalue_reference<Visitable2>::value
> unwrapper(visitor, visitable2);
return boost::apply_visitor(unwrapper, ::boost::forward<Visitable1>(visitable1));
return boost::apply_visitor(unwrapper, std::forward<Visitable1>(visitable1));
}
#else
template <typename Visitor, typename Visitable1, typename Visitable2>
inline typename Visitor::result_type
apply_visitor( const Visitor& visitor , Visitable1& visitable1 , Visitable2& visitable2)
{
::boost::detail::variant::apply_visitor_binary_unwrap<
const Visitor, Visitable2, false
> unwrapper(visitor, visitable2);
return boost::apply_visitor(unwrapper, visitable1);
}
#endif
#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
@@ -262,15 +194,15 @@ public: // structors
public: // visitor interfaces
template <typename Value2>
decltype(auto) operator()(Value2&& value2, typename enable_if_c<MoveSemantics && is_same<Value2, Value2>::value>::type* = 0)
decltype(auto) operator()(Value2&& value2, typename enable_if_c<MoveSemantics && is_same<Value2, Value2>::value, bool>::type = true)
{
return visitor_(::boost::move(value1_), ::boost::forward<Value2>(value2));
return visitor_(std::move(value1_), std::forward<Value2>(value2));
}
template <typename Value2>
decltype(auto) operator()(Value2&& value2, typename disable_if_c<MoveSemantics && is_same<Value2, Value2>::value>::type* = 0)
decltype(auto) operator()(Value2&& value2, typename disable_if_c<MoveSemantics && is_same<Value2, Value2>::value, bool>::type = true)
{
return visitor_(value1_, ::boost::forward<Value2>(value2));
return visitor_(value1_, std::forward<Value2>(value2));
}
private:
@@ -294,7 +226,7 @@ public: // structors
public: // visitor interfaces
template <typename Value1>
decltype(auto) operator()(Value1&& value1, typename enable_if_c<MoveSemantics && is_same<Value1, Value1>::value>::type* = 0)
decltype(auto) operator()(Value1&& value1, typename enable_if_c<MoveSemantics && is_same<Value1, Value1>::value, bool>::type = true)
{
apply_visitor_binary_invoke_cpp14<
Visitor
@@ -302,11 +234,11 @@ public: // visitor interfaces
, ! ::boost::is_lvalue_reference<Value1>::value
> invoker(visitor_, value1);
return boost::apply_visitor(invoker, ::boost::move(visitable2_));
return boost::apply_visitor(invoker, std::move(visitable2_));
}
template <typename Value1>
decltype(auto) operator()(Value1&& value1, typename disable_if_c<MoveSemantics && is_same<Value1, Value1>::value>::type* = 0)
decltype(auto) operator()(Value1&& value1, typename disable_if_c<MoveSemantics && is_same<Value1, Value1>::value, bool>::type = true)
{
apply_visitor_binary_invoke_cpp14<
Visitor
@@ -326,27 +258,29 @@ private:
template <typename Visitor, typename Visitable1, typename Visitable2>
inline decltype(auto) apply_visitor(Visitor& visitor, Visitable1&& visitable1, Visitable2&& visitable2,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
::boost::detail::variant::apply_visitor_binary_unwrap_cpp14<
Visitor, Visitable2, ! ::boost::is_lvalue_reference<Visitable2>::value
> unwrapper(visitor, visitable2);
return boost::apply_visitor(unwrapper, ::boost::forward<Visitable1>(visitable1));
return boost::apply_visitor(unwrapper, std::forward<Visitable1>(visitable1));
}
template <typename Visitor, typename Visitable1, typename Visitable2>
inline decltype(auto) apply_visitor(const Visitor& visitor, Visitable1&& visitable1, Visitable2&& visitable2,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
::boost::detail::variant::apply_visitor_binary_unwrap_cpp14<
const Visitor, Visitable2, ! ::boost::is_lvalue_reference<Visitable2>::value
> unwrapper(visitor, visitable2);
return boost::apply_visitor(unwrapper, ::boost::forward<Visitable1>(visitable1));
return boost::apply_visitor(unwrapper, std::forward<Visitable1>(visitable1));
}
@@ -15,7 +15,7 @@
#include <boost/variant/detail/apply_visitor_unary.hpp>
#include <boost/variant/detail/apply_visitor_binary.hpp>
#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
#include <boost/variant/variant_fwd.hpp>
#include <boost/variant/detail/has_result_type.hpp>
@@ -57,8 +57,6 @@ public: // structors
{
}
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
public: // N-ary visitor interface
template <typename... Visitables>
result_type operator()(Visitables&... visitables) const
@@ -66,26 +64,6 @@ public: // N-ary visitor interface
return apply_visitor(visitor_, visitables...);
}
#else // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
public: // unary visitor interface
template <typename Visitable>
result_type operator()(Visitable& visitable) const
{
return apply_visitor(visitor_, visitable);
}
public: // binary visitor interface
template <typename Visitable1, typename Visitable2>
result_type operator()(Visitable1& visitable1, Visitable2& visitable2) const
{
return apply_visitor(visitor_, visitable1, visitable2);
}
#endif // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
private:
apply_visitor_delayed_t& operator=(const apply_visitor_delayed_t&);
@@ -100,8 +78,7 @@ inline typename boost::enable_if<
return apply_visitor_delayed_t<Visitor>(visitor);
}
#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) \
&& !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO)
template <typename Visitor>
class apply_visitor_delayed_cpp14_t
@@ -137,8 +114,7 @@ inline typename boost::disable_if<
return apply_visitor_delayed_cpp14_t<Visitor>(visitor);
}
#endif // !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
// && !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
#endif // !defined(BOOST_NO_CXX14_DECLTYPE_AUTO)
} // namespace boost
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2002-2003 Eric Friedman
// Copyright (c) 2014-2019 Antony Polukhin
// Copyright (c) 2014-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -14,7 +14,7 @@
#define BOOST_VARIANT_DETAIL_APPLY_VISITOR_UNARY_HPP
#include <boost/config.hpp>
#include <boost/move/utility.hpp>
#include <utility>
#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
# include <boost/mpl/distance.hpp>
@@ -23,6 +23,7 @@
# include <boost/mpl/size.hpp>
# include <boost/utility/declval.hpp>
# include <boost/core/enable_if.hpp>
# include <boost/type_traits/copy_cv_ref.hpp>
# include <boost/type_traits/remove_reference.hpp>
# include <boost/variant/detail/has_result_type.hpp>
#endif
@@ -39,41 +40,23 @@ namespace boost {
// nonconst-visitor version:
//
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Visitor, typename Visitable>
inline typename Visitor::result_type
apply_visitor(Visitor& visitor, Visitable&& visitable)
{
return ::boost::forward<Visitable>(visitable).apply_visitor(visitor);
return std::forward<Visitable>(visitable).apply_visitor(visitor);
}
#else
template <typename Visitor, typename Visitable>
inline typename Visitor::result_type
apply_visitor(Visitor& visitor, Visitable& visitable)
{
return visitable.apply_visitor(visitor);
}
#endif
//
// const-visitor version:
//
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Visitor, typename Visitable>
inline typename Visitor::result_type
apply_visitor(const Visitor& visitor, Visitable&& visitable)
{
return ::boost::forward<Visitable>(visitable).apply_visitor(visitor);
return std::forward<Visitable>(visitable).apply_visitor(visitor);
}
#else
template <typename Visitor, typename Visitable>
inline typename Visitor::result_type
apply_visitor(const Visitor& visitor, Visitable& visitable)
{
return visitable.apply_visitor(visitor);
}
#endif
#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
@@ -85,7 +68,7 @@ namespace detail { namespace variant {
// This class serves only metaprogramming purposes. none of its methods must be called at runtime!
template <class Visitor, class Variant>
struct result_multideduce1 {
typedef typename Variant::types types;
typedef typename remove_reference<Variant>::type::types types;
typedef typename boost::mpl::begin<types>::type begin_it;
typedef typename boost::mpl::advance<
begin_it, boost::mpl::int_<boost::mpl::size<types>::type::value - 1>
@@ -95,14 +78,14 @@ struct result_multideduce1 {
struct deduce_impl {
typedef typename boost::mpl::next<It>::type next_t;
typedef typename boost::mpl::deref<It>::type value_t;
typedef decltype(true ? boost::declval< Visitor& >()( boost::declval< value_t >() )
typedef decltype(true ? boost::declval< Visitor& >()( boost::declval< copy_cv_ref_t< value_t, Variant > >() )
: boost::declval< typename deduce_impl<next_t>::type >()) type;
};
template <class Dummy>
struct deduce_impl<last_it, Dummy> {
typedef typename boost::mpl::deref<last_it>::type value_t;
typedef decltype(boost::declval< Visitor& >()( boost::declval< value_t >() )) type;
typedef decltype(boost::declval< Visitor& >()( boost::declval< copy_cv_ref_t< value_t, Variant > >() )) type;
};
typedef typename deduce_impl<begin_it>::type type;
@@ -115,12 +98,12 @@ struct result_wrapper1
Visitor&& visitor_;
explicit result_wrapper1(Visitor&& visitor) BOOST_NOEXCEPT
: visitor_(::boost::forward<Visitor>(visitor))
: visitor_(std::forward<Visitor>(visitor))
{}
template <class T>
result_type operator()(T&& val) const {
return visitor_(::boost::forward<T>(val));
return visitor_(std::forward<T>(val));
}
};
@@ -129,11 +112,12 @@ struct result_wrapper1
template <typename Visitor, typename Visitable>
inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
boost::detail::variant::result_wrapper1<Visitor, typename remove_reference<Visitable>::type> cpp14_vis(::boost::forward<Visitor>(visitor));
return ::boost::forward<Visitable>(visitable).apply_visitor(cpp14_vis);
boost::detail::variant::result_wrapper1<Visitor, Visitable> cpp14_vis(std::forward<Visitor>(visitor));
return std::forward<Visitable>(visitable).apply_visitor(cpp14_vis);
}
#endif // !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
+1 -1
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003 Eric Friedman
// Copyright (c) 2016-2019 Antony Polukhin
// Copyright (c) 2016-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2014-2019 Antony Polukhin
// Copyright (c) 2014-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -36,42 +36,10 @@
namespace boost {
namespace detail { namespace variant {
#if !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
# define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL(T,Dest,Source) \
substitute< T , Dest , Source > \
/**/
#else // defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
///////////////////////////////////////////////////////////////////////////////
// (detail) class template rebind1
//
// Limited workaround in case 'substitute' metafunction unavailable.
//
template <typename T, typename U1>
struct rebind1
{
private:
typedef typename mpl::lambda<
mpl::identity<T>
>::type le_;
public:
typedef typename mpl::eval_if<
is_same< le_, mpl::identity<T> >
, le_ // identity<T>
, mpl::apply1<le_, U1>
>::type type;
};
# define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_IMPL(T,Dest,Source) \
rebind1< T , Dest > \
/**/
#endif // !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
///////////////////////////////////////////////////////////////////////////////
// (detail) metafunction enable_recursive
//
+3 -13
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003 Eric Friedman
// Copyright (c) 2015-2019 Antony Polukhin
// Copyright (c) 2015-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -15,7 +15,6 @@
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <cstdlib> // std::abort
#ifdef BOOST_MSVC
@@ -25,12 +24,6 @@
namespace boost { namespace detail { namespace variant {
BOOST_NORETURN inline void forced_return_no_return() { // fixes `must return a value` warnings
using namespace std;
abort(); // some implementations have no std::abort
}
///////////////////////////////////////////////////////////////////////////////
// (detail) function template forced_return
//
@@ -44,12 +37,9 @@ forced_return()
// logical error: should never be here! (see above)
BOOST_ASSERT(false);
forced_return_no_return();
#ifdef BOOST_NO_NORETURN
T (*dummy)() = 0;
return dummy();
#endif
(void)dummy;
BOOST_UNREACHABLE_RETURN(dummy());
}
}}} // namespace boost::detail::variant
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2014-2019 Antony Polukhin
// Copyright (c) 2014-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2011-2019 Antony Polukhin
// Copyright (c) 2011-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
+1 -88
View File
@@ -22,7 +22,6 @@
#include <boost/variant/recursive_wrapper_fwd.hpp>
#include <boost/variant/detail/move.hpp>
#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
# include <boost/mpl/aux_/value_wknd.hpp>
# include <boost/mpl/int.hpp>
# include <boost/mpl/iter_fold.hpp>
@@ -30,12 +29,7 @@
# include <boost/mpl/deref.hpp>
# include <boost/mpl/pair.hpp>
# include <boost/mpl/protect.hpp>
#else
# include <boost/variant/variant_fwd.hpp>
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/enum.hpp>
# include <boost/preprocessor/repeat.hpp>
#endif
namespace boost {
namespace detail { namespace variant {
@@ -53,8 +47,6 @@ namespace detail { namespace variant {
// size of the variant's psuedo-variadic template parameter list.
//
#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
// (detail) quoted metafunction make_initializer_node
//
// Exposes a pair whose first type is a node in the initializer hierarchy.
@@ -81,7 +73,6 @@ struct make_initializer_node
typedef typename unwrap_recursive<recursive_enabled_T>::type
public_T;
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
typedef boost::is_reference<public_T>
is_reference_content_t;
@@ -92,10 +83,6 @@ struct make_initializer_node
typedef typename boost::mpl::if_<is_reference_content_t, disable_overload<public_T>, public_T&& >::type
param2_T;
#else
typedef typename call_traits<public_T>::param_type
param_T;
#endif
public: // static functions
@@ -111,7 +98,6 @@ struct make_initializer_node
return BOOST_MPL_AUX_VALUE_WKND(index)::value; // which
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
static int initialize(void* dest, param2_T operand)
{
// This assert must newer trigger, because all the reference contents are
@@ -122,7 +108,6 @@ struct make_initializer_node
new(dest) value_T( boost::detail::variant::move(operand) );
return BOOST_MPL_AUX_VALUE_WKND(index)::value; // which
}
#endif
};
friend class initializer_node;
@@ -150,61 +135,6 @@ public: // static functions
};
#else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
// Obsolete. Remove.
#define BOOST_VARIANT_AUX_PP_INITIALIZER_TEMPLATE_PARAMS \
BOOST_VARIANT_ENUM_PARAMS(typename recursive_enabled_T) \
/**/
// Obsolete. Remove.
#define BOOST_VARIANT_AUX_PP_INITIALIZER_DEFINE_PARAM_T(N) \
typedef typename unwrap_recursive< \
BOOST_PP_CAT(recursive_enabled_T,N) \
>::type BOOST_PP_CAT(public_T,N); \
typedef typename call_traits< \
BOOST_PP_CAT(public_T,N) \
>::param_type BOOST_PP_CAT(param_T,N); \
/**/
template < BOOST_VARIANT_ENUM_PARAMS(typename recursive_enabled_T) >
struct preprocessor_list_initializer
{
public: // static functions
#define BOOST_VARIANT_AUX_PP_INITIALIZE_FUNCTION(z,N,_) \
typedef typename unwrap_recursive< \
BOOST_PP_CAT(recursive_enabled_T,N) \
>::type BOOST_PP_CAT(public_T,N); \
typedef typename call_traits< \
BOOST_PP_CAT(public_T,N) \
>::param_type BOOST_PP_CAT(param_T,N); \
static int initialize( \
void* dest \
, BOOST_PP_CAT(param_T,N) operand \
) \
{ \
typedef typename boost::detail::make_reference_content< \
BOOST_PP_CAT(recursive_enabled_T,N) \
>::type internal_T; \
\
new(dest) internal_T(operand); \
return (N); /*which*/ \
} \
/**/
BOOST_PP_REPEAT(
BOOST_VARIANT_LIMIT_TYPES
, BOOST_VARIANT_AUX_PP_INITIALIZE_FUNCTION
, _
)
#undef BOOST_VARIANT_AUX_PP_INITIALIZE_FUNCTION
};
#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround
}} // namespace detail::variant
} // namespace boost
@@ -216,8 +146,6 @@ public: // static functions
// most appropriate to the current compiler.
//
#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
#define BOOST_VARIANT_AUX_INITIALIZER_T( mpl_seq, typename_base ) \
::boost::mpl::iter_fold< \
mpl_seq \
@@ -231,19 +159,4 @@ public: // static functions
>::type::first \
/**/
#else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
// Obsolete. Remove.
#define BOOST_VARIANT_AUX_PP_INITIALIZER_TEMPLATE_ARGS(typename_base) \
BOOST_VARIANT_ENUM_PARAMS(typename_base) \
/**/
#define BOOST_VARIANT_AUX_INITIALIZER_T( mpl_seq, typename_base ) \
::boost::detail::variant::preprocessor_list_initializer< \
BOOST_VARIANT_ENUM_PARAMS(typename_base) \
> \
/**/
#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround
#endif // BOOST_VARIANT_DETAIL_INITIALIZER_HPP
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2002-2003 Eric Friedman, Itay Maman
// Copyright (c) 2013-2019 Antony Polukhin
// Copyright (c) 2013-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -19,8 +19,7 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/enum.hpp>
namespace boost {
namespace detail { namespace variant {
namespace boost { namespace detail { namespace variant {
///////////////////////////////////////////////////////////////////////////////
// (detail) metafunction make_variant_list
@@ -32,42 +31,12 @@ namespace detail { namespace variant {
// declaration workaround (below).
//
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
template < typename... T >
struct make_variant_list
{
typedef typename mpl::list< T... >::type type;
};
#else // defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
struct make_variant_list
{
public: // metafunction result
// [Define a macro to convert any void(NN) tags to mpl::void...]
# define BOOST_VARIANT_AUX_CONVERT_VOID(z, N,_) \
typename convert_void< BOOST_PP_CAT(T,N) >::type
// [...so that the specified types can be passed to mpl::list...]
typedef typename mpl::list<
BOOST_PP_ENUM(
BOOST_VARIANT_LIMIT_TYPES
, BOOST_VARIANT_AUX_CONVERT_VOID
, _
)
>::type type;
// [...and, finally, the conversion macro can be undefined:]
# undef BOOST_VARIANT_AUX_CONVERT_VOID
};
#endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES workaround
}} // namespace detail::variant
} // namespace boost
}}} // namespace boost::detail::variant
#endif // BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP
+5 -8
View File
@@ -5,7 +5,7 @@
//
// Copyright (c) 2002-2003 Eric Friedman
// Copyright (c) 2002 by Andrei Alexandrescu
// Copyright (c) 2013-2019 Antony Polukhin
// Copyright (c) 2013-2026 Antony Polukhin
//
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
@@ -20,17 +20,13 @@
#ifndef BOOST_VARIANT_DETAIL_MOVE_HPP
#define BOOST_VARIANT_DETAIL_MOVE_HPP
#include <iterator> // for iterator_traits
#include <new> // for placement new
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/move/move.hpp>
#include <boost/move/adl_move_swap.hpp>
#include <utility>
namespace boost { namespace detail { namespace variant {
using boost::move;
using std::move;
//////////////////////////////////////////////////////////////////////////
// function template move_swap
@@ -42,7 +38,8 @@ using boost::move;
template <typename T>
inline void move_swap(T& lhs, T& rhs)
{
::boost::adl_move_swap(lhs, rhs);
using std::swap;
swap(lhs, rhs);
}
}}} // namespace boost::detail::variant
@@ -3,7 +3,7 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2013-2014.
// Copyright Antony Polukhin, 2013-2024.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -17,15 +17,10 @@
#endif
#include <boost/variant/detail/apply_visitor_unary.hpp>
#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
#include <boost/move/utility.hpp>
#include <boost/variant/variant_fwd.hpp>
#include <boost/type_traits/is_lvalue_reference.hpp>
#include <boost/core/enable_if.hpp>
#if defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) || defined(BOOST_NO_CXX11_HDR_TUPLE)
# error "This file requires <tuple> and variadic templates support"
#endif
#include <tuple>
namespace boost {
@@ -64,7 +59,7 @@ namespace detail { namespace variant {
typename enable_if_c<Wrapper::MoveSemantics, typename Wrapper::T>::type
unwrap(Wrapper& w)
{
return ::boost::move(w.v);
return std::move(w.v);
}
template <typename Wrapper>
@@ -189,7 +184,7 @@ namespace detail { namespace variant {
),
std::tuple<>()
),
::boost::forward<T1>(v1)
std::forward<T1>(v1)
);
}
@@ -207,7 +202,7 @@ namespace detail { namespace variant {
),
std::tuple<>()
),
::boost::forward<T1>(v1)
std::forward<T1>(v1)
);
}
@@ -17,9 +17,9 @@
# pragma once
#endif
#include <boost/variant/detail/multivisitors_cpp14_based.hpp>
#include <tuple>
namespace boost {
namespace boost {
namespace detail { namespace variant {
@@ -106,8 +106,9 @@ namespace detail { namespace variant {
template <class Visitor, class T1, class T2, class T3, class... TN>
inline decltype(auto) apply_visitor(const Visitor& visitor, T1&& v1, T2&& v2, T3&& v3, TN&&... vn,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
return boost::apply_visitor(
::boost::detail::variant::make_one_by_one_visitor_and_value_referer_cpp14(
@@ -119,16 +120,17 @@ namespace detail { namespace variant {
),
std::tuple<>()
),
::boost::forward<T1>(v1)
std::forward<T1>(v1)
);
}
template <class Visitor, class T1, class T2, class T3, class... TN>
inline decltype(auto) apply_visitor(Visitor& visitor, T1&& v1, T2&& v2, T3&& v3, TN&&... vn,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
boost::detail::variant::has_result_type<Visitor>,
bool
>::type = true)
{
return ::boost::apply_visitor(
::boost::detail::variant::make_one_by_one_visitor_and_value_referer_cpp14(
@@ -140,7 +142,7 @@ namespace detail { namespace variant {
),
std::tuple<>()
),
::boost::forward<T1>(v1)
std::forward<T1>(v1)
);
}
@@ -1,143 +0,0 @@
// Boost.Varaint
// Contains multivisitors that are implemented via preprocessor magic
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright Antony Polukhin, 2013-2014.
//
// 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).
#ifndef BOOST_VARIANT_DETAIL_MULTIVISITORS_PREPROCESSOR_BASED_HPP
#define BOOST_VARIANT_DETAIL_MULTIVISITORS_PREPROCESSOR_BASED_HPP
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/variant.hpp>
#include <boost/bind.hpp>
#include <boost/preprocessor/repetition.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#ifndef BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS
# define BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS 4
#endif
namespace boost {
namespace detail { namespace variant {
template <class VisitorT, class Visitable1T, class Visitable2T>
struct two_variables_holder {
private:
VisitorT& visitor_;
Visitable1T& visitable1_;
Visitable2T& visitable2_;
// required to suppress warnings and ensure that we do not copy
// this visitor
two_variables_holder& operator=(const two_variables_holder&);
public:
typedef BOOST_DEDUCED_TYPENAME VisitorT::result_type result_type;
explicit two_variables_holder(VisitorT& visitor, Visitable1T& visitable1, Visitable2T& visitable2) BOOST_NOEXCEPT
: visitor_(visitor)
, visitable1_(visitable1)
, visitable2_(visitable2)
{}
#define BOOST_VARIANT_OPERATOR_BEG() \
return ::boost::apply_visitor( \
::boost::bind<result_type>(boost::ref(visitor_), _1, _2 \
/**/
#define BOOST_VARIANT_OPERATOR_END() \
), visitable1_, visitable2_); \
/**/
#define BOOST_VARANT_VISITORS_VARIABLES_PRINTER(z, n, data) \
BOOST_PP_COMMA() boost::ref( BOOST_PP_CAT(vis, n) ) \
/**/
#define BOOST_VARIANT_VISIT(z, n, data) \
template <BOOST_PP_ENUM_PARAMS(BOOST_PP_ADD(n, 1), class VisitableUnwrapped)> \
result_type operator()( \
BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ADD(n, 1), VisitableUnwrapped, & vis) \
) const \
{ \
BOOST_VARIANT_OPERATOR_BEG() \
BOOST_PP_REPEAT(BOOST_PP_ADD(n, 1), BOOST_VARANT_VISITORS_VARIABLES_PRINTER, ~) \
BOOST_VARIANT_OPERATOR_END() \
} \
/**/
BOOST_PP_REPEAT( BOOST_PP_SUB(BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS, 2), BOOST_VARIANT_VISIT, ~)
#undef BOOST_VARIANT_OPERATOR_BEG
#undef BOOST_VARIANT_OPERATOR_END
#undef BOOST_VARANT_VISITORS_VARIABLES_PRINTER
#undef BOOST_VARIANT_VISIT
};
template <class VisitorT, class Visitable1T, class Visitable2T>
inline two_variables_holder<VisitorT, Visitable1T, Visitable2T> make_two_variables_holder(
VisitorT& visitor, Visitable1T& visitable1, Visitable2T& visitable2
) BOOST_NOEXCEPT
{
return two_variables_holder<VisitorT, Visitable1T, Visitable2T>(visitor, visitable1, visitable2);
}
template <class VisitorT, class Visitable1T, class Visitable2T>
inline two_variables_holder<const VisitorT, Visitable1T, Visitable2T> make_two_variables_holder(
const VisitorT& visitor, Visitable1T& visitable1, Visitable2T& visitable2
) BOOST_NOEXCEPT
{
return two_variables_holder<const VisitorT, Visitable1T, Visitable2T>(visitor, visitable1, visitable2);
}
}} // namespace detail::variant
#define BOOST_VARIANT_APPLY_VISITOR_BEG() \
return ::boost::apply_visitor( \
boost::detail::variant::make_two_variables_holder(visitor, var0 , var1), \
var2 \
/**/
#define BOOST_VARIANT_APPLY_VISITOR_END() \
); \
/**/
#define BOOST_VARANT_VISITORS_VARIABLES_PRINTER(z, n, data) \
BOOST_PP_COMMA() BOOST_PP_CAT(var, BOOST_PP_ADD(n, 3)) \
/**/
#define BOOST_VARIANT_VISIT(z, n, data) \
template <class Visitor BOOST_PP_COMMA() BOOST_PP_ENUM_PARAMS(BOOST_PP_ADD(n, 3), class T)> \
inline BOOST_DEDUCED_TYPENAME Visitor::result_type apply_visitor( \
data BOOST_PP_COMMA() BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ADD(n, 3), T, & var) \
) \
{ \
BOOST_VARIANT_APPLY_VISITOR_BEG() \
BOOST_PP_REPEAT(n, BOOST_VARANT_VISITORS_VARIABLES_PRINTER, ~) \
BOOST_VARIANT_APPLY_VISITOR_END() \
} \
/**/
BOOST_PP_REPEAT( BOOST_PP_SUB(BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS, 2), BOOST_VARIANT_VISIT, const Visitor& visitor)
BOOST_PP_REPEAT( BOOST_PP_SUB(BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS, 2), BOOST_VARIANT_VISIT, Visitor& visitor)
#undef BOOST_VARIANT_APPLY_VISITOR_BEG
#undef BOOST_VARIANT_APPLY_VISITOR_END
#undef BOOST_VARANT_VISITORS_VARIABLES_PRINTER
#undef BOOST_VARIANT_VISIT
} // namespace boost
#endif // BOOST_VARIANT_DETAIL_MULTIVISITORS_PREPROCESSOR_BASED_HPP
+46
View File
@@ -0,0 +1,46 @@
//-----------------------------------------------------------------------------
// boost variant/detail/std_hash.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2018-2026 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)
#ifndef BOOST_VARIANT_DETAIL_STD_HASH_HPP
#define BOOST_VARIANT_DETAIL_STD_HASH_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <boost/variant/variant_fwd.hpp>
#include <boost/variant/detail/hash_variant.hpp>
///////////////////////////////////////////////////////////////////////////////
// macro BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH
//
// Define this macro if you do not wish to have a std::hash specialization for
// boost::variant.
#if !defined(BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
#include <functional> // for std::hash
namespace std {
template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
struct hash<boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) > > {
std::size_t operator()(const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& val) const {
return ::boost::hash_value(val);
}
};
}
#endif // #if !defined(BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
#endif // BOOST_VARIANT_DETAIL_STD_HASH_HPP
+1 -114
View File
@@ -1,8 +1,3 @@
#if !defined(BOOST_PP_IS_ITERATING)
///// header body
//-----------------------------------------------------------------------------
// boost variant/detail/substitute.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
@@ -21,22 +16,17 @@
#include <boost/mpl/aux_/config/ctps.hpp>
#include <boost/variant/detail/substitute_fwd.hpp>
#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
#include <boost/variant/variant_fwd.hpp>
#include <boost/mpl/aux_/lambda_arity_param.hpp>
#include <boost/mpl/aux_/preprocessor/params.hpp>
#include <boost/mpl/aux_/preprocessor/repeat.hpp>
#include <boost/mpl/int_fwd.hpp>
#include <boost/mpl/limits/arity.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/empty.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
#include <boost/preprocessor/iterate.hpp>
namespace boost {
namespace detail { namespace variant {
#if !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
///////////////////////////////////////////////////////////////////////////////
// (detail) metafunction substitute
//
@@ -126,7 +116,6 @@ struct substitute<
// template expression (i.e., F<...>) specializations
//
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
template <
template <typename...> class F
, typename... Ts
@@ -170,110 +159,8 @@ public:
A, Dest, Source
>::type...);
};
#else
#define BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL(N) \
typedef typename substitute< \
BOOST_PP_CAT(U,N), Dest, Source \
>::type BOOST_PP_CAT(u,N); \
/**/
#define BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF(z, N, _) \
BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL( BOOST_PP_INC(N) ) \
/**/
#define BOOST_PP_ITERATION_LIMITS (0,BOOST_MPL_LIMIT_METAFUNCTION_ARITY)
#define BOOST_PP_FILENAME_1 <boost/variant/detail/substitute.hpp>
#include BOOST_PP_ITERATE()
#undef BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL
#undef BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF
#endif // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
#endif // !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
}} // namespace detail::variant
} // namespace boost
#endif // BOOST_VARIANT_DETAIL_SUBSTITUTE_HPP
///// iteration, depth == 1
#elif BOOST_PP_ITERATION_DEPTH() == 1
#define i BOOST_PP_FRAME_ITERATION(1)
#if i > 0
//
// template specializations
//
template <
template < BOOST_MPL_PP_PARAMS(i,typename P) > class T
, BOOST_MPL_PP_PARAMS(i,typename U)
, typename Dest
, typename Source
>
struct substitute<
T< BOOST_MPL_PP_PARAMS(i,U) >
, Dest
, Source
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<( i )>)
>
{
private:
BOOST_MPL_PP_REPEAT(i, BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF, _)
public:
typedef T< BOOST_MPL_PP_PARAMS(i,u) > type;
};
//
// function specializations
//
template <
typename R
, BOOST_MPL_PP_PARAMS(i,typename U)
, typename Dest
, typename Source
>
struct substitute<
R (*)( BOOST_MPL_PP_PARAMS(i,U) )
, Dest
, Source
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>)
>
{
private:
typedef typename substitute< R, Dest, Source >::type r;
BOOST_MPL_PP_REPEAT(i, BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF, _)
public:
typedef r (*type)( BOOST_MPL_PP_PARAMS(i,u) );
};
#elif i == 0
//
// zero-arg function specialization
//
template <
typename R, typename Dest, typename Source
>
struct substitute<
R (*)( void )
, Dest
, Source
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>)
>
{
private:
typedef typename substitute< R, Dest, Source >::type r;
public:
typedef r (*type)( void );
};
#endif // i
#undef i
#endif // BOOST_PP_IS_ITERATING
@@ -18,25 +18,12 @@
#include <boost/mpl/int_fwd.hpp>
///////////////////////////////////////////////////////////////////////////////
// BOOST_VARIANT_DETAIL_NO_SUBSTITUTE
//
// Defined if 'substitute' is not implementable on the current compiler.
//
#include <boost/mpl/aux_/config/ctps.hpp>
#include <boost/mpl/aux_/config/ttp.hpp>
#if defined(BOOST_NO_TEMPLATE_TEMPLATE_PARAMETERS) \
&& !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
# define BOOST_VARIANT_DETAIL_NO_SUBSTITUTE
#endif
namespace boost {
namespace detail { namespace variant {
#if !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
///////////////////////////////////////////////////////////////////////////////
// metafunction substitute
//
@@ -50,8 +37,6 @@ template <
>
struct substitute;
#endif // !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
}} // namespace detail::variant
} // namespace boost
+7 -19
View File
@@ -16,8 +16,6 @@
#include <iosfwd> // for std::basic_ostream forward declare
#include <boost/variant/variant_fwd.hpp>
#include <boost/detail/templated_streams.hpp>
#include <boost/variant/static_visitor.hpp>
namespace boost {
@@ -29,14 +27,9 @@ namespace boost {
//
// forward declare (allows output of embedded variant< variant< ... >, ... >)
template <
BOOST_TEMPLATED_STREAM_ARGS(E,T)
BOOST_TEMPLATED_STREAM_COMMA
BOOST_VARIANT_ENUM_PARAMS(typename U)
>
inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
BOOST_TEMPLATED_STREAM(ostream, E,T)& out
, const variant< BOOST_VARIANT_ENUM_PARAMS(U) >& rhs
template <class CharT, class Trait, typename... U>
inline std::basic_ostream<CharT, Trait>& operator<<(
std::basic_ostream<CharT, Trait>& out, const variant<U...>& rhs
);
namespace detail { namespace variant {
@@ -71,18 +64,13 @@ private:
}} // namespace detail::variant
template <
BOOST_TEMPLATED_STREAM_ARGS(E,T)
BOOST_TEMPLATED_STREAM_COMMA
BOOST_VARIANT_ENUM_PARAMS(typename U)
>
inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
BOOST_TEMPLATED_STREAM(ostream, E,T)& out
, const variant< BOOST_VARIANT_ENUM_PARAMS(U) >& rhs
template <class CharT, class Trait, typename... U>
inline std::basic_ostream<CharT, Trait>& operator<<(
std::basic_ostream<CharT, Trait>& out, const variant<U...>& rhs
)
{
detail::variant::printer<
BOOST_TEMPLATED_STREAM(ostream, E,T)
std::basic_ostream<CharT, Trait>
> visitor(out);
rhs.apply_visitor(visitor);
@@ -18,7 +18,7 @@
#include <boost/variant/detail/backup_holder.hpp>
#include <boost/variant/detail/cast_storage.hpp>
#include <boost/variant/detail/forced_return.hpp>
#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
#include <boost/variant/variant_fwd.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/bool.hpp>
@@ -34,9 +34,9 @@
#include <boost/type_traits/has_nothrow_copy.hpp>
#include <boost/type_traits/is_nothrow_move_constructible.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning (push)
# pragma warning (disable : 4702) //unreachable code
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning (push)
# pragma warning (disable : 4702) //unreachable code
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -47,14 +47,9 @@
//
#if !defined(BOOST_VARIANT_VISITATION_UNROLLING_LIMIT)
#ifndef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
# include <boost/mpl/limits/list.hpp>
# define BOOST_VARIANT_VISITATION_UNROLLING_LIMIT \
BOOST_MPL_LIMIT_LIST_SIZE
#else
# define BOOST_VARIANT_VISITATION_UNROLLING_LIMIT \
BOOST_VARIANT_LIMIT_TYPES
#endif
#endif
@@ -177,7 +172,7 @@ inline typename Visitor::result_type
visitation_impl(
int, int, Visitor&, VPCV
, mpl::true_ // is_apply_visitor_unrolled
, NBF, W* = 0, S* = 0
, NBF, W* = nullptr, S* = nullptr
)
{
// should never be here at runtime!
@@ -190,13 +185,13 @@ template <
, typename Visitor, typename VoidPtrCV
, typename NoBackupFlag
>
inline typename Visitor::result_type
BOOST_FORCEINLINE typename Visitor::result_type
visitation_impl(
const int internal_which, const int logical_which
, Visitor& visitor, VoidPtrCV storage
, mpl::false_ // is_apply_visitor_unrolled
, NoBackupFlag no_backup_flag
, Which* = 0, step0* = 0
, Which* = nullptr, step0* = nullptr
)
{
// Typedef apply_visitor_unrolled steps and associated types...
@@ -263,8 +258,8 @@ visitation_impl(
}} // namespace detail::variant
} // namespace boost
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(pop)
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
# pragma warning(pop)
#endif
#endif // BOOST_VARIANT_DETAIL_VISITATION_IMPL_HPP
+11 -6
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003 Eric Friedman, Itay Maman
// Copyright (c) 2014-2019 Antony Polukhin
// Copyright (c) 2014-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -16,10 +16,10 @@
#include <exception>
#include <boost/config.hpp>
#include <boost/core/addressof.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/static_assert.hpp>
#include <boost/throw_exception.hpp>
#include <boost/utility/addressof.hpp>
#include <boost/variant/variant_fwd.hpp>
#include <boost/variant/detail/element_index.hpp>
#include <boost/variant/detail/move.hpp>
@@ -44,7 +44,7 @@ class BOOST_SYMBOL_VISIBLE bad_get
{
public: // std::exception implementation
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
{
return "boost::bad_get: "
"failed value get using boost::get";
@@ -99,11 +99,16 @@ public: // visitor interfaces
}} // namespace detail::variant
#ifndef BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551))
# if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0551))
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t)
# else
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = 0
# if defined(BOOST_NO_CXX11_NULLPTR)
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = 0
# else
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = nullptr
# endif
# endif
#endif
+5 -9
View File
@@ -3,7 +3,7 @@
//
// See http://www.boost.org for most recent version, including documentation.
//
// Copyright (c) 2013-2019 Antony Polukhin.
// Copyright (c) 2013-2026 Antony Polukhin.
//
// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
@@ -17,15 +17,11 @@
#endif
#include <boost/config.hpp>
#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
#include <boost/variant/variant_fwd.hpp>
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
# include <boost/variant/detail/multivisitors_cpp11_based.hpp>
# if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
# include <boost/variant/detail/multivisitors_cpp14_based.hpp>
# endif
#else
# include <boost/variant/detail/multivisitors_preprocessor_based.hpp>
#include <boost/variant/detail/multivisitors_cpp11_based.hpp>
#if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
# include <boost/variant/detail/multivisitors_cpp14_based.hpp>
#endif
#endif // BOOST_VARIANT_MULTIVISITORS_HPP
+10 -5
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2013-2019 Antony Polukhin
// Copyright (c) 2013-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -15,10 +15,10 @@
#include <exception>
#include <boost/config.hpp>
#include <boost/core/addressof.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/static_assert.hpp>
#include <boost/throw_exception.hpp>
#include <boost/utility/addressof.hpp>
#include <boost/variant/variant_fwd.hpp>
#include <boost/variant/get.hpp>
@@ -132,11 +132,16 @@ public: // visitor interfaces
}} // namespace detail::variant
#ifndef BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551))
# if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0551))
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t)
# else
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = 0
# if defined(BOOST_NO_CXX11_NULLPTR)
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = 0
# else
# define BOOST_VARIANT_AUX_GET_EXPLICIT_TEMPLATE_TYPE(t) \
, t* = nullptr
# endif
# endif
#endif
+2 -39
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003 Eric Friedman
// Copyright (c) 2013-2019 Antony Polukhin
// Copyright (c) 2013-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -45,8 +45,6 @@ namespace detail { namespace variant {
// Handles embedded variant types when substituting for recursive_variant_.
//
#if !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
template <
BOOST_VARIANT_ENUM_PARAMS(typename T)
, typename RecursiveVariant
@@ -115,9 +113,7 @@ struct substitute<
, ::boost::recursive_variant_
BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(Arity)
>
{
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
{
typedef ::boost::variant<
typename enable_recursive<
T0
@@ -130,41 +126,8 @@ struct substitute<
, mpl::true_
>::type...
> type;
#else // defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
private: // helpers, for metafunction result (below)
#define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS(z,N,_) \
typedef typename enable_recursive< \
BOOST_PP_CAT(T,N) \
, RecursiveVariant \
, mpl::true_ \
>::type BOOST_PP_CAT(wknd_T,N); \
/**/
BOOST_PP_REPEAT(
BOOST_VARIANT_LIMIT_TYPES
, BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS
, _
)
#undef BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS
public: // metafunction result
typedef ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(wknd_T) > type;
#endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES workaround
};
#else // defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
//
// no specializations: embedded variants unsupported on these compilers!
//
#endif // !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
}} // namespace detail::variant
///////////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -15,7 +15,7 @@
#include <boost/variant/recursive_wrapper_fwd.hpp>
#include <boost/variant/detail/move.hpp>
#include <boost/checked_delete.hpp>
#include <boost/core/checked_delete.hpp>
namespace boost {
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2002 Eric Friedman, Itay Maman
// Copyright (c) 2016-2019 Antony Polukhin
// Copyright (c) 2016-2026 Antony Polukhin
//
// Portions Copyright (C) 2002 David Abrahams
//
+1 -3
View File
@@ -50,10 +50,8 @@ public: // typedefs
protected: // for use as base class only
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS)
static_visitor() = default;
~static_visitor() = default;
#else
static_visitor() BOOST_NOEXCEPT { }
~static_visitor() BOOST_NOEXCEPT { }
#endif
};
@@ -84,7 +82,7 @@ struct is_static_visitor_impl
} // namespace detail
template< typename T > struct is_static_visitor
: public ::boost::integral_constant<bool,(::boost::detail::is_static_visitor_impl<T>::value)>
: public ::boost::integral_constant<bool,(::boost::detail::is_static_visitor_impl<T>::value)>
{
public:
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_static_visitor,(T))
+43 -184
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2002-2003 Eric Friedman, Itay Maman
// Copyright (c) 2012-2019 Antony Polukhin
// Copyright (c) 2012-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -32,17 +32,15 @@
#include <boost/variant/detail/over_sequence.hpp>
#include <boost/variant/detail/visitation_impl.hpp>
#include <boost/variant/detail/hash_variant.hpp>
#include <boost/variant/detail/std_hash.hpp>
#include <boost/variant/detail/move.hpp>
#include <boost/detail/no_exceptions_support.hpp>
#include <boost/detail/reference_content.hpp>
#include <boost/aligned_storage.hpp>
#include <boost/blank.hpp>
#include <boost/integer/common_factor_ct.hpp>
#include <boost/static_assert.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repeat.hpp>
#include <boost/type_traits/aligned_storage.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/has_nothrow_constructor.hpp>
@@ -54,8 +52,9 @@
#include <boost/type_traits/is_rvalue_reference.hpp>
#include <boost/type_traits/is_constructible.hpp>
#include <boost/type_traits/add_lvalue_reference.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/utility/declval.hpp>
#include <boost/type_traits/declval.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/variant/recursive_wrapper_fwd.hpp>
#include <boost/variant/static_visitor.hpp>
@@ -129,7 +128,7 @@ private: // helpers, for metafunction result (below)
typedef typename mpl::transform1<Sequence, F>::type transformed_;
typedef typename mpl::max_element<transformed_
>::type max_it;
public: // metafunction result
@@ -220,7 +219,6 @@ public: // metafunction result
};
#ifndef BOOST_NO_CXX11_NOEXCEPT
///////////////////////////////////////////////////////////////////////////////
// (detail) metafunction is_variant_move_noexcept_constructible
//
@@ -254,7 +252,6 @@ struct is_variant_move_noexcept_assignable {
iterator_t, end_t
>::type type;
};
#endif // BOOST_NO_CXX11_NOEXCEPT
///////////////////////////////////////////////////////////////////////////////
// (detail) metafunction is_variant_constructible_from
@@ -307,8 +304,6 @@ struct is_variant_constructible_from< boost::variant<BOOST_VARIANT_ENUM_PARAMS(T
is_variant_constructible_from<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Types >
{};
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <BOOST_VARIANT_ENUM_PARAMS(typename T), class Types>
struct is_variant_constructible_from< boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>&& , Types >:
is_variant_constructible_from<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Types >
@@ -319,8 +314,6 @@ struct is_variant_constructible_from< boost::variant<BOOST_VARIANT_ENUM_PARAMS(T
is_variant_constructible_from<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Types >
{};
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCE
///////////////////////////////////////////////////////////////////////////////
// (detail) metafunction make_storage
@@ -346,7 +339,7 @@ private: // helpers, for metafunction result (below)
types, mpl::sizeof_<mpl::_1>
>::type max_size;
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551))
#if !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0551))
typedef typename mpl::fold<
types
@@ -384,7 +377,7 @@ public: // visitor interfaces
{
operand.~T(); // must be noexcept
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551)) || \
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0551)) || \
BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
(void)operand; // suppresses warnings
#endif
@@ -465,7 +458,6 @@ public: // internal visitor interface
//
// Internal visitor that moves the value it visits into the given buffer.
//
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
class move_into
: public static_visitor<>
{
@@ -494,7 +486,6 @@ public: // internal visitor interface
new(storage_) T(::boost::detail::variant::move(operand));
}
};
#endif
///////////////////////////////////////////////////////////////////////////////
// (detail) class assign_storage
@@ -1011,13 +1002,11 @@ public: // structors
public: // internal visitor interfaces
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
//using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
template <typename T>
typename enable_if_c<MoveSemantics && is_same<T, T>::value, result_type>::type internal_visit(T&& operand, int)
{
return visitor_(::boost::move<T>(operand));
return visitor_(std::move(operand));
}
//using workaround with is_same<T, T> to prenvent compilation error, because we need to use T in enable_if to make SFINAE work
@@ -1027,24 +1016,6 @@ public: // internal visitor interfaces
return visitor_(operand);
}
#else
template <typename T>
result_type internal_visit(T& operand, int)
{
return visitor_(operand);
}
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564))
template <typename T>
result_type internal_visit(const T& operand, int)
{
return visitor_(operand);
}
# endif //BORLAND
#endif //RVALUE REFERENCES
public: // internal visitor interfaces, cont.
template <typename T>
@@ -1123,8 +1094,6 @@ private: // helpers, for typedefs (below)
{
};
#if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
private: // helpers, for typedefs (below)
typedef typename mpl::eval_if<
@@ -1168,82 +1137,6 @@ private: // internal typedefs
internal_types
>::type internal_T0;
#else // defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
private: // helpers, for typedefs (below)
typedef unwrapped_T0_ T0;
#define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS(z,N,_) \
typedef typename mpl::eval_if< \
is_recursive_ \
, detail::variant::enable_recursive< \
BOOST_PP_CAT(T,N) \
, wknd_self_t \
> \
, mpl::identity< BOOST_PP_CAT(T,N) > \
>::type BOOST_PP_CAT(recursive_enabled_T,N); \
/**/
BOOST_PP_REPEAT(
BOOST_VARIANT_LIMIT_TYPES
, BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS
, _
)
#undef BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS
#define BOOST_VARIANT_AUX_UNWRAP_RECURSIVE_TYPEDEFS(z,N,_) \
typedef typename unwrap_recursive< \
BOOST_PP_CAT(recursive_enabled_T,N) \
>::type BOOST_PP_CAT(public_T,N); \
/**/
BOOST_PP_REPEAT(
BOOST_VARIANT_LIMIT_TYPES
, BOOST_VARIANT_AUX_UNWRAP_RECURSIVE_TYPEDEFS
, _
)
#undef BOOST_VARIANT_AUX_UNWRAP_RECURSIVE_TYPEDEFS
public: // public typedefs
typedef typename detail::variant::make_variant_list<
BOOST_VARIANT_ENUM_PARAMS(public_T)
>::type types;
private: // helpers, for internal typedefs (below)
#define BOOST_VARIANT_AUX_MAKE_REFERENCE_CONTENT_TYPEDEFS(z,N,_) \
typedef detail::make_reference_content< \
BOOST_PP_CAT(recursive_enabled_T,N) \
>::type BOOST_PP_CAT(internal_T,N); \
/**/
BOOST_PP_REPEAT(
BOOST_VARIANT_LIMIT_TYPES
, BOOST_VARIANT_AUX_MAKE_REFERENCE_CONTENT_TYPEDEFS
, _
)
#undef BOOST_VARIANT_AUX_MAKE_REFERENCE_CONTENT_TYPEDEFS
private: // internal typedefs
typedef typename detail::variant::make_variant_list<
BOOST_VARIANT_ENUM_PARAMS(internal_T)
>::type internal_types;
private: // static precondition assertions
// NOTE TO USER :
// variant< type-sequence > syntax is not supported on this compiler!
//
BOOST_MPL_ASSERT_NOT(( is_sequence_based_ ));
#endif // BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT workaround
private: // helpers, for representation (below)
typedef typename detail::variant::find_fallback_type<
@@ -1269,7 +1162,6 @@ private: // helpers, for representation (below)
internal_types, never_uses_backup_flag
>::type storage_t;
#ifndef BOOST_NO_CXX11_NOEXCEPT
typedef typename detail::variant::is_variant_move_noexcept_constructible<
internal_types
> variant_move_noexcept_constructible;
@@ -1278,8 +1170,6 @@ private: // helpers, for representation (below)
internal_types
> variant_move_noexcept_assignable;
#endif
private: // helpers, for representation (below)
// which_ on:
@@ -1371,15 +1261,15 @@ public: // structors
destroy_content();
}
variant()
variant()
#if !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5130))
BOOST_NOEXCEPT_IF(boost::has_nothrow_constructor<internal_T0>::value)
#endif
{
#ifdef _MSC_VER
#pragma warning( push )
// behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
#pragma warning( disable : 4345 )
// behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
#pragma warning( disable : 4345 )
#endif
// NOTE TO USER :
// Compile error from here indicates that the first bound
@@ -1415,14 +1305,14 @@ private: // helpers, for structors, cont. (below)
int internal_visit(T& operand, int) const
{
// NOTE TO USER :
// Compile error here indicates one of the source variant's types
// Compile error here indicates one of the source variant's types
// cannot be unambiguously converted to the destination variant's
// types (or that no conversion exists).
//
return initializer::initialize(storage_, operand);
}
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564))
# if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0564))
template <typename T>
result_type internal_visit(const T& operand, int) const
{
@@ -1470,7 +1360,6 @@ private: // helpers, for structors, cont. (below)
friend class convert_copy_into;
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
class convert_move_into
: public static_visitor<int>
{
@@ -1491,7 +1380,7 @@ private: // helpers, for structors, cont. (below)
int internal_visit(T& operand, int) const
{
// NOTE TO USER :
// Compile error here indicates one of the source variant's types
// Compile error here indicates one of the source variant's types
// cannot be unambiguously converted to the destination variant's
// types (or that no conversion exists).
//
@@ -1536,9 +1425,8 @@ private: // helpers, for structors, cont. (below)
};
friend class convert_move_into;
#endif
private: // helpers, for structors, below
private: // helpers, for structors, below
template <typename T>
void convert_construct(
@@ -1548,7 +1436,7 @@ private: // helpers, for structors, below
)
{
// NOTE TO USER :
// Compile error here indicates that the given type is not
// Compile error here indicates that the given type is not
// unambiguously convertible to one of the variant's types
// (or that no conversion exists).
//
@@ -1560,7 +1448,6 @@ private: // helpers, for structors, below
);
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename T>
typename boost::enable_if<boost::is_rvalue_reference<T&&> >::type convert_construct(
T&& operand
@@ -1569,7 +1456,7 @@ private: // helpers, for structors, below
)
{
// NOTE TO USER :
// Compile error here indicates that the given type is not
// Compile error here indicates that the given type is not
// unambiguously convertible to one of the variant's types
// (or that no conversion exists).
//
@@ -1580,7 +1467,6 @@ private: // helpers, for structors, below
)
);
}
#endif
template <typename Variant>
void convert_construct(
@@ -1595,7 +1481,6 @@ private: // helpers, for structors, below
);
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Variant>
typename boost::enable_if<boost::is_rvalue_reference<Variant&&> >::type convert_construct(
Variant&& operand
@@ -1608,7 +1493,6 @@ private: // helpers, for structors, below
operand.internal_apply_visitor(visitor)
);
}
#endif
template <typename Variant>
void convert_construct_variant(Variant& operand)
@@ -1637,7 +1521,6 @@ private: // helpers, for structors, below
);
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename Variant>
typename boost::enable_if<boost::is_rvalue_reference<Variant&&> >::type convert_construct_variant(Variant&& operand)
{
@@ -1664,7 +1547,6 @@ private: // helpers, for structors, below
, is_foreign_variant()
);
}
#endif
template <BOOST_VARIANT_ENUM_PARAMS(typename U)>
typename boost::enable_if<mpl::or_<
@@ -1687,10 +1569,9 @@ private: // helpers, for structors, below
, long
)
{
convert_construct_variant(operand);
convert_construct_variant(operand);
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <BOOST_VARIANT_ENUM_PARAMS(typename U)>
typename boost::enable_if<mpl::or_<
boost::is_same<boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>, variant>,
@@ -1700,9 +1581,8 @@ private: // helpers, for structors, below
, long
)
{
convert_construct_variant( detail::variant::move(operand) );
convert_construct_variant( detail::variant::move(operand) );
}
#endif
public: // structors, cont.
@@ -1712,8 +1592,9 @@ public: // structors, cont.
mpl::and_<
mpl::not_< boost::is_same<T, variant> >,
boost::detail::variant::is_variant_constructible_from<const T&, internal_types>
>,
boost::is_same<T, boost::recursive_variant_> > >::type* = 0)
>,
boost::is_same<T, boost::recursive_variant_> >,
bool >::type = true)
{
convert_construct(operand, 1L);
}
@@ -1727,13 +1608,13 @@ public: // structors, cont.
mpl::not_< boost::is_same<T, variant> >,
boost::detail::variant::is_variant_constructible_from<T&, internal_types>
>,
boost::is_same<T, boost::recursive_variant_> > >::type* = 0
boost::is_same<T, boost::recursive_variant_> >,
bool >::type = true
)
{
convert_construct(operand, 1L);
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <class T>
variant(T&& operand,
typename boost::enable_if<mpl::or_<
@@ -1743,11 +1624,11 @@ public: // structors, cont.
mpl::not_< boost::is_same<T, variant> >,
boost::detail::variant::is_variant_constructible_from<T&&, internal_types>
>,
boost::is_same<T, boost::recursive_variant_> > >::type* = 0)
boost::is_same<T, boost::recursive_variant_> >,
bool >::type = true)
{
convert_construct( detail::variant::move(operand), 1L);
}
#endif
public: // structors, cont.
@@ -1762,7 +1643,6 @@ public: // structors, cont.
indicate_which(operand.which());
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
variant(variant&& operand) BOOST_NOEXCEPT_IF(variant_move_noexcept_constructible::type::value)
{
// Move the value of operand into *this...
@@ -1772,14 +1652,11 @@ public: // structors, cont.
// ...and activate the *this's primary storage on success:
indicate_which(operand.which());
}
#endif
private: // helpers, for modifiers (below)
# if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template <typename Variant>
friend class detail::variant::backup_assigner;
# endif
// class assigner
//
@@ -1926,10 +1803,9 @@ private: // helpers, for modifiers (below)
assigner& operator= (assigner const&);
#endif
};
friend class assigner;
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
// class move_assigner
//
// Internal visitor that "move assigns" the visited value to the given variant
@@ -1947,7 +1823,7 @@ private: // helpers, for modifiers (below)
}
private: // helpers, for internal visitor interface (below)
template <typename RhsT, typename B2>
void assign_impl(
RhsT& rhs_content
@@ -2007,7 +1883,7 @@ private: // helpers, for modifiers (below)
// In the event of success, indicate new content type:
assigner::lhs_.indicate_which(assigner::rhs_which_); // nothrow
}
template <typename RhsT>
void assign_impl(
RhsT& rhs_content
@@ -2047,7 +1923,6 @@ private: // helpers, for modifiers (below)
};
friend class move_assigner;
#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
void variant_assign(const variant& rhs)
{
@@ -2062,11 +1937,10 @@ private: // helpers, for modifiers (below)
{
// Otherwise, perform general (copy-based) variant assignment:
assigner visitor(*this, rhs.which());
rhs.internal_apply_visitor(visitor);
rhs.internal_apply_visitor(visitor);
}
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
void variant_assign(variant&& rhs)
{
// If the contained types are EXACTLY the same...
@@ -2080,10 +1954,9 @@ private: // helpers, for modifiers (below)
{
// Otherwise, perform general (move-based) variant assignment:
move_assigner visitor(*this, rhs.which());
rhs.internal_apply_visitor(visitor);
rhs.internal_apply_visitor(visitor);
}
}
#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
private: // helpers, for modifiers (below)
@@ -2105,7 +1978,6 @@ private: // helpers, for modifiers (below)
}
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename T>
void move_assign(T&& rhs)
{
@@ -2123,11 +1995,10 @@ private: // helpers, for modifiers (below)
variant_assign( detail::variant::move(temp) );
}
}
#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
public: // modifiers
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#if !BOOST_WORKAROUND(BOOST_CLANG_VERSION, BOOST_TESTED_AT(150000)) || BOOST_CXX_VERSION <= 202002L
template <class T>
typename boost::enable_if<
boost::mpl::and_<
@@ -2136,12 +2007,12 @@ public: // modifiers
boost::detail::variant::is_variant_constructible_from<T&&, internal_types>
>,
variant&
>::type operator=(T&& rhs)
>::type operator=(T&& rhs)
{
move_assign( detail::variant::move(rhs) );
return *this;
}
#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
#endif
template <typename T>
typename boost::enable_if<
@@ -2163,8 +2034,7 @@ public: // modifiers
return *this;
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
variant& operator=(variant&& rhs)
variant& operator=(variant&& rhs)
#if !defined(__GNUC__) || (__GNUC__ != 4) || (__GNUC_MINOR__ > 6) || defined(__clang__)
BOOST_NOEXCEPT_IF(variant_move_noexcept_constructible::type::value && variant_move_noexcept_assignable::type::value)
#endif
@@ -2172,7 +2042,6 @@ public: // modifiers
variant_assign( detail::variant::move(rhs) );
return *this;
}
#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
void swap(variant& rhs)
{
@@ -2314,7 +2183,7 @@ public:
#endif// !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template <typename Visitor, typename VoidPtrCV>
static typename Visitor::result_type
BOOST_FORCEINLINE static typename Visitor::result_type
internal_apply_visitor_impl(
int internal_which
, int logical_which
@@ -2339,7 +2208,7 @@ public:
}
template <typename Visitor>
typename Visitor::result_type
BOOST_FORCEINLINE typename Visitor::result_type
internal_apply_visitor(Visitor& visitor)
{
return internal_apply_visitor_impl(
@@ -2348,7 +2217,7 @@ public:
}
template <typename Visitor>
typename Visitor::result_type
BOOST_FORCEINLINE typename Visitor::result_type
internal_apply_visitor(Visitor& visitor) const
{
return internal_apply_visitor_impl(
@@ -2358,8 +2227,6 @@ public:
public: // visitation support
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
template <typename Visitor>
typename Visitor::result_type
apply_visitor(Visitor& visitor) &&
@@ -2376,14 +2243,9 @@ public: // visitation support
return this->internal_apply_visitor(invoker);
}
#endif
template <typename Visitor>
typename Visitor::result_type
apply_visitor(Visitor& visitor)
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
&
#endif
apply_visitor(Visitor& visitor) &
{
detail::variant::invoke_visitor<Visitor, false> invoker(visitor);
return this->internal_apply_visitor(invoker);
@@ -2391,10 +2253,7 @@ public: // visitation support
template <typename Visitor>
typename Visitor::result_type
apply_visitor(Visitor& visitor) const
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
&
#endif
apply_visitor(Visitor& visitor) const &
{
detail::variant::invoke_visitor<Visitor, false> invoker(visitor);
return this->internal_apply_visitor(invoker);
+2 -154
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003 Eric Friedman, Itay Maman
// Copyright (c) 2013-2019 Antony Polukhin
// Copyright (c) 2013-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -25,15 +25,6 @@
#include <boost/preprocessor/enum_shifted_params.hpp>
#include <boost/preprocessor/repeat.hpp>
///////////////////////////////////////////////////////////////////////////////
// macro BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT
//
// Defined if variant does not support make_variant_over (see below).
//
#if defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
# define BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT
#endif
///////////////////////////////////////////////////////////////////////////////
// macro BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT
//
@@ -45,37 +36,6 @@
#include <boost/variant/detail/substitute_fwd.hpp>
#if defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) \
&& !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT)
# define BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT
#endif
///////////////////////////////////////////////////////////////////////////////
// macro BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
//
/*
GCC before 4.0 had no variadic tempaltes;
GCC 4.6 has incomplete implementation of variadic templates.
MSVC2015 Update 1 has variadic templates, but they have issues.
NOTE: Clang compiler defines __GNUC__
*/
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) \
|| (!defined(__clang__) && defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 7)) \
|| (defined(_MSC_VER) && (_MSC_VER <= 1900)) \
|| defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) \
|| defined (BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT)
#ifndef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
# define BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
#endif
#endif
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
#include <boost/preprocessor/seq/size.hpp>
#define BOOST_VARIANT_CLASS_OR_TYPENAME_TO_SEQ_class class)(
@@ -108,9 +68,6 @@
// Rationale: Cleaner, simpler code for clients of variant library. Minimal
// code modifications to move from C++03 to C++11.
//
// With BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES defined
// will be used BOOST_VARIANT_ENUM_PARAMS and BOOST_VARIANT_ENUM_SHIFTED_PARAMS from below `#else`
//
#define BOOST_VARIANT_ENUM_PARAMS(x) \
x ## 0, \
@@ -121,49 +78,6 @@
BOOST_VARIANT_MAKE_VARIADIC( (BOOST_VARIANT_CLASS_OR_TYPENAME_TO_SEQ_ ## x), x) \
/**/
#else // defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
///////////////////////////////////////////////////////////////////////////////
// macro BOOST_VARIANT_LIMIT_TYPES
//
// Implementation-defined preprocessor symbol describing the actual
// length of variant's pseudo-variadic template parameter list.
//
#include <boost/mpl/limits/list.hpp>
#define BOOST_VARIANT_LIMIT_TYPES \
BOOST_MPL_LIMIT_LIST_SIZE
///////////////////////////////////////////////////////////////////////////////
// macro BOOST_VARIANT_RECURSIVE_VARIANT_MAX_ARITY
//
// Exposes maximum allowed arity of class templates with recursive_variant
// arguments. That is,
// make_recursive_variant< ..., T<[1], recursive_variant_, ... [N]> >.
//
#include <boost/mpl/limits/arity.hpp>
#define BOOST_VARIANT_RECURSIVE_VARIANT_MAX_ARITY \
BOOST_MPL_LIMIT_METAFUNCTION_ARITY
///////////////////////////////////////////////////////////////////////////////
// macro BOOST_VARIANT_ENUM_PARAMS
//
// Convenience macro for enumeration of BOOST_VARIANT_LIMIT_TYPES params.
//
// Rationale: Cleaner, simpler code for clients of variant library.
//
#define BOOST_VARIANT_ENUM_PARAMS( param ) \
BOOST_PP_ENUM_PARAMS(BOOST_VARIANT_LIMIT_TYPES, param)
///////////////////////////////////////////////////////////////////////////////
// macro BOOST_VARIANT_ENUM_SHIFTED_PARAMS
//
// Convenience macro for enumeration of BOOST_VARIANT_LIMIT_TYPES-1 params.
//
#define BOOST_VARIANT_ENUM_SHIFTED_PARAMS( param ) \
BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_VARIANT_LIMIT_TYPES, param)
#endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES workaround
namespace boost {
@@ -195,75 +109,9 @@ struct convert_void< void_ >
typedef mpl::na type;
};
///////////////////////////////////////////////////////////////////////////////
// (workaround) BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
//
// Needed to work around compilers that don't support using-declaration
// overloads. (See the variant::initializer workarounds below.)
//
#if defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
// (detail) tags voidNN -- NN defined on [0, BOOST_VARIANT_LIMIT_TYPES)
//
// Defines void types that are each unique and specializations of
// convert_void that yields mpl::na for each voidNN type.
//
#define BOOST_VARIANT_DETAIL_DEFINE_VOID_N(z,N,_) \
struct BOOST_PP_CAT(void,N); \
\
template <> \
struct convert_void< BOOST_PP_CAT(void,N) > \
{ \
typedef mpl::na type; \
}; \
/**/
BOOST_PP_REPEAT(
BOOST_VARIANT_LIMIT_TYPES
, BOOST_VARIANT_DETAIL_DEFINE_VOID_N
, _
)
#undef BOOST_VARIANT_DETAIL_DEFINE_VOID_N
#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround
}} // namespace detail::variant
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
# define BOOST_VARIANT_AUX_DECLARE_PARAMS BOOST_VARIANT_ENUM_PARAMS(typename T)
#else // defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
///////////////////////////////////////////////////////////////////////////////
// (detail) macro BOOST_VARIANT_AUX_DECLARE_PARAM
//
// Template parameter list for variant and recursive_variant declarations.
//
#if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
# define BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL(z, N, T) \
typename BOOST_PP_CAT(T,N) = detail::variant::void_ \
/**/
#else // defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)
# define BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL(z, N, T) \
typename BOOST_PP_CAT(T,N) = BOOST_PP_CAT(detail::variant::void,N) \
/**/
#endif // BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE workaround
#define BOOST_VARIANT_AUX_DECLARE_PARAMS \
BOOST_PP_ENUM( \
BOOST_VARIANT_LIMIT_TYPES \
, BOOST_VARIANT_AUX_DECLARE_PARAMS_IMPL \
, T \
) \
/**/
#endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES workaround
#define BOOST_VARIANT_AUX_DECLARE_PARAMS BOOST_VARIANT_ENUM_PARAMS(typename T)
///////////////////////////////////////////////////////////////////////////////
// class template variant (concept inspired by Andrei Alexandrescu)
+28 -2
View File
@@ -1,9 +1,35 @@
<!DOCTYPE html>
<!--
Copyright 2014-2026 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/variant.html">
<title>Boost.Variant</title>
<style>
body {
background: #fff;
color: #000;
}
a {
color: #00f;
text-decoration: none;
}
</style>
</head>
<body>
Automatic redirection failed, please go to
<a href="../../doc/html/variant.html">../../doc/html/variant.html</a>
<p>
Automatic redirection failed, please go to
<a href="../../doc/html/variant.html">../../doc/html/variant.html</a>
</p>
<p>
&copy; 2014-2024 Antony Polukhin
</p>
</body>
</html>
+2 -1
View File
@@ -13,5 +13,6 @@
"maintainers": [
"Antony Polukhin <antoshkka -at- gmail.com>",
"Eric Friedman <ericbrandon -at- gmail.com>"
]
],
"cxxstd": "11"
}
+1 -1
View File
@@ -1,5 +1,5 @@
#==============================================================================
# Copyright (c) 2012-2019 Antony Polukhin
# Copyright (c) 2012-2026 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)
+1 -1
View File
@@ -1,4 +1,4 @@
// (C) Copyright Antony Polukhin 2012-2014.
// (C) Copyright Antony Polukhin 2012-2021.
// 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)
+17 -10
View File
@@ -1,19 +1,25 @@
# Boost.Variant Library test Jamfile
#
# Copyright (C) 2003, Eric Friedman, Itay Maman.
# Copyright (C) 2013-2019 Antony Polukhin.
# Copyright (C) 2013-2026 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
# http://www.boost.org/LICENSE_1_0.txt)
#
require-b2 5.0.1 ;
import-search /boost/config/checks ;
import config : requires ;
import testing ;
local below-c++14 = 98 03 0x 11 ;
local below_cpp14 = 98 03 0x 11 ;
local since_cpp20 = 2a 20 latest ;
project
: requirements
<library>/boost/variant//boost_variant
[ requires cxx11_rvalue_references ]
<toolset>msvc:<asynch-exceptions>on
;
test-suite variant
@@ -27,15 +33,16 @@ test-suite variant
[ run test6.cpp : : : : variant_test6 ]
[ run test7.cpp : : : : variant_test7 ]
[ run test8.cpp : : : : variant_test8 ]
[ run test9.cpp : : : : variant_test9 ]
[ run test9.cpp : : : <library>/boost/fusion//boost_fusion : variant_test9 ]
[ run recursive_variant_test.cpp ]
[ run variant_reference_test.cpp ]
[ run variant_comparison_test.cpp ]
[ run variant_visit_internal_linkage.cpp : : : "<cxxstd>$(below-c++14)":<build>no ]
[ run variant_visit_internal_linkage.cpp : : : "<cxxstd>$(below_cpp14)"\:<build>no ]
[ run variant_visit_test.cpp ]
[ run variant_get_test.cpp ]
[ compile-fail variant_rvalue_get_with_ampersand_test.cpp ]
[ compile-fail no_rvalue_to_nonconst_visitation.cpp ]
[ compile fusion_interop.cpp : <library>/boost/fusion//boost_fusion ]
[ run variant_polymorphic_get_test.cpp ]
[ run variant_multivisit_test.cpp ]
[ run hash_variant_test.cpp ]
@@ -54,13 +61,13 @@ test-suite variant
[ run recursive_variant_test.cpp : : : <rtti>off <define>BOOST_NO_RTTI <define>BOOST_NO_TYPEID : variant_no_rtti_test ]
[ run hash_recursive_variant_test.cpp ]
[ run variant_swap_test.cpp ]
[ run auto_visitors.cpp ]
[ run auto_visitors.cpp : : : <library>/boost/lexical_cast//boost_lexical_cast ]
[ run issue42.cpp ]
#[ run issue53.cpp ]
[ run overload_selection.cpp ]
[ run recursive_wrapper_move_test.cpp ]
[ compile issue53.cpp : <library>/boost/thread//boost_thread ]
[ run overload_selection.cpp : : : "<cxxstd>$(since_cpp20)"\:<build>no ]
[ run recursive_wrapper_move_test.cpp : : : <library>/boost/array//boost_array ]
[ run variant_over_joint_view_test.cpp ]
[ run const_ref_apply_visitor.cpp ]
;
[ run const_ref_apply_visitor.cpp : : : <library>/boost/lexical_cast//boost_lexical_cast ]
;
+12 -13
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
@@ -21,7 +21,7 @@ init:
# From this point and below code is same for all the Boost libs
###############################################################################################################
version: 1.69.{build}-{branch}
version: 1.71.{build}-{branch}
# branches to build
branches:
@@ -32,26 +32,25 @@ skip_tags: true
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1,clang-win
CXXSTD: 14,17
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ADDPATH: C:\cygwin\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ADDPATH: C:\cygwin64\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
VARIANT: release # "variant_get_test.o: File too big" errors in debug
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
ADDPATH: C:\mingw\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
# MinGW 32-bit is not supported by Boost.System any more
# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
# ADDPATH: C:\mingw\bin;
# TOOLSET: gcc
# CXXSTD: 03,11,14,1z
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
ADDPATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64\bin;
TOOLSET: gcc
CXXSTD: 03,11,14,1z
@@ -63,9 +62,9 @@ before_build:
- echo "Testing %APPVEYOR_PROJECT_NAME%"
# Cloning Boost libraries (fast nondeep cloning)
- set BOOST=C:/boost-local
- git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git %BOOST%
- git clone -b %BOOST_BRANCH% --depth 10 https://github.com/boostorg/boost.git %BOOST%
- cd %BOOST%
- git submodule update --init --depth 1 tools/build tools/boostdep
- git submodule update --init --depth 10 tools/build tools/boostdep
- rm -rf %BOOST%/libs/%BOOST_LIBS_FOLDER%
- mv -f %APPVEYOR_BUILD_FOLDER% %BOOST%/libs/%BOOST_LIBS_FOLDER%
+10 -20
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2014-2019 Antony Polukhin
// Copyright (c) 2014-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -188,12 +188,6 @@ struct lex_streamer2 {
}
};
#ifndef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
# define BOOST_TEST_IF_HAS_VARIADIC(x) BOOST_TEST(x)
#else
# define BOOST_TEST_IF_HAS_VARIADIC(x) /**/
#endif
void run()
{
typedef boost::variant<int, std::string, double> variant_type;
@@ -201,9 +195,9 @@ void run()
lex_streamer lex_streamer_visitor;
BOOST_TEST(boost::apply_visitor(lex_streamer(), v1) == "1");
BOOST_TEST_IF_HAS_VARIADIC(boost::apply_visitor(lex_streamer_visitor)(v1) == "1");
BOOST_TEST(boost::apply_visitor(lex_streamer_visitor)(v1) == "1");
BOOST_TEST(boost::apply_visitor(lex_streamer(), v2) == "10");
BOOST_TEST_IF_HAS_VARIADIC(boost::apply_visitor(lex_streamer_visitor)(v2) == "10");
BOOST_TEST(boost::apply_visitor(lex_streamer_visitor)(v2) == "10");
#ifndef BOOST_NO_CXX14_GENERIC_LAMBDAS
BOOST_TEST(boost::apply_visitor([](auto v) { return boost::lexical_cast<std::string>(v); }, v1) == "1");
@@ -220,16 +214,16 @@ void run()
lex_streamer2 visitor_ref;
BOOST_TEST(boost::apply_visitor(visitor_ref, v1) == "1");
BOOST_TEST(boost::apply_visitor(visitor_ref, v2) == "10");
#ifndef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
std::string& ref_to_string = boost::apply_visitor(visitor_ref, v1);
BOOST_TEST(ref_to_string == "1");
#endif
lex_streamer_void lex_streamer_void_visitor;
boost::apply_visitor(lex_streamer_void(), v1);
boost::apply_visitor(lex_streamer_void(), v2);
#ifndef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
boost::apply_visitor(lex_streamer_void_visitor)(v2);
#endif
boost::ignore_unused(lex_streamer_visitor, visitor_ref, lex_streamer_void_visitor);
}
@@ -258,7 +252,7 @@ void run2()
BOOST_TEST(boost::apply_visitor(lex_combine(), v1, v2) == "1+10");
BOOST_TEST(boost::apply_visitor(lex_combine(), v2, v1) == "10+1");
BOOST_TEST_IF_HAS_VARIADIC(boost::apply_visitor(lex_combine_visitor)(v2, v1) == "10+1");
BOOST_TEST(boost::apply_visitor(lex_combine_visitor)(v2, v1) == "10+1");
#ifndef BOOST_NO_CXX14_GENERIC_LAMBDAS
@@ -291,10 +285,9 @@ void run2()
lex_streamer2 visitor_ref;
BOOST_TEST(boost::apply_visitor(visitor_ref, v1, v2) == "1+10");
BOOST_TEST(boost::apply_visitor(visitor_ref, v2, v1) == "10+1");
#ifndef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
std::string& ref_to_string = boost::apply_visitor(visitor_ref)(v1, v2);
BOOST_TEST(ref_to_string == "1+10");
#endif
boost::apply_visitor(lex_streamer_void(), v1, v2);
boost::apply_visitor(lex_streamer_void(), v2, v1);
@@ -302,11 +295,8 @@ void run2()
boost::ignore_unused(lex_combine_visitor, visitor_ref);
}
#undef BOOST_TEST_IF_HAS_VARIADIC
void run3()
{
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
typedef boost::variant<int, std::string, double> variant_type;
variant_type v1(1), v2("10"), v3(100);
lex_combine lex_combine_visitor;
@@ -363,7 +353,7 @@ void run3()
boost::apply_visitor(lex_streamer_void(), v1, v2, v1);
boost::apply_visitor(lex_streamer_void(), v2, v1, v1);
boost::apply_visitor(lex_streamer_void_visitor)(v2, v1, v1);
#endif // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
}
#endif
+3 -2
View File
@@ -13,7 +13,8 @@
#include <algorithm> // for std::swap
#include <sstream>
#include <iostream>
#include <assert.h>
#include <boost/assert.hpp>
#include "class_a.h"
@@ -22,7 +23,7 @@ using namespace std;
class_a::~class_a()
{
assert(self_p_ == this);
BOOST_ASSERT(self_p_ == this);
}
class_a::class_a(int n)
+48 -76
View File
@@ -29,13 +29,11 @@ struct construction_logger
std::cout << val_ << " copy constructed\n";
}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
construction_logger(construction_logger&& cl) :
val_(cl.val_)
{
std::cout << val_ << " move constructed\n";
}
#endif
friend std::ostream& operator << (std::ostream& os, const construction_logger& cl)
{
@@ -71,14 +69,11 @@ struct lex_streamer_explicit : boost::static_visitor<std::string>
struct lvalue_rvalue_detector : boost::static_visitor<std::string>
{
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <class T>
std::string operator()(T&&) const
{
if (std::is_lvalue_reference<T>::value)
return "lvalue reference";
else
return "rvalue reference";
return std::is_lvalue_reference<T>::value ? "lvalue reference"
: "rvalue reference";
}
template <class T, class V>
@@ -98,31 +93,6 @@ struct lvalue_rvalue_detector : boost::static_visitor<std::string>
{
return operator()(std::forward<T>(t), std::forward<V>(v), std::forward<P>(p)) + ", " + operator()(std::forward<S>(s));
}
#else
template <class T>
std::string operator()(T&) const
{
return "lvalue reference";
}
template <class T, class V>
std::string operator()(T&, V&) const
{
return "lvalue reference, lvalue reference";
}
template <class T, class V, class P>
std::string operator()(T&, V&, P&) const
{
return "lvalue reference, lvalue reference, lvalue reference";
}
template <class T, class V, class P, class S>
std::string operator()(T&, V&, P&, S&) const
{
return "lvalue reference, lvalue reference, lvalue reference, lvalue reference";
}
#endif
};
typedef boost::variant<construction_logger, std::string> variant_type;
@@ -149,8 +119,6 @@ void test_const_ref_parameter4(const variant_type& test_var, const variant_type&
== "lvalue reference, lvalue reference, lvalue reference, lvalue reference");
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_REF_QUALIFIERS)
void test_rvalue_parameter(variant_type&& test_var)
{
std::cout << "Testing rvalue visitable\n";
@@ -168,17 +136,13 @@ void test_rvalue_parameter2(variant_type&& test_var, variant_type&& test_var2)
void test_rvalue_parameter4(variant_type&& test_var, variant_type&& test_var2, variant_type&& test_var3, variant_type&& test_var4)
{
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
std::cout << "Testing rvalue visitable with multivisitor\n";
auto result = boost::apply_visitor(lvalue_rvalue_detector(), std::move(test_var), std::move(test_var2), std::move(test_var3), std::move(test_var4));
std::cout << "result: " << result << std::endl;
BOOST_TEST(result == "rvalue reference, rvalue reference, rvalue reference, rvalue reference");
#endif
}
#endif
#ifndef BOOST_NO_CXX14_DECLTYPE_AUTO
#define FORWARD(x) std::forward<decltype(x)>(x)
@@ -207,14 +171,44 @@ void test_cpp14_visitor(const variant_type& test_var, const variant_type& test_v
void test_cpp14_visitor(const variant_type& test_var, const variant_type& test_var2, const variant_type& test_var3)
{
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
std::cout << "Testing const lvalue visitable for c++14\n";
auto result = boost::apply_visitor([](auto&& v, auto&& t, auto&& p) { return lvalue_rvalue_detector()(FORWARD(v), FORWARD(t), FORWARD(p)); },
test_var, test_var2, test_var3);
std::cout << "result: " << result << std::endl;
BOOST_TEST(result == "lvalue reference, lvalue reference, lvalue reference");
#endif
}
void test_cpp14_visitor(variant_type& test_var)
{
std::cout << "Testing lvalue visitable for c++14\n";
BOOST_TEST(boost::apply_visitor([](auto& v) { return lvalue_rvalue_detector()(v); }, test_var) == "lvalue reference");
}
void test_cpp14_mutable_visitor(variant_type& test_var)
{
std::cout << "Testing lvalue visitable for c++14 with inline mutable lambda\n";
BOOST_TEST(boost::apply_visitor([](auto& v) mutable -> auto { return lvalue_rvalue_detector()(v); }, test_var) == "lvalue reference");
}
void test_cpp14_visitor(variant_type& test_var, variant_type& test_var2)
{
std::cout << "Testing lvalue visitable for c++14\n";
BOOST_TEST(boost::apply_visitor([](auto& v, auto& vv) { return lvalue_rvalue_detector()(v, vv); }, test_var, test_var2)
== "lvalue reference, lvalue reference");
}
void test_cpp14_visitor(variant_type& test_var, variant_type& test_var2, variant_type& test_var3)
{
std::cout << "Testing lvalue visitable for c++14\n";
auto result = boost::apply_visitor([](auto& v, auto& t, auto& p) { return lvalue_rvalue_detector()(v, t, p); },
test_var, test_var2, test_var3);
std::cout << "result: " << result << std::endl;
BOOST_TEST(result == "lvalue reference, lvalue reference, lvalue reference");
}
void test_cpp14_visitor(variant_type&& test_var)
@@ -234,17 +228,15 @@ void test_cpp14_visitor(variant_type&& test_var, variant_type&& test_var2)
void test_cpp14_visitor(variant_type&& test_var, variant_type&& test_var2, variant_type&& test_var3)
{
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
std::cout << "Testing rvalue visitable for c++14\n";
auto result = boost::apply_visitor([](auto&& v, auto&& t, auto&& p) { return lvalue_rvalue_detector()(FORWARD(v), FORWARD(t), FORWARD(p)); },
std::move(test_var), std::move(test_var2), std::move(test_var3));
std::cout << "result: " << result << std::endl;
BOOST_TEST(result == "rvalue reference, rvalue reference, rvalue reference");
#endif
}
#endif
#endif // #ifndef BOOST_NO_CXX14_DECLTYPE_AUTO
void run_const_lvalue_ref_tests()
{
@@ -256,53 +248,29 @@ void run_const_lvalue_ref_tests()
void run_rvalue_ref_tests()
{
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_REF_QUALIFIERS)
variant_type v1(10), v2(20), v3(30);
test_rvalue_parameter(boost::move(v1));
test_rvalue_parameter2(boost::move(v2), boost::move(v3));
test_rvalue_parameter(std::move(v1));
test_rvalue_parameter2(std::move(v2), std::move(v3));
variant_type vv1(100), vv2(200), vv3(300), vv4(400);
test_rvalue_parameter4(boost::move(vv1), boost::move(vv2), boost::move(vv3), boost::move(vv4));
#endif
test_rvalue_parameter4(std::move(vv1), std::move(vv2), std::move(vv3), std::move(vv4));
}
void run_mixed_tests()
{
variant_type v1(1), v2(2);
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#ifndef BOOST_NO_CXX11_REF_QUALIFIERS
std::cout << "Testing lvalue + rvalue visitable\n";
BOOST_TEST(boost::apply_visitor(lvalue_rvalue_detector(), v1, variant_type(10)) == "lvalue reference, rvalue reference");
std::cout << "Testing rvalue + lvalue visitable\n";
BOOST_TEST(boost::apply_visitor(lvalue_rvalue_detector(), variant_type(10), v1) == "rvalue reference, lvalue reference");
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
std::cout << "Testing rvalue + lvalue + rvalue visitable\n";
BOOST_TEST(boost::apply_visitor(lvalue_rvalue_detector(), variant_type(10), v1, variant_type(20)) == "rvalue reference, lvalue reference, rvalue reference");
std::cout << "Testing lvalue + rvalue + lvalue + rvalue visitable\n";
BOOST_TEST(boost::apply_visitor(lvalue_rvalue_detector(), v1, variant_type(10), v2, variant_type(20)) == "lvalue reference, rvalue reference, lvalue reference, rvalue reference");
#endif
#endif // #ifndef BOOST_NO_CXX11_REF_QUALIFIERS
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
std::cout << "Testing lvalue + rvalue visitable\n";
BOOST_TEST(boost::apply_visitor(lvalue_rvalue_detector(), v1, v1) == "lvalue reference, lvalue reference");
std::cout << "Testing rvalue + lvalue visitable\n";
BOOST_TEST(boost::apply_visitor(lvalue_rvalue_detector(), static_cast<const variant_type&>(variant_type(10)), v1) == "lvalue reference, lvalue reference");
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
std::cout << "Testing rvalue + lvalue + rvalue visitable\n";
BOOST_TEST(boost::apply_visitor(lvalue_rvalue_detector(), static_cast<const variant_type&>(variant_type(10)), v1, static_cast<const variant_type&>(variant_type(20))) == "lvalue reference, lvalue reference, lvalue reference");
std::cout << "Testing lvalue + rvalue + lvalue + rvalue visitable\n";
BOOST_TEST(boost::apply_visitor(lvalue_rvalue_detector(), v1, static_cast<const variant_type&>(variant_type(10)), v2, static_cast<const variant_type&>(variant_type(20))) == "lvalue reference, lvalue reference, lvalue reference, lvalue reference");
#endif
#endif
}
void run_cpp14_mixed_tests()
@@ -318,7 +286,6 @@ void run_cpp14_mixed_tests()
BOOST_TEST(boost::apply_visitor([](auto&& v, auto&& t) { return lvalue_rvalue_detector()(FORWARD(v), FORWARD(t)); },
variant_type(10), v1) == "rvalue reference, lvalue reference");
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
std::cout << "Testing rvalue + lvalue + lvalue visitable\n";
BOOST_TEST(boost::apply_visitor([](auto&& v, auto&& t, auto&& p) { return lvalue_rvalue_detector()(FORWARD(v), FORWARD(t), FORWARD(p)); },
variant_type(10), v1, v2) == "rvalue reference, lvalue reference, lvalue reference");
@@ -326,25 +293,30 @@ void run_cpp14_mixed_tests()
std::cout << "Testing lvalue + rvalue + lvalue visitable\n";
BOOST_TEST(boost::apply_visitor([](auto&& v, auto&& t, auto&& p) { return lvalue_rvalue_detector()(FORWARD(v), FORWARD(t), FORWARD(p)); },
v1, variant_type(10), v2) == "lvalue reference, rvalue reference, lvalue reference");
#endif
#endif
#endif // #ifndef BOOST_NO_CXX14_DECLTYPE_AUTO
}
void run_cpp14_tests()
{
#ifndef BOOST_NO_CXX14_DECLTYPE_AUTO
variant_type const c1(10), c2(20), c3(30);
variant_type v1(10), v2(20), v3(30);
test_cpp14_visitor(c1);
test_cpp14_mutable_visitor(c1);
test_cpp14_visitor(c2, c3);
test_cpp14_visitor(c1, c2, c3);
test_cpp14_visitor(v1);
test_cpp14_mutable_visitor(v1);
test_cpp14_visitor(v2, v3);
test_cpp14_visitor(v1, v2, v3);
test_cpp14_visitor(boost::move(v1));
test_cpp14_visitor(boost::move(v2), boost::move(v3));
test_cpp14_visitor(std::move(v1));
test_cpp14_visitor(std::move(v2), std::move(v3));
variant_type vv1(100), vv2(200), vv3(300);
test_cpp14_visitor(boost::move(vv1), boost::move(vv2), boost::move(vv3));
test_cpp14_visitor(std::move(vv1), std::move(vv2), std::move(vv3));
#endif
}
+29
View File
@@ -0,0 +1,29 @@
// Copyright (c) 2021-2026 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)
// Test case from https://svn.boost.org/trac10/ticket/8721
#include <boost/variant.hpp>
#include <boost/fusion/include/vector.hpp>
struct emptyList {};
typedef boost::make_recursive_variant
< emptyList
, boost::fusion::vector
< int
, boost::recursive_variant_
>
>::type IntList;
const emptyList el = emptyList();
const IntList nil( el );
IntList cons( int head, IntList tail )
{
return IntList( boost::fusion::vector<int, IntList>( head, tail ) );
}
+2 -2
View File
@@ -28,8 +28,8 @@ template <typename T>
using basic_set_t = std::unordered_set<T, hash>;
using value_t = boost::make_recursive_variant<
int_t,
basic_set_t<boost::recursive_variant_>
int_t,
basic_set_t<boost::recursive_variant_>
>::type;
using set_t = basic_set_t<value_t>;
+22 -6
View File
@@ -1,16 +1,32 @@
// Copyright (c) 2011-2018
// Antony Polukhin
// Copyright (c) 2011-2026 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/config.hpp"
#include "boost/variant.hpp"
#include "boost/functional/hash/hash.hpp"
void run()
{
#if !defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) && !defined(BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH)
#include <unordered_set>
void test_std_hash() {
std::unordered_set<boost::variant<int, bool> > us;
us.insert(1);
us.insert(true);
BOOST_TEST(us.size() == 2);
}
#else
void test_std_hash() {}
#endif
void run() {
typedef boost::variant<bool, int, unsigned int, char> variant_type;
boost::hash<variant_type> hasher;
@@ -30,9 +46,9 @@ void run()
BOOST_TEST(hasher(char_variant2) == hasher(char_variant2));
}
int main()
{
int main() {
run();
test_std_hash();
return boost::report_errors();
}
+1 -1
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2018-2019 Antony Polukhin
// Copyright (c) 2018-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
+1 -1
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2019 Antony Polukhin
// Copyright (c) 2019-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
+1 -1
View File
@@ -27,7 +27,7 @@
#include "boost/type_index.hpp"
#include "boost/detail/workaround.hpp"
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551))
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0551))
# pragma warn -lvc
#endif
+1 -1
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2017-2019 Antony Polukhin
// Copyright (c) 2017-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
+1 -1
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2016-2019 Antony Polukhin
// Copyright (c) 2016-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
+14 -7
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003 Eric Friedman, Itay Maman
// Copyright (c) 2013-2019 Antony Polukhin
// Copyright (c) 2013-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -29,9 +29,9 @@
#include <sstream>
#include <vector>
#include <map>
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
#include <tuple>
#endif // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
struct Nil {};
struct printer
: boost::static_visitor<std::string>
@@ -59,7 +59,6 @@ struct printer
return ost.str();
}
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
template <int...> struct indices {};
template <typename... Ts, int... Is>
std::string operator()(const std::tuple<Ts...>& tup, indices<Is...>) const
@@ -81,7 +80,6 @@ struct printer
{
return printer()(tup, make_indices<sizeof...(Ts)>());
}
#endif // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
template <typename T>
std::string operator()(const T& operand) const
@@ -213,7 +211,6 @@ void test_recursive_variant()
>::type var6_t;
var6_t var6;
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
typedef boost::make_recursive_variant<
int,
std::tuple<int, boost::recursive_variant_>
@@ -226,7 +223,6 @@ void test_recursive_variant()
std::cout << "result7: " << result7 << '\n';
BOOST_TEST(result7 == "( 2 ( 1 0 ) ) ");
#endif // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
}
void test_recursive_variant_over()
@@ -355,10 +351,21 @@ void test_recursive_variant_over()
BOOST_TEST(result5 == "( 3.5 ( 3 5 ( 3 5 ) 7 ) 17.25 ) ");
}
void test_recursive_variant_from_variant()
{
// See https://github.com/boostorg/variant/issues/100
typedef boost::variant<Nil, double> Atom;
typedef boost::variant<Nil, boost::recursive_wrapper<Atom> > Variant;
BOOST_STATIC_ASSERT(!boost::is_constructible<Variant, Atom>::value);
BOOST_STATIC_ASSERT(boost::is_constructible<boost::variant<Nil, Atom>, Atom>::value);
}
int main()
{
test_recursive_variant();
test_recursive_variant_over();
test_recursive_variant_from_variant();
return boost::report_errors();
}
-1
View File
@@ -15,7 +15,6 @@
// is_noexcept_move_constructible
#include <string>
#include <iterator>
#include <boost/variant.hpp>
#include <boost/array.hpp>
+12 -71
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2012-2019 Antony Polukhin
// Copyright (c) 2012-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -17,7 +17,6 @@
#include "boost/mpl/bool.hpp"
#include <boost/blank.hpp>
#include <boost/swap.hpp>
namespace swap_ambiguouty_test_ns {
struct A {};
@@ -39,11 +38,11 @@ public:
static unsigned int copy_count;
move_copy_conting_class(){}
move_copy_conting_class(BOOST_RV_REF(move_copy_conting_class) ) {
move_copy_conting_class(move_copy_conting_class&& ) {
++ moves_count;
}
move_copy_conting_class& operator=(BOOST_RV_REF(move_copy_conting_class) ) {
move_copy_conting_class& operator=(move_copy_conting_class&& ) {
++ moves_count;
return *this;
}
@@ -51,7 +50,7 @@ public:
move_copy_conting_class(const move_copy_conting_class&) {
++ copy_count;
}
move_copy_conting_class& operator=(BOOST_COPY_ASSIGN_REF(move_copy_conting_class) ) {
move_copy_conting_class& operator=(const move_copy_conting_class& ) {
++ copy_count;
return *this;
}
@@ -60,53 +59,6 @@ public:
unsigned int move_copy_conting_class::moves_count = 0;
unsigned int move_copy_conting_class::copy_count = 0;
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
void run()
{
// Making sure that internals of Boost.Move do not interfere with
// internals of Boost.Variant and in case of C++03 or C++98 compilation
// is still possible.
typedef boost::variant<int, move_copy_conting_class> variant_I_type;
variant_I_type v1, v2;
v1 = move_copy_conting_class();
v2 = v1;
v2 = boost::move(v1);
v1.swap(v2);
move_copy_conting_class val;
v2 = boost::move(val);
v2 = 10;
variant_I_type v3(boost::move(val));
variant_I_type v4(boost::move(v1));
}
void run1()
{
BOOST_TEST(true);
}
void run_move_only()
{
BOOST_TEST(true);
}
void run_moves_are_noexcept()
{
BOOST_TEST(true);
}
void run_const_rvalues()
{
BOOST_TEST(true);
}
#else
void run()
{
typedef boost::variant<int, move_copy_conting_class> variant_I_type;
@@ -131,7 +83,7 @@ void run()
move_copy_conting_class::moves_count = 0;
move_copy_conting_class::copy_count = 0;
v2 = boost::move(v1);
v2 = std::move(v1);
// Assuring that `move_copy_conting_class` in v1 was moved at least once and was not copied
BOOST_TEST(move_copy_conting_class::moves_count != 0);
BOOST_TEST(move_copy_conting_class::copy_count == 0);
@@ -139,7 +91,7 @@ void run()
v1 = move_copy_conting_class();
move_copy_conting_class::moves_count = 0;
move_copy_conting_class::copy_count = 0;
v2 = boost::move(v1);
v2 = std::move(v1);
// Assuring that `move_copy_conting_class` in v1 was moved at least once and was not copied
BOOST_TEST(move_copy_conting_class::moves_count != 0);
BOOST_TEST(move_copy_conting_class::copy_count == 0);
@@ -155,19 +107,19 @@ void run()
variant_II_type v3;
move_copy_conting_class::moves_count = 0;
move_copy_conting_class::copy_count = 0;
v1 = boost::move(v3);
v1 = std::move(v3);
// Assuring that `move_copy_conting_class` in v3 was moved at least once (v1 and v3 have different types)
BOOST_TEST(move_copy_conting_class::moves_count != 0);
move_copy_conting_class::moves_count = 0;
move_copy_conting_class::copy_count = 0;
v2 = boost::move(v1);
v2 = std::move(v1);
// Assuring that `move_copy_conting_class` in v1 was moved at least once (v1 and v3 have different types)
BOOST_TEST(move_copy_conting_class::moves_count != 0);
move_copy_conting_class::moves_count = 0;
move_copy_conting_class::copy_count = 0;
variant_I_type v5(boost::move(v1));
variant_I_type v5(std::move(v1));
// Assuring that `move_copy_conting_class` in v1 was moved at least once and was not copied
BOOST_TEST(move_copy_conting_class::moves_count != 0);
BOOST_TEST(move_copy_conting_class::copy_count == 0);
@@ -187,7 +139,7 @@ void run1()
move_copy_conting_class c1;
typedef boost::variant<int, move_copy_conting_class> variant_I_type;
variant_I_type v1(boost::move(c1));
variant_I_type v1(std::move(c1));
// Assuring that `move_copy_conting_class` was not copyied
BOOST_TEST(move_copy_conting_class::copy_count == 0);
@@ -267,19 +219,16 @@ void run_const_rvalues()
v4 = get_string();
v5 = get_variant();
v6 = get_variant2();
v7 = boost::move(v1);
v7 = std::move(v1);
}
#endif
struct nothrow_copyable_throw_movable {
nothrow_copyable_throw_movable(){}
nothrow_copyable_throw_movable(const nothrow_copyable_throw_movable&) BOOST_NOEXCEPT {}
nothrow_copyable_throw_movable& operator=(const nothrow_copyable_throw_movable&) BOOST_NOEXCEPT { return *this; }
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
nothrow_copyable_throw_movable(nothrow_copyable_throw_movable&&) BOOST_NOEXCEPT_IF(false) {}
nothrow_copyable_throw_movable& operator=(nothrow_copyable_throw_movable&&) BOOST_NOEXCEPT_IF(false) { return *this; }
#endif
};
// This test is created to cover the following situation:
@@ -320,13 +269,5 @@ int main()
run_const_rvalues();
run_is_container_compilation_test();
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ > 6)
# ifdef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES
BOOST_TEST(false &&
"Something wrong with macro definitions. GCC-4.7+ is known to work with variadic templates"
);
# endif
#endif
return boost::report_errors();
}
+1 -1
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2016-2019 Antony Polukhin
// Copyright (c) 2016-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
+2 -2
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003 Eric Friedman, Itay Maman
// Copyright (c) 2014-2019 Antony Polukhin
// Copyright (c) 2014-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -21,7 +21,7 @@
#include <vector>
#include "boost/detail/workaround.hpp"
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551))
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x0551))
# pragma warn -lvc // temporary used for parameter warning
#endif
+4 -3
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2014-2019 Antony Polukhin
// Copyright (c) 2014-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -11,6 +11,7 @@
#ifdef _MSC_VER
#pragma warning(disable: 4127) // conditional expression is constant
#pragma warning(disable: 4181) // qualifier applied to reference type; ignored
#endif
#include "boost/variant/get.hpp"
@@ -385,7 +386,7 @@ inline void get_rvref_test()
boost::variant<MoveonlyType, int> v;
v = MoveonlyType();
boost::get<MoveonlyType>(boost::move(v));
boost::get<MoveonlyType>(std::move(v));
v = 3;
@@ -395,7 +396,7 @@ inline void get_rvref_test()
boost::relaxed_get<MoveonlyType&>(boost::variant<MoveonlyType, int>());
v = MoveonlyType();
MoveonlyType moved_from_variant(boost::get<MoveonlyType>(boost::move(v)));
MoveonlyType moved_from_variant(boost::get<MoveonlyType>(std::move(v)));
}
#endif // BOOST_NO_CXX11_RVALUE_REFERENCES
+14 -17
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2013-2019 Antony Polukhin
// Copyright (c) 2013-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -25,7 +25,7 @@ struct my_noncopyable : boost::noncopyable {
typedef boost::variant<my_noncopyable, int> variant_noncopy_t;
typedef boost::variant<char, unsigned char, signed char, unsigned short, int, unsigned int> variant6_t;
typedef boost::variant<char, unsigned char, signed char, unsigned short, int> variant5_t;
struct test_visitor: boost::static_visitor<> {
// operators that shall not be called
@@ -107,25 +107,24 @@ int main()
{
test_visitor v;
variant6_t v_array6[6];
v_array6[0] = char(0);
v_array6[1] = static_cast<unsigned char>(1);
v_array6[2] = static_cast<signed char>(2);
v_array6[3] = static_cast<unsigned short>(3);
v_array6[4] = static_cast<int>(4);
v_array6[5] = static_cast<unsigned int>(5);
variant5_t v_array5[5];
v_array5[0] = char(0);
v_array5[1] = static_cast<unsigned char>(1);
v_array5[2] = static_cast<signed char>(2);
v_array5[3] = static_cast<unsigned short>(3);
v_array5[4] = static_cast<int>(4);
boost::apply_visitor(v, v_array6[0], v_array6[1], v_array6[2]);
boost::apply_visitor(test_visitor(), v_array6[0], v_array6[1], v_array6[2]);
boost::apply_visitor(v, v_array5[0], v_array5[1], v_array5[2]);
boost::apply_visitor(test_visitor(), v_array5[0], v_array5[1], v_array5[2]);
// Following test also pass, but requires many Gigabytes of RAM for compilation and compile for about 15 minutes
//#define BOOST_VARIANT_MULTIVISITORS_TEST_VERY_EXTREME
#ifdef BOOST_VARIANT_MULTIVISITORS_TEST_VERY_EXTREME
boost::apply_visitor(v, v_array6[0], v_array6[1], v_array6[2], v_array6[3]);
boost::apply_visitor(test_visitor(), v_array6[0], v_array6[1], v_array6[2], v_array6[3]);
boost::apply_visitor(v, v_array5[0], v_array5[1], v_array5[2], v_array5[3]);
boost::apply_visitor(test_visitor(), v_array5[0], v_array5[1], v_array5[2], v_array5[3]);
boost::apply_visitor(v, v_array6[0], v_array6[1], v_array6[2], v_array6[3], v_array6[4]);
boost::apply_visitor(test_visitor(), v_array6[0], v_array6[1], v_array6[2], v_array6[3], v_array6[4]);
boost::apply_visitor(v, v_array5[0], v_array5[1], v_array5[2], v_array5[3], v_array5[4]);
boost::apply_visitor(test_visitor(), v_array5[0], v_array5[1], v_array5[2], v_array5[3], v_array5[4]);
#endif
bool_like_t v0(1), v1(true), v2(1.0);
@@ -136,14 +135,12 @@ int main()
arithmetics_t(true)
);
#if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
if_visitor if_vis;
BOOST_TEST(
boost::apply_visitor(if_vis)(v0, v1, v2)
==
arithmetics_t(true)
);
#endif
variant_noncopy_t vnonc[6];
+1 -1
View File
@@ -3,7 +3,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2014-2019 Antony Polukhin
// Copyright (c) 2014-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
+1 -1
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003 Eric Friedman
// Copyright (c) 2013-2019 Antony Polukhin
// Copyright (c) 2013-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -13,7 +13,6 @@
#include "boost/variant/variant.hpp"
#include "boost/core/lightweight_test.hpp"
#include <boost/move/move.hpp>
#include <boost/static_assert.hpp>
#include <string>
@@ -29,7 +28,7 @@ inline void run()
var_t v = s;
// must spit an error at compile-time because of 'std::string&'
std::string new_s = boost::strict_get<std::string&>(boost::move(v));
std::string new_s = boost::strict_get<std::string&>(std::move(v));
UNUSED(new_s);
#else
BOOST_STATIC_ASSERT_MSG(false, "Dummy compile-time error to pass the test on C++03");
+1 -1
View File
@@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
//
// Copyright (c) 2009 ArtVPS Ltd.
// Copyright (c) 2013-2019 Antony Polukhin.
// Copyright (c) 2013-2026 Antony Polukhin.
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
+2 -2
View File
@@ -79,7 +79,7 @@ struct rvalue_ref_decltype_visitor
#endif
template <typename Checker, typename Variant>
inline void unary_test(Variant& var, Checker* = 0)
inline void unary_test(Variant& var, Checker* = nullptr)
{
Checker checker;
const Checker& const_checker = checker;
@@ -97,7 +97,7 @@ inline void unary_test(Variant& var, Checker* = 0)
}
template <typename Checker, typename Variant1, typename Variant2>
inline void binary_test(Variant1& var1, Variant2& var2, Checker* = 0)
inline void binary_test(Variant1& var1, Variant2& var2, Checker* = nullptr)
{
Checker checker;
const Checker& const_checker = checker;