Compare commits

...

49 Commits

Author SHA1 Message Date
Antony Polukhin 827dd94c68 Update copyright years 2026-01-02 13:40:23 +03:00
dependabot[bot] 782e083f61 Bump actions/checkout from 2 to 6 (#32)
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-26 22:04:25 +03:00
Antony Polukhin 1e6424563d Add dependabot 2025-12-24 20:19:01 +03:00
Antony Polukhin 6632ca9309 Run all the tests in CMake, add CMake runs into CI. Drop dependency on Boost.SmartPtr as it is not used by the library for some time (#31) 2025-10-07 20:26:12 +03:00
Antony Polukhin b74a4c34cb Allow using polymorphic_downcast and polymorphic_cast in constexpr (#30) 2025-06-27 20:42:54 +03:00
Antony Polukhin 452adac97f CI fixes 2025-06-27 17:33:16 +03:00
Antony Polukhin 5f82d5aa7d Update regression test links in Readme and fix typos 2025-06-19 09:27:35 +03:00
Antony Polukhin 9d64c899df Update copyright years 2025-01-05 19:37:56 +03:00
Antony Polukhin 35a71f0701 Prefer "using" over "typedef" 2024-12-17 16:37:40 +03:00
René Ferdinand Rivera Morell 8a860e05d0 Add support for modular build structure. (#29)
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

This PR will be changed to ready for review, i.e. not draft, when the above are merged. Do not merge this one until that time.
2024-08-24 12:37:14 +03:00
Danil Sidoruk 9f285ef0c4 Remove mentions of lexical_cast in docs (#28)
lexical_cast isn't a part of Boost.Conversion, it's part of Boost.Lexical_Cast
2024-01-21 14:13:03 +03:00
Antony Polukhin 5f36c2c710 Update tests requirements 2024-01-21 14:08:52 +03:00
Antony Polukhin 41e62ed851 Update copyright years 2024-01-07 13:20:12 +03:00
Antony Polukhin 5cf5f78376 Restore Boost::smart_ptr dependency in CMakeLists 2023-08-27 13:28:45 +03:00
Antony Polukhin 5a3587c988 simplify code 2023-08-26 21:45:41 +03:00
Antony Polukhin f7f3c9b5ce Merge branch 'drop-cpp03' into develop 2023-08-25 15:00:40 +03:00
Antony Polukhin 668030fcd6 Remove hard error about C++11 requirement and update CI 2023-08-25 14:59:53 +03:00
Mohammad Nejati 0d60a3f7ce Use relative URL for redirect in index.html (#26) 2023-08-12 10:53:42 +03:00
Antony Polukhin 0ff5adc258 Merge pull request #27 from boostorg/drop-cpp03
Drop c++03 support
2023-08-12 10:45:01 +03:00
Antony Polukhin 2598281d10 drop c++03 support 2023-08-10 18:52:03 +03:00
Antony Polukhin a1104f580c update CI setup 2023-05-21 09:42:12 +03:00
Antony Polukhin 9a03296816 add C++03 deprecation warnings 2023-05-14 19:49:21 +03:00
Antony Polukhin 7ba0984b34 Update copyright years 2023-01-19 10:01:52 +03:00
Antony Polukhin 4ae8b4d495 update copyright years 2022-01-30 12:52:42 +03:00
Antony Polukhin 71b6a864a4 do not use depth 1 for checkouts in CI 2021-09-20 21:46:36 +03:00
Antony Polukhin b2a49138cf Fix appveyor CI checks for MSVC 2021-09-11 12:29:42 +03:00
Antony Polukhin 00f06d3549 Update appveyor CI badge link 2021-09-11 12:08:35 +03:00
Antony Polukhin 968dfd47f1 remove clang-9 from test matrix 2021-09-10 20:39:56 +03:00
Antony Polukhin f0fe02f7d6 use builtin rules for toolsets 2021-09-10 20:32:09 +03:00
Antony Polukhin 19b5a1cf29 remove ubuntu-16.04 matrix entries in CI 2021-09-10 20:25:17 +03:00
Peter Dimov 1a2e4fd8ef Update CMakeLists.txt 2021-06-10 01:17:02 +03:00
Antony Polukhin 8d1721f312 use HTTPS links in Readme 2021-04-27 10:07:49 +03:00
Antony Polukhin c6ab56e983 memory sanitizer is triggered by libstdc++, so disable it 2021-04-25 21:17:35 +03:00
Antony Polukhin 1c62347706 use more sanitizers 2021-04-25 20:32:49 +03:00
Antony Polukhin 56becb8fee update of the Github Actions to the latest version 2021-04-24 19:13:17 +03:00
Antony Polukhin 67ae26b0f0 update Readme links [skip ci] 2021-04-22 11:25:59 +03:00
Antony Polukhin d4e593120d update CI: depinst.py the Boost.Filesystem before copying the library content 2021-04-21 21:06:41 +03:00
Antony Polukhin 76ed70b0b1 update CI: overwrite the target dir 2021-04-21 20:59:46 +03:00
Antony Polukhin 4b7d551907 remove drone CI in favour of default github actions from CppAlliance 2021-04-21 20:53:38 +03:00
Antony Polukhin 9e3216d22f make boost::implicit_cast constexpr (fixes #25) 2021-04-21 20:51:14 +03:00
Antony Polukhin 4e557d31d1 fix broken links (fixes #23) 2021-04-21 20:50:26 +03:00
Antony Polukhin 46695ffb86 update CI: use workflow from boost.Any 2021-04-21 20:47:14 +03:00
Antony Polukhin c1c098fac1 update CI (5): update readme links 2021-04-18 21:20:23 +03:00
Antony Polukhin b171fe1ff6 update CI (4): more fixes for coverage 2021-04-18 20:14:15 +03:00
Antony Polukhin a178d1a691 update CI (3): fixes for coverage 2021-04-18 20:05:00 +03:00
Antony Polukhin 5176e189b8 update CI (2): inspect tool options 2021-04-18 19:50:46 +03:00
Antony Polukhin 49e6421271 update CI (1): simplify and decompose ci.yaml 2021-04-18 19:42:45 +03:00
Antony Polukhin a0bfc39077 Merge pull request #24 from sdarwin/githubactions
GitHub Actions config
2021-04-18 14:11:15 +03:00
sdarwin 2bf2bba4be Add GitHub Actions config [ci skip] 2021-03-04 18:22:48 +00:00
22 changed files with 365 additions and 379 deletions
-24
View File
@@ -1,24 +0,0 @@
# Use, modification, and distribution are
# subject to the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt)
#
# Copyright Rene Rivera 2020.
# For Drone CI we use the Starlark scripting language to reduce duplication.
# As the yaml syntax for Drone CI is rather limited.
#
#
globalenv={}
linuxglobalimage="cppalliance/droneubuntu1604:1"
windowsglobalimage="cppalliance/dronevs2019"
def main(ctx):
return [
linux_cxx("GCC-8", "g++", packages="g++-8", buildtype="empty-c9a1002e88", buildscript="drone", image=linuxglobalimage, environment={'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"', 'GCOVTOOL': 'gcov-8', 'DRONE_JOB_UUID': 'b6589fc6ab'}, globalenv=globalenv, privileged=True),
linux_cxx("GCC-4.6", "g++", packages="g++-4.6", buildtype="empty-c9a1002e88", buildscript="drone", image=linuxglobalimage, environment={'B2_ARGS': 'cxxstd=98,0x toolset=gcc-4.6 cxxflags="--coverage -DBOOST_TRAVISCI_BUILD" linkflags="--coverage"', 'GCOVTOOL': 'gcov-4.6', 'DRONE_JOB_UUID': '356a192b79'}, globalenv=globalenv, privileged=True),
linux_cxx("Clang-7", "g++", packages="clang++-7", llvm_os="xenial", llvm_ver="7", buildtype="empty-c9a1002e88", buildscript="drone", image=linuxglobalimage, environment={'B2_ARGS': 'cxxstd=98,03,11,14,1z toolset=clang-7 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -fsanitize=address,leak,undefined"', 'GCOVTOOL': 'gcov_for_clang.sh', 'DRONE_JOB_UUID': 'da4b9237ba'}, globalenv=globalenv, privileged=True),
linux_cxx("Clang-3.8, libc++", "g++", packages="libc++-dev", buildtype="empty-c9a1002e88", buildscript="drone", image=linuxglobalimage, environment={'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"', 'GCOVTOOL': 'gcov_for_clang.sh', 'DRONE_JOB_UUID': '77de68daec'}, globalenv=globalenv, privileged=True),
]
# from https://github.com/boostorg/boost-ci
load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx")
-30
View File
@@ -1,30 +0,0 @@
#!/bin/bash
# Copyright 2020 Rene Rivera, Sam Darwin
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt)
if [ "$DRONE_JOB_UUID" = "b6589fc6ab" ] || [ "$DRONE_JOB_UUID" = "356a192b79" ] || [ "$DRONE_JOB_UUID" = "da4b9237ba" ] || [ "$DRONE_JOB_UUID" = "77de68daec" ] ; then
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.14.zip
unzip v1.14.zip
LCOV="`pwd`/lcov-1.14/bin/lcov --gcov-tool $GCOVTOOL"
mkdir -p ~/.local/bin
echo -e '#!/bin/bash\nexec llvm-cov gcov "$@"' > ~/.local/bin/gcov_for_clang.sh
chmod 755 ~/.local/bin/gcov_for_clang.sh
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
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
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"
cd $TRAVIS_BUILD_DIR
gem install coveralls-lcov || echo "ERROR. Failed to install coveralls-lcov"
coveralls-lcov coverals/coverage.info
fi
-37
View File
@@ -1,37 +0,0 @@
#!/bin/bash
# Copyright 2020 Rene Rivera, Sam Darwin
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt)
if [ "$DRONE_JOB_UUID" = "b6589fc6ab" ] || [ "$DRONE_JOB_UUID" = "356a192b79" ] || [ "$DRONE_JOB_UUID" = "da4b9237ba" ] || [ "$DRONE_JOB_UUID" = "77de68daec" ] ; then
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
IGNORE_COVERAGE=''
BOOST_LIBS_FOLDER=$(basename $REPO_NAME)
UBSAN_OPTIONS=print_stacktrace=1
LSAN_OPTIONS=verbosity=1:log_threads=1
BOOST=$HOME/boost-local
git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git $BOOST
cd $BOOST
git submodule update --init --depth 10 --jobs 2 tools/build tools/boostdep tools/inspect libs/filesystem
python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST/libs/filesystem
echo "Testing $BOOST/libs/$BOOST_LIBS_FOLDER moved from $TRAVIS_BUILD_DIR, branch $BOOST_BRANCH"
rm -rf $BOOST/libs/$BOOST_LIBS_FOLDER || true
cp -rp $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
./bootstrap.sh
./b2 headers
./b2 -j4 variant=debug tools/inspect/build
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 ;" >> ~/user-config.jam
echo "using clang : 8 : clang++-8 ;" >> ~/user-config.jam
echo "using clang : libc++ : clang++-libc++ ;" >> ~/user-config.jam
cd $BOOST/libs/$BOOST_LIBS_FOLDER/test/
fi
-36
View File
@@ -1,36 +0,0 @@
#!/bin/bash
# Copyright 2020 Rene Rivera, Sam Darwin
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt)
set -e
set -x
export TRAVIS_BUILD_DIR=$(pwd)
export DRONE_BUILD_DIR=$(pwd)
export TRAVIS_BRANCH=$DRONE_BRANCH
export VCS_COMMIT_ID=$DRONE_COMMIT
export GIT_COMMIT=$DRONE_COMMIT
export REPO_NAME=$DRONE_REPO
export PATH=~/.local/bin:/usr/local/bin:$PATH
if [ "$DRONE_JOB_BUILDTYPE" == "empty-c9a1002e88" ]; then
echo '==================================> BEFORE_INSTALL'
. .drone/before-install.sh
echo '==================================> INSTALL'
echo '==================================> SCRIPT'
sh -c "../../../b2 -j2 $B2_ARGS"
../../../dist/bin/inspect .. -license -copyright -crlf -end -path_name -tab -ascii -apple_macro -assert_macro -deprecated_macro -minmax -unnamed
echo '==================================> AFTER_SUCCESS'
. $DRONE_BUILD_DIR/.drone/after-success.sh
fi
+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"
+182
View File
@@ -0,0 +1,182 @@
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-14 # Do not remove! It is the only toolset that tests CMake tests down below
cxxstd: "03,11,14,17,20"
os: ubuntu-24.04
- 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"
- toolset: clang
compiler: clang++-14
cxxstd: "03,11,14,17,2a"
os: ubuntu-22.04
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 -j4 variant=debug tools/inspect
- name: Run CMake tests
if: ${{matrix.toolset == 'gcc-14'}}
run: |
cd ../boost-root/
mkdir __build
cd __build
cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=conversion -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_C_COMPILER=gcc-14 ..
cmake --build . --target tests
ctest --output-on-failure --no-tests=error
cd ..
rm -rf __build
- 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-14.3
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
- name: Run CMake tests
if: ${{matrix.toolset == 'msvc-14.3'}}
shell: cmd
run: |
choco install --no-progress ninja
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsall.bat" x64
cd ../boost-root/
mkdir __build
cd __build
cmake -DBUILD_TESTING=1 -DBOOST_INCLUDE_LIBRARIES=conversion ..
cmake --build . --target tests --config Debug
ctest --output-on-failure --no-tests=error -C Debug
cd ..
rm -rf __build
- 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
-151
View File
@@ -1,151 +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-2021.
#
# 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 #10
language: cpp
os: linux
# `--coverage` flags required to generate coverage info for Coveralls
matrix:
include:
- 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"' GCOVTOOL='gcov-8'
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"' GCOVTOOL='gcov-4.6'
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-7 cxxflags="--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD" linkflags="--coverage -fsanitize=address,leak,undefined"' GCOVTOOL='gcov_for_clang.sh'
name: "Clang-7"
sudo: required # Required by leak sanitizer
addons:
apt:
sources: llvm-toolchain-trusty-7
packages: clang++-7
- 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"' GCOVTOOL='gcov_for_clang.sh'
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:
# 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
# Cloning minimal set of Boost libraries
- BOOST=$HOME/boost-local
- git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git $BOOST
- cd $BOOST
- git submodule update --init --depth 10 --jobs 2 tools/build tools/boostdep tools/inspect libs/filesystem
- python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST/libs/filesystem
# 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
- ./b2 -j4 variant=debug tools/inspect/build
- |-
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 ;" >> ~/user-config.jam
echo "using clang : 8 : clang++-8 ;" >> ~/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"
- ../../../dist/bin/inspect .. -license -copyright -crlf -end -path_name -tab -ascii -apple_macro -assert_macro -deprecated_macro -minmax -unnamed
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.14.zip
- unzip v1.14.zip
- LCOV="`pwd`/lcov-1.14/bin/lcov --gcov-tool $GCOVTOOL"
- mkdir -p ~/.local/bin
- echo -e '#!/bin/bash\nexec llvm-cov gcov "$@"' > ~/.local/bin/gcov_for_clang.sh
- chmod 755 ~/.local/bin/gcov_for_clang.sh
# 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
+6 -9
View File
@@ -1,12 +1,9 @@
# 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
#
# NOTE: CMake support for Boost.Conversion is currently experimental at best
# and the interface is likely to change in the future
cmake_minimum_required( VERSION 3.5 )
project( BoostConversion LANGUAGES CXX )
cmake_minimum_required( VERSION 3.5...4.20 )
project( boost_conversion VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX )
add_library( boost_conversion INTERFACE )
add_library( Boost::conversion ALIAS boost_conversion )
@@ -17,9 +14,9 @@ target_link_libraries( boost_conversion
INTERFACE
Boost::assert
Boost::config
Boost::core
Boost::smart_ptr
Boost::throw_exception
Boost::type_traits
Boost::typeof
)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
+6 -7
View File
@@ -1,16 +1,15 @@
# [Boost.Conversion](http://boost.org/libs/conversion)
Boost.Conversion is one of the [Boost C++ Libraries](http://github.com/boostorg). This library improves program safety and clarity by performing otherwise messy conversions.
# [Boost.Conversion](https://boost.org/libs/conversion)
Boost.Conversion is one of the [Boost C++ Libraries](https://github.com/boostorg). This library improves program safety and clarity by performing otherwise messy conversions.
### Test results
@ | Build | Tests coverage | More info
----------------|-------------- | -------------- |-----------
Develop branch: | [![Build Status](https://travis-ci.org/apolukhin/conversion.svg?branch=develop)](https://travis-ci.org/apolukhin/conversion) [![Build status](https://ci.appveyor.com/api/projects/status/yep84179w535pppg/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/conversion/branch/develop) | [![Coverage Status](https://coveralls.io/repos/apolukhin/conversion/badge.png?branch=develop)](https://coveralls.io/r/apolukhin/conversion?branch=develop) | [details...](http://www.boost.org/development/tests/develop/developer/conversion.html)
Master branch: | [![Build Status](https://travis-ci.org/apolukhin/conversion.svg?branch=master)](https://travis-ci.org/apolukhin/conversion) [![Build status](https://ci.appveyor.com/api/projects/status/yep84179w535pppg/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/conversion/branch/master) | [![Coverage Status](https://coveralls.io/repos/apolukhin/conversion/badge.png?branch=master)](https://coveralls.io/r/apolukhin/conversion?branch=master) | [details...](http://www.boost.org/development/tests/master/developer/conversion.html)
Develop branch: | [![CI](https://github.com/boostorg/conversion/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/conversion/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/1cky1hrunfa46bdx/branch/develop?svg=true)](https://ci.appveyor.com/project/apolukhin/conversion/branch/develop) | [![Coverage Status](https://coveralls.io/repos/github/boostorg/conversion/badge.svg?branch=develop)](https://coveralls.io/github/boostorg/conversion?branch=develop) | [details...](https://regression.boost.io/develop/developer/conversion.html)
Master branch: | [![CI](https://github.com/boostorg/conversion/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/conversion/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/1cky1hrunfa46bdx/branch/master?svg=true)](https://ci.appveyor.com/project/apolukhin/conversion/branch/master) | [![Coverage Status](https://coveralls.io/repos/github/boostorg/conversion/badge.svg?branch=master)](https://coveralls.io/github/boostorg/conversion?branch=master) | [details...](https://regression.boost.io/master/developer/conversion.html)
[Open Issues](https://svn.boost.org/trac/boost/query?status=!closed&component=conversion&or&status=!closed&component=lexical_cast)
[Latest developer documentation](https://www.boost.org/doc/libs/develop/doc/html/conversion.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).
+25
View File
@@ -0,0 +1,25 @@
# 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/throw_exception//boost_throw_exception ;
project /boost/conversion
: common-requirements
<include>include
;
explicit
[ alias boost_conversion : : : : <library>$(boost_dependencies) ]
[ alias all : boost_conversion test ]
;
call-if : boost-library conversion
;
+10 -13
View File
@@ -1,6 +1,6 @@
[/
Copyright 2016 Mikhail Maximov.
Copyright 2020-2021 Antony Polukhin.
Copyright Antony Polukhin, 2020-2026.
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)
@@ -12,7 +12,7 @@
[id conversion]
[version 1.7]
[authors [Stroustrup, Bjarne], [Abrahams, Dave], [Rasin, Boris], [Polukhin, Antony]]
[copyright 2001 Beman Dawes, 2014-2021 Antony Polukhin]
[copyright 2001 Beman Dawes, 2014-2026 Antony Polukhin]
[license
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
@@ -30,8 +30,7 @@ The Conversion Library improves program safety and clarity by performing
otherwise messy conversions. It includes cast-style function templates designed
to complement the C++ Standard's built-in casts.
To reduce coupling, particularly to standard library IOStreams,
the Boost Conversion Library is supplied by several headers:
To reduce coupling, the Boost Conversion Library is supplied by several headers:
# The [@boost:boost/polymorphic_cast.hpp boost/polymorphic_cast.hpp] header
provides [link polymorphic_cast `polymorphic_cast<>`] and
@@ -42,8 +41,6 @@ the Boost Conversion Library is supplied by several headers:
[link polymorphic_pointer_cast `polymorphic_pointer_downcast<>`]
# The [@boost:boost/implicit_cast.hpp boost/implicit_cast.hpp] header provides `implicit_cast<>`
to perform implicit casts only (no down-cast, no void*->T*, no U->T if T has only explicit constructors for U).
# The [@boost:boost/lexical_cast.hpp boost/lexical_cast.hpp] header
provides [@boost:libs/lexical_cast/doc/html/index.html `lexical_cast<>`] general literal text conversions, such as an `int` represented as a `string`, or vice-versa.
[endsect]
@@ -153,10 +150,10 @@ This includes C++ built-in pointers, `std::shared_ptr`,
class Banana : public Fruit {};
// Use one of these:
typedef Fruit* FruitPtr;
typedef std::shared_ptr<Fruit> FruitPtr;
typedef boost::shared_ptr<Fruit> FruitPtr;
typedef boost::intrusive_ptr<Fruit> FruitPtr;
using FruitPtr = Fruit*;
using FruitPtr = std::shared_ptr<Fruit>;
using FruitPtr = boost::shared_ptr<Fruit>;
using FruitPtr = boost::intrusive_ptr<Fruit>;
void f(FruitPtr fruit) {
// ... logic which leads us to believe it is a banana
@@ -176,17 +173,17 @@ This includes C++ built-in pointers, `std::shared_ptr`,
// Throws: std::bad_cast if ( dynamic_cast<Derived>(x) == 0 )
// Returns: dynamic_cast<Derived>(x)
template <class Derived, class Base>
inline Derived polymorphic_cast(Base* x);
constexpr Derived polymorphic_cast(Base* x);
// Effects: assert( dynamic_cast<Derived>(x) == x );
// Returns: static_cast<Derived>(x)
template <class Derived, class Base>
inline Derived polymorphic_downcast(Base* x);
constexpr Derived polymorphic_downcast(Base* x);
// Effects: assert( dynamic_cast<Derived>(&x) == &x );
// Returns: static_cast<Derived>(x)
template <class Derived, class Base>
inline Derived polymorphic_downcast(Base& x);
constexpr Derived polymorphic_downcast(Base& x);
// Throws: std::bad_cast if ( dynamic_pointer_cast<Derived>(x) == 0 )
// Returns: dynamic_pointer_cast<Derived>(x)
+7 -2
View File
@@ -6,13 +6,18 @@
#ifndef BOOST_IMPLICIT_CAST_DWA200356_HPP
#define BOOST_IMPLICIT_CAST_DWA200356_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
namespace boost {
namespace detail {
template<class T> struct icast_identity
{
typedef T type;
using type = T;
};
} // namespace detail
@@ -23,7 +28,7 @@ template<class T> struct icast_identity
// The use of identity creates a non-deduced form, so that the
// explicit template argument must be supplied
template <typename T>
inline T implicit_cast (typename boost::detail::icast_identity<T>::type x) {
constexpr T implicit_cast (typename boost::detail::icast_identity<T>::type x) {
return x;
}
+19 -13
View File
@@ -14,7 +14,7 @@
// 08 Nov 14 Add polymorphic_pointer_downcast (Boris Rasin)
// 09 Jun 14 "cast.hpp" was renamed to "polymorphic_cast.hpp" and
// inclusion of numeric_cast was removed (Antony Polukhin)
// 23 Jun 05 numeric_cast removed and redirected to the new verion (Fernando Cacciola)
// 23 Jun 05 numeric_cast removed and redirected to the new version (Fernando Cacciola)
// 02 Apr 01 Removed BOOST_NO_LIMITS workarounds and included
// <boost/limits.hpp> instead (the workaround did not
// actually compile when BOOST_NO_LIMITS was defined in
@@ -31,7 +31,7 @@
// 19 Oct 00 Fix numeric_cast for floating-point types (Dave Abrahams)
// 15 Jul 00 Suppress numeric_cast warnings for GCC, Borland and MSVC
// (Dave Abrahams)
// 30 Jun 00 More MSVC6 wordarounds. See comments below. (Dave Abrahams)
// 30 Jun 00 More MSVC6 workarounds. See comments below. (Dave Abrahams)
// 28 Jun 00 Removed implicit_cast<>. See comment below. (Beman Dawes)
// 27 Jun 00 More MSVC6 workarounds
// 15 Jun 00 Add workarounds for MSVC6
@@ -49,20 +49,24 @@
#ifndef BOOST_POLYMORPHIC_CAST_HPP
#define BOOST_POLYMORPHIC_CAST_HPP
# include <boost/config.hpp>
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
# include <boost/assert.hpp>
# include <boost/core/addressof.hpp>
# include <boost/core/enable_if.hpp>
# include <boost/throw_exception.hpp>
# include <boost/type_traits/is_reference.hpp>
# include <boost/type_traits/remove_reference.hpp>
# include <memory> // std::addressof
# include <typeinfo>
# include <type_traits>
#if defined(__cpp_constexpr) && __cpp_constexpr >= 201907L
#define BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST constexpr
#else
#define BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST inline
#endif
namespace boost
{
@@ -76,7 +80,7 @@ namespace boost
// section 15.8 exercise 1, page 425.
template <class Target, class Source>
inline Target polymorphic_cast(Source* x)
BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST Target polymorphic_cast(Source* x)
{
Target tmp = dynamic_cast<Target>(x);
if ( tmp == 0 ) boost::throw_exception( std::bad_cast() );
@@ -95,7 +99,7 @@ namespace boost
// Contributed by Dave Abrahams
template <class Target, class Source>
inline Target polymorphic_downcast(Source* x)
BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST Target polymorphic_downcast(Source* x)
{
BOOST_ASSERT( dynamic_cast<Target>(x) == x ); // detect logic error
return static_cast<Target>(x);
@@ -111,16 +115,18 @@ namespace boost
// Contributed by Julien Delacroix
template <class Target, class Source>
inline typename boost::enable_if_c<
boost::is_reference<Target>::value, Target
BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST typename std::enable_if<
std::is_reference<Target>::value, Target
>::type polymorphic_downcast(Source& x)
{
typedef typename boost::remove_reference<Target>::type* target_pointer_type;
using target_pointer_type = typename std::remove_reference<Target>::type*;
return *boost::polymorphic_downcast<target_pointer_type>(
boost::addressof(x)
std::addressof(x)
);
}
} // namespace boost
#undef BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST
#endif // BOOST_POLYMORPHIC_CAST_HPP
+13 -31
View File
@@ -1,5 +1,6 @@
// boost polymorphic_pointer_cast.hpp header file ----------------------------------------------//
// (C) Copyright Boris Rasin and Antony Polukhin 2014-2021.
// (C) Copyright Boris Rasin, 2014-2021.
// (C) Copyright Antony Polukhin, 2014-2026.
// 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)
@@ -9,19 +10,16 @@
#ifndef BOOST_CONVERSION_POLYMORPHIC_POINTER_CAST_HPP
#define BOOST_CONVERSION_POLYMORPHIC_POINTER_CAST_HPP
# include <boost/config.hpp>
# include <boost/assert.hpp>
# include <boost/pointer_cast.hpp>
# include <boost/throw_exception.hpp>
# include <boost/utility/declval.hpp>
# ifdef BOOST_NO_CXX11_DECLTYPE
# include <boost/typeof/typeof.hpp>
# endif
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
# include <boost/assert.hpp>
# include <boost/pointer_cast.hpp>
# include <boost/throw_exception.hpp>
namespace boost
{
// See the documentation for descriptions of how to choose between
@@ -40,36 +38,20 @@ namespace boost
// Contributed by Boris Rasin
namespace detail
{
template <typename Target, typename Source>
struct dynamic_pointer_cast_result
{
#ifdef BOOST_NO_CXX11_DECLTYPE
BOOST_TYPEOF_NESTED_TYPEDEF_TPL(nested, dynamic_pointer_cast<Target>(boost::declval<Source>()))
typedef typename nested::type type;
#else
typedef decltype(dynamic_pointer_cast<Target>(boost::declval<Source>())) type;
#endif
};
}
template <typename Target, typename Source>
inline typename detail::dynamic_pointer_cast_result<Target, Source>::type
polymorphic_pointer_downcast (const Source& x)
inline auto polymorphic_pointer_downcast (const Source& x)
-> decltype(static_pointer_cast<Target>(x))
{
BOOST_ASSERT(dynamic_pointer_cast<Target> (x) == x);
return static_pointer_cast<Target> (x);
}
template <typename Target, typename Source>
inline typename detail::dynamic_pointer_cast_result<Target, Source>::type
polymorphic_pointer_cast (const Source& x)
inline auto polymorphic_pointer_cast (const Source& x)
-> decltype(dynamic_pointer_cast<Target>(x))
{
typename detail::dynamic_pointer_cast_result<Target, Source>::type tmp
= dynamic_pointer_cast<Target> (x);
auto tmp = dynamic_pointer_cast<Target> (x);
if ( !tmp ) boost::throw_exception( std::bad_cast() );
return tmp;
}
+6 -2
View File
@@ -2,10 +2,14 @@
<!--
Copyright (c) 2016 Mikhail Maximov
vigorous.activity at gmail dot com
Copyright (c) Antony Polukhin, 2021-2026
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)
boost-no-inspect
-->
<html>
<head>
@@ -29,7 +33,7 @@
<a href="../../doc/html/conversion.html">../../doc/html/conversion.html</a>
</p>
<p>
&copy; 2014-2021 Antony Polukhin
&copy; Antony Polukhin, 2014-2024
</p>
</body>
</html>
+1 -1
View File
@@ -12,5 +12,5 @@
"maintainers": [
"Antony Polukhin <antoshkka -at- gmail.com>"
],
"cxxstd": "03"
"cxxstd": "11"
}
+17
View File
@@ -0,0 +1,17 @@
# 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 http://www.boost.org/LICENSE_1_0.txt
include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(NOT HAVE_BOOST_TEST)
return()
endif()
set(BOOST_TEST_LINK_LIBRARIES Boost::conversion Boost::core)
boost_test(TYPE run SOURCES cast_test.cpp)
boost_test(TYPE run SOURCES implicit_cast.cpp)
boost_test(TYPE compile-fail SOURCES implicit_cast_fail.cpp)
boost_test(TYPE compile-fail SOURCES implicit_cast_fail2.cpp)
boost_test(TYPE run SOURCES polymorphic_cast_test.cpp LINK_LIBRARIES Boost::smart_ptr)
+7 -5
View File
@@ -1,18 +1,20 @@
# Copyright (C) 2001-2003 Douglas Gregor
# Copyright (C) 2011-2021 Antony Polukhin
# Copyright (C) Antony Polukhin, 2011-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.0.1 ;
import-search /boost/config/checks ;
import config : requires ;
import testing ;
import feature ;
project
: requirements
<toolset>gcc-4.7:<cxxflags>-ftrapv
<toolset>gcc-4.6:<cxxflags>-ftrapv
<toolset>clang:<cxxflags>-ftrapv
<library>/boost/conversion//boost_conversion
[ requires cxx11_decltype ]
# default to all warnings on:
<warnings>all
# set warnings as errors for those compilers we know we get warning free:
@@ -24,6 +26,6 @@ test-suite conversion
: [ run implicit_cast.cpp ]
[ compile-fail implicit_cast_fail.cpp ]
[ run cast_test.cpp ]
[ run polymorphic_cast_test.cpp ]
[ run polymorphic_cast_test.cpp : : : <library>/boost/smart_ptr//boost_smart_ptr ]
[ compile-fail implicit_cast_fail2.cpp ]
;
+3 -5
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-2021.
# Copyright Antony Polukhin, 2016-2025.
#
# 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.71.{build}-{branch}
version: 1.84.{build}-{branch}
# branches to build
branches:
@@ -32,8 +32,6 @@ skip_tags: true
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
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
@@ -67,7 +65,7 @@ before_build:
- rm -rf %BOOST%/libs/%BOOST_LIBS_FOLDER%
- mv -f %APPVEYOR_BUILD_FOLDER% %BOOST%/libs/%BOOST_LIBS_FOLDER%
- python tools/boostdep/depinst/depinst.py --git_args "--depth 1 --jobs 2" %BOOST_LIBS_FOLDER%
- python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" %BOOST_LIBS_FOLDER%
build_script:
- cmd /c bootstrap
+42
View File
@@ -38,6 +38,48 @@ namespace
};
}
constexpr bool compile_time_polymorphic_cast_check() {
#if defined(__cpp_constexpr) && __cpp_constexpr >= 201907L
Derived derived;
Base* base = &derived;
return polymorphic_cast<Derived*>(base) != nullptr;
#endif
return true;
}
static_assert(
compile_time_polymorphic_cast_check(),
"polymorphic_cast does not work at compile time"
);
constexpr bool compile_time_polymorphic_downcast_check() {
#if defined(__cpp_constexpr) && __cpp_constexpr >= 201907L
Derived derived;
Base* base = &derived;
return polymorphic_downcast<Derived*>(base) != nullptr;
#endif
return true;
}
static_assert(
compile_time_polymorphic_downcast_check(),
"polymorphic_downcast does not work at compile time"
);
constexpr bool compile_time_polymorphic_downcast2_check() {
#if defined(__cpp_constexpr) && __cpp_constexpr >= 201907L
Derived derived;
Base& base = derived;
Derived& derived_again = polymorphic_downcast<Derived&>(base);
(void)derived_again;
#endif
return true;
}
static_assert(
compile_time_polymorphic_downcast2_check(),
"polymorphic_downcast does not work at compile time"
);
int main( int argc, char * argv[] )
{
+8 -3
View File
@@ -4,8 +4,9 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/implicit_cast.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/type.hpp>
using boost::implicit_cast;
using boost::type;
@@ -18,8 +19,8 @@ struct foo
operator long() const { return 0; }
};
typedef type<long> long_type;
typedef type<foo> foo_type;
using long_type = type<long>;
using foo_type = type<foo>;
int main()
{
@@ -34,5 +35,9 @@ int main()
(void)f;
(void)z;
constexpr long value = boost::implicit_cast<long>(42);
BOOST_TEST(value == 42L);
return boost::report_errors();
}
+2 -10
View File
@@ -6,6 +6,7 @@
// Copyright 1999 Dave Abrahams
// Copyright 2014 Peter Dimov
// Copyright 2014 Boris Rasin, Antony Polukhin
// Copyright 2023 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0.
//
@@ -237,8 +238,6 @@ static void test_polymorphic_pointer_downcast_intrusive()
}
}
#ifndef BOOST_NO_CXX11_SMART_PTR
static void test_polymorphic_pointer_downcast_std_shared()
{
std::shared_ptr<Base> base (new Derived);
@@ -253,8 +252,6 @@ static void test_polymorphic_pointer_downcast_std_shared()
}
}
#endif
static void test_polymorphic_cast_fail()
{
Base * base = new Base;
@@ -272,9 +269,7 @@ static void test_polymorphic_pointer_cast_fail()
BOOST_TEST_THROWS( boost::polymorphic_pointer_cast<Derived>( boost::shared_ptr<Base>(new Base) ), std::bad_cast );
#ifndef BOOST_NO_CXX11_SMART_PTR
BOOST_TEST_THROWS( boost::polymorphic_pointer_cast<Derived>( std::shared_ptr<Base>(new Base) ), std::bad_cast );
#endif
BOOST_TEST_THROWS( boost::polymorphic_pointer_cast<Derived>( boost::intrusive_ptr<Base>(new Base) ), std::bad_cast );
}
@@ -337,7 +332,6 @@ static void test_polymorphic_pointer_downcast_boost_shared_fail()
expect_assertion = false;
}
#ifndef BOOST_NO_CXX11_SMART_PTR
static void test_polymorphic_pointer_downcast_std_shared_fail()
{
@@ -352,7 +346,6 @@ static void test_polymorphic_pointer_downcast_std_shared_fail()
expect_assertion = false;
}
#endif
static void test_polymorphic_pointer_downcast_intrusive_fail()
{
@@ -382,10 +375,9 @@ int main()
test_polymorphic_pointer_downcast_boost_shared_fail();
test_polymorphic_pointer_downcast_intrusive_fail();
#ifndef BOOST_NO_CXX11_SMART_PTR
test_polymorphic_pointer_downcast_std_shared();
test_polymorphic_pointer_downcast_std_shared_fail();
#endif
return boost::report_errors();
}