mirror of
https://github.com/boostorg/conversion.git
synced 2026-08-07 14:04:20 +02:00
Compare commits
24 Commits
boost-1.78.0
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 827dd94c68 | |||
| 782e083f61 | |||
| 1e6424563d | |||
| 6632ca9309 | |||
| b74a4c34cb | |||
| 452adac97f | |||
| 5f82d5aa7d | |||
| 9d64c899df | |||
| 35a71f0701 | |||
| 8a860e05d0 | |||
| 9f285ef0c4 | |||
| 5f36c2c710 | |||
| 41e62ed851 | |||
| 5cf5f78376 | |||
| 5a3587c988 | |||
| f7f3c9b5ce | |||
| 668030fcd6 | |||
| 0d60a3f7ce | |||
| 0ff5adc258 | |||
| 2598281d10 | |||
| a1104f580c | |||
| 9a03296816 | |||
| 7ba0984b34 | |||
| 4ae8b4d495 |
@@ -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"
|
||||||
+44
-33
@@ -17,34 +17,24 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- toolset: gcc-7
|
- toolset: gcc-14 # Do not remove! It is the only toolset that tests CMake tests down below
|
||||||
cxxstd: "03,11,14,17"
|
cxxstd: "03,11,14,17,20"
|
||||||
os: ubuntu-18.04
|
os: ubuntu-24.04
|
||||||
- toolset: gcc-9
|
- toolset: gcc-12
|
||||||
cxxstd: "03,11,14,17,2a"
|
cxxstd: "03,11,14,17,2a"
|
||||||
os: ubuntu-18.04
|
os: ubuntu-22.04
|
||||||
- toolset: gcc-10
|
|
||||||
cxxstd: "03,11,14,17,2a"
|
|
||||||
os: ubuntu-18.04
|
|
||||||
cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined"
|
cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined"
|
||||||
linkflags: "linkflags=--coverage -lasan -lubsan"
|
linkflags: "linkflags=--coverage -lasan -lubsan"
|
||||||
gcov_tool: "gcov-10"
|
gcov_tool: "gcov-12"
|
||||||
- toolset: clang
|
- toolset: clang
|
||||||
compiler: clang++-10
|
compiler: clang++-14
|
||||||
cxxstd: "03,11,14,17,2a"
|
cxxstd: "03,11,14,17,2a"
|
||||||
os: ubuntu-20.04
|
os: ubuntu-22.04
|
||||||
cxxflags: "cxxflags=-fsanitize=address,undefined,integer -fno-sanitize-recover=undefined"
|
|
||||||
linkflags: "linkflags=-fsanitize=address,undefined,integer"
|
|
||||||
- toolset: clang
|
|
||||||
cxxstd: "03,11,14,17,2a"
|
|
||||||
os: macos-10.15
|
|
||||||
cxxflags: "cxxflags=-fsanitize=address,undefined -fno-sanitize-recover=undefined"
|
|
||||||
linkflags: "linkflags=-fsanitize=address,undefined"
|
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
if: matrix.install
|
if: matrix.install
|
||||||
@@ -72,8 +62,19 @@ jobs:
|
|||||||
cp -r $GITHUB_WORKSPACE/* 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
|
python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--depth 10 --jobs 3" $LIBRARY
|
||||||
./bootstrap.sh
|
./bootstrap.sh
|
||||||
./b2 -d0 headers
|
./b2 -j4 variant=debug tools/inspect
|
||||||
./b2 -j4 variant=debug tools/inspect/build
|
|
||||||
|
- 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
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
@@ -88,9 +89,9 @@ jobs:
|
|||||||
|
|
||||||
echo -e "#!/bin/bash\nexec ${{matrix.gcov_tool}} \"\$@\"" > $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh
|
echo -e "#!/bin/bash\nexec ${{matrix.gcov_tool}} \"\$@\"" > $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh
|
||||||
chmod +x $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh
|
chmod +x $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh
|
||||||
wget https://github.com/linux-test-project/lcov/archive/v1.15.zip
|
wget https://github.com/linux-test-project/lcov/archive/v1.16.zip
|
||||||
unzip v1.15.zip
|
unzip v1.16.zip
|
||||||
LCOV="`pwd`/lcov-1.15/bin/lcov --gcov-tool $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh"
|
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"
|
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 --directory ../boost-root/bin.v2/libs/$LIBRARY/ --base-directory ../boost-root/ --capture --output-file $GITHUB_WORKSPACE/coveralls/coverage.info
|
||||||
@@ -114,23 +115,19 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- toolset: msvc-14.1
|
- toolset: msvc-14.3
|
||||||
cxxstd: "14,17,latest"
|
cxxstd: "14,17,latest"
|
||||||
addrmd: 32,64
|
addrmd: 32,64
|
||||||
os: windows-2016
|
os: windows-2025
|
||||||
- toolset: msvc-14.2
|
|
||||||
cxxstd: "14,17,latest"
|
|
||||||
addrmd: 32,64
|
|
||||||
os: windows-2019
|
|
||||||
- toolset: gcc
|
- toolset: gcc
|
||||||
cxxstd: "03,11,14,17,2a"
|
cxxstd: "03,11,14,17,2a"
|
||||||
addrmd: 64
|
addrmd: 64
|
||||||
os: windows-2019
|
os: windows-2025
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup Boost
|
- name: Setup Boost
|
||||||
shell: cmd
|
shell: cmd
|
||||||
@@ -152,7 +149,21 @@ jobs:
|
|||||||
git submodule update --init tools/boostdep
|
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%
|
python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools --git_args "--jobs 3" %LIBRARY%
|
||||||
cmd /c bootstrap
|
cmd /c bootstrap
|
||||||
b2 -d0 headers
|
|
||||||
|
- 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
|
- name: Run tests
|
||||||
shell: cmd
|
shell: cmd
|
||||||
|
|||||||
+5
-5
@@ -2,7 +2,7 @@
|
|||||||
# Distributed under the Boost Software License, Version 1.0.
|
# 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
|
# 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 )
|
cmake_minimum_required( VERSION 3.5...4.20 )
|
||||||
project( boost_conversion VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX )
|
project( boost_conversion VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX )
|
||||||
|
|
||||||
add_library( boost_conversion INTERFACE )
|
add_library( boost_conversion INTERFACE )
|
||||||
@@ -14,9 +14,9 @@ target_link_libraries( boost_conversion
|
|||||||
INTERFACE
|
INTERFACE
|
||||||
Boost::assert
|
Boost::assert
|
||||||
Boost::config
|
Boost::config
|
||||||
Boost::core
|
|
||||||
Boost::smart_ptr
|
|
||||||
Boost::throw_exception
|
Boost::throw_exception
|
||||||
Boost::type_traits
|
|
||||||
Boost::typeof
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(BUILD_TESTING)
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ Boost.Conversion is one of the [Boost C++ Libraries](https://github.com/boostorg
|
|||||||
|
|
||||||
@ | Build | Tests coverage | More info
|
@ | Build | Tests coverage | More info
|
||||||
----------------|-------------- | -------------- |-----------
|
----------------|-------------- | -------------- |-----------
|
||||||
Develop branch: | [](https://github.com/boostorg/conversion/actions/workflows/ci.yml) [](https://ci.appveyor.com/project/apolukhin/conversion/branch/develop) | [](https://coveralls.io/github/boostorg/conversion?branch=develop) | [details...](https://www.boost.org/development/tests/develop/developer/conversion.html)
|
Develop branch: | [](https://github.com/boostorg/conversion/actions/workflows/ci.yml) [](https://ci.appveyor.com/project/apolukhin/conversion/branch/develop) | [](https://coveralls.io/github/boostorg/conversion?branch=develop) | [details...](https://regression.boost.io/develop/developer/conversion.html)
|
||||||
Master branch: | [](https://github.com/boostorg/conversion/actions/workflows/ci.yml) [](https://ci.appveyor.com/project/apolukhin/conversion/branch/master) | [](https://coveralls.io/github/boostorg/conversion?branch=master) | [details...](https://www.boost.org/development/tests/master/developer/conversion.html)
|
Master branch: | [](https://github.com/boostorg/conversion/actions/workflows/ci.yml) [](https://ci.appveyor.com/project/apolukhin/conversion/branch/master) | [](https://coveralls.io/github/boostorg/conversion?branch=master) | [details...](https://regression.boost.io/master/developer/conversion.html)
|
||||||
|
|
||||||
[Latest developer documentation](https://www.boost.org/doc/libs/develop/doc/html/conversion.html)
|
[Latest developer documentation](https://www.boost.org/doc/libs/develop/doc/html/conversion.html)
|
||||||
|
|
||||||
|
|||||||
@@ -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
@@ -1,6 +1,6 @@
|
|||||||
[/
|
[/
|
||||||
Copyright 2016 Mikhail Maximov.
|
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
|
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>)
|
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]
|
[id conversion]
|
||||||
[version 1.7]
|
[version 1.7]
|
||||||
[authors [Stroustrup, Bjarne], [Abrahams, Dave], [Rasin, Boris], [Polukhin, Antony]]
|
[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
|
[license
|
||||||
Distributed under the Boost Software License, Version 1.0.
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
(See accompanying file LICENSE_1_0.txt or copy at
|
(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
|
otherwise messy conversions. It includes cast-style function templates designed
|
||||||
to complement the C++ Standard's built-in casts.
|
to complement the C++ Standard's built-in casts.
|
||||||
|
|
||||||
To reduce coupling, particularly to standard library IOStreams,
|
To reduce coupling, the Boost Conversion Library is supplied by several headers:
|
||||||
the Boost Conversion Library is supplied by several headers:
|
|
||||||
|
|
||||||
# The [@boost:boost/polymorphic_cast.hpp boost/polymorphic_cast.hpp] header
|
# The [@boost:boost/polymorphic_cast.hpp boost/polymorphic_cast.hpp] header
|
||||||
provides [link polymorphic_cast `polymorphic_cast<>`] and
|
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<>`]
|
[link polymorphic_pointer_cast `polymorphic_pointer_downcast<>`]
|
||||||
# The [@boost:boost/implicit_cast.hpp boost/implicit_cast.hpp] header provides `implicit_cast<>`
|
# 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).
|
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:doc/libs/release/libs/lexical_cast/ `lexical_cast<>`] general literal text conversions, such as an `int` represented as a `string`, or vice-versa.
|
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
@@ -153,10 +150,10 @@ This includes C++ built-in pointers, `std::shared_ptr`,
|
|||||||
class Banana : public Fruit {};
|
class Banana : public Fruit {};
|
||||||
|
|
||||||
// Use one of these:
|
// Use one of these:
|
||||||
typedef Fruit* FruitPtr;
|
using FruitPtr = Fruit*;
|
||||||
typedef std::shared_ptr<Fruit> FruitPtr;
|
using FruitPtr = std::shared_ptr<Fruit>;
|
||||||
typedef boost::shared_ptr<Fruit> FruitPtr;
|
using FruitPtr = boost::shared_ptr<Fruit>;
|
||||||
typedef boost::intrusive_ptr<Fruit> FruitPtr;
|
using FruitPtr = boost::intrusive_ptr<Fruit>;
|
||||||
|
|
||||||
void f(FruitPtr fruit) {
|
void f(FruitPtr fruit) {
|
||||||
// ... logic which leads us to believe it is a banana
|
// ... 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 )
|
// Throws: std::bad_cast if ( dynamic_cast<Derived>(x) == 0 )
|
||||||
// Returns: dynamic_cast<Derived>(x)
|
// Returns: dynamic_cast<Derived>(x)
|
||||||
template <class Derived, class Base>
|
template <class Derived, class Base>
|
||||||
inline Derived polymorphic_cast(Base* x);
|
constexpr Derived polymorphic_cast(Base* x);
|
||||||
|
|
||||||
// Effects: assert( dynamic_cast<Derived>(x) == x );
|
// Effects: assert( dynamic_cast<Derived>(x) == x );
|
||||||
// Returns: static_cast<Derived>(x)
|
// Returns: static_cast<Derived>(x)
|
||||||
template <class Derived, class Base>
|
template <class Derived, class Base>
|
||||||
inline Derived polymorphic_downcast(Base* x);
|
constexpr Derived polymorphic_downcast(Base* x);
|
||||||
|
|
||||||
// Effects: assert( dynamic_cast<Derived>(&x) == &x );
|
// Effects: assert( dynamic_cast<Derived>(&x) == &x );
|
||||||
// Returns: static_cast<Derived>(x)
|
// Returns: static_cast<Derived>(x)
|
||||||
template <class Derived, class Base>
|
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 )
|
// Throws: std::bad_cast if ( dynamic_pointer_cast<Derived>(x) == 0 )
|
||||||
// Returns: dynamic_pointer_cast<Derived>(x)
|
// Returns: dynamic_pointer_cast<Derived>(x)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace detail {
|
|||||||
|
|
||||||
template<class T> struct icast_identity
|
template<class T> struct icast_identity
|
||||||
{
|
{
|
||||||
typedef T type;
|
using type = T;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
@@ -28,7 +28,7 @@ template<class T> struct icast_identity
|
|||||||
// The use of identity creates a non-deduced form, so that the
|
// The use of identity creates a non-deduced form, so that the
|
||||||
// explicit template argument must be supplied
|
// explicit template argument must be supplied
|
||||||
template <typename T>
|
template <typename T>
|
||||||
BOOST_CONSTEXPR 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;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// 08 Nov 14 Add polymorphic_pointer_downcast (Boris Rasin)
|
// 08 Nov 14 Add polymorphic_pointer_downcast (Boris Rasin)
|
||||||
// 09 Jun 14 "cast.hpp" was renamed to "polymorphic_cast.hpp" and
|
// 09 Jun 14 "cast.hpp" was renamed to "polymorphic_cast.hpp" and
|
||||||
// inclusion of numeric_cast was removed (Antony Polukhin)
|
// 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
|
// 02 Apr 01 Removed BOOST_NO_LIMITS workarounds and included
|
||||||
// <boost/limits.hpp> instead (the workaround did not
|
// <boost/limits.hpp> instead (the workaround did not
|
||||||
// actually compile when BOOST_NO_LIMITS was defined in
|
// 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)
|
// 19 Oct 00 Fix numeric_cast for floating-point types (Dave Abrahams)
|
||||||
// 15 Jul 00 Suppress numeric_cast warnings for GCC, Borland and MSVC
|
// 15 Jul 00 Suppress numeric_cast warnings for GCC, Borland and MSVC
|
||||||
// (Dave Abrahams)
|
// (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)
|
// 28 Jun 00 Removed implicit_cast<>. See comment below. (Beman Dawes)
|
||||||
// 27 Jun 00 More MSVC6 workarounds
|
// 27 Jun 00 More MSVC6 workarounds
|
||||||
// 15 Jun 00 Add workarounds for MSVC6
|
// 15 Jun 00 Add workarounds for MSVC6
|
||||||
@@ -49,20 +49,24 @@
|
|||||||
#ifndef BOOST_POLYMORPHIC_CAST_HPP
|
#ifndef BOOST_POLYMORPHIC_CAST_HPP
|
||||||
#define BOOST_POLYMORPHIC_CAST_HPP
|
#define BOOST_POLYMORPHIC_CAST_HPP
|
||||||
|
|
||||||
# include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
|
||||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||||
# pragma once
|
# pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <boost/assert.hpp>
|
# include <boost/assert.hpp>
|
||||||
# include <boost/core/addressof.hpp>
|
|
||||||
# include <boost/core/enable_if.hpp>
|
|
||||||
# include <boost/throw_exception.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 <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
|
namespace boost
|
||||||
{
|
{
|
||||||
@@ -76,7 +80,7 @@ namespace boost
|
|||||||
// section 15.8 exercise 1, page 425.
|
// section 15.8 exercise 1, page 425.
|
||||||
|
|
||||||
template <class Target, class Source>
|
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);
|
Target tmp = dynamic_cast<Target>(x);
|
||||||
if ( tmp == 0 ) boost::throw_exception( std::bad_cast() );
|
if ( tmp == 0 ) boost::throw_exception( std::bad_cast() );
|
||||||
@@ -95,7 +99,7 @@ namespace boost
|
|||||||
// Contributed by Dave Abrahams
|
// Contributed by Dave Abrahams
|
||||||
|
|
||||||
template <class Target, class Source>
|
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
|
BOOST_ASSERT( dynamic_cast<Target>(x) == x ); // detect logic error
|
||||||
return static_cast<Target>(x);
|
return static_cast<Target>(x);
|
||||||
@@ -111,16 +115,18 @@ namespace boost
|
|||||||
// Contributed by Julien Delacroix
|
// Contributed by Julien Delacroix
|
||||||
|
|
||||||
template <class Target, class Source>
|
template <class Target, class Source>
|
||||||
inline typename boost::enable_if_c<
|
BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST typename std::enable_if<
|
||||||
boost::is_reference<Target>::value, Target
|
std::is_reference<Target>::value, Target
|
||||||
>::type polymorphic_downcast(Source& x)
|
>::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>(
|
return *boost::polymorphic_downcast<target_pointer_type>(
|
||||||
boost::addressof(x)
|
std::addressof(x)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
||||||
|
#undef BOOST_CONVERSION_IMPL_CONSTEXPR_DYN_CAST
|
||||||
|
|
||||||
#endif // BOOST_POLYMORPHIC_CAST_HPP
|
#endif // BOOST_POLYMORPHIC_CAST_HPP
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// boost polymorphic_pointer_cast.hpp header file ----------------------------------------------//
|
// 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
|
// Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
// 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
|
#ifndef BOOST_CONVERSION_POLYMORPHIC_POINTER_CAST_HPP
|
||||||
#define BOOST_CONVERSION_POLYMORPHIC_POINTER_CAST_HPP
|
#define BOOST_CONVERSION_POLYMORPHIC_POINTER_CAST_HPP
|
||||||
|
|
||||||
# include <boost/config.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
|
|
||||||
|
|
||||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||||
# pragma once
|
# pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
# include <boost/assert.hpp>
|
||||||
|
# include <boost/pointer_cast.hpp>
|
||||||
|
# include <boost/throw_exception.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
// See the documentation for descriptions of how to choose between
|
// See the documentation for descriptions of how to choose between
|
||||||
@@ -40,36 +38,20 @@ namespace boost
|
|||||||
|
|
||||||
// Contributed by Boris Rasin
|
// 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>
|
template <typename Target, typename Source>
|
||||||
inline typename detail::dynamic_pointer_cast_result<Target, Source>::type
|
inline auto polymorphic_pointer_downcast (const Source& x)
|
||||||
polymorphic_pointer_downcast (const Source& x)
|
-> decltype(static_pointer_cast<Target>(x))
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(dynamic_pointer_cast<Target> (x) == x);
|
BOOST_ASSERT(dynamic_pointer_cast<Target> (x) == x);
|
||||||
return static_pointer_cast<Target> (x);
|
return static_pointer_cast<Target> (x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Target, typename Source>
|
template <typename Target, typename Source>
|
||||||
inline typename detail::dynamic_pointer_cast_result<Target, Source>::type
|
inline auto polymorphic_pointer_cast (const Source& x)
|
||||||
polymorphic_pointer_cast (const Source& x)
|
-> decltype(dynamic_pointer_cast<Target>(x))
|
||||||
{
|
{
|
||||||
typename detail::dynamic_pointer_cast_result<Target, Source>::type tmp
|
auto tmp = dynamic_pointer_cast<Target> (x);
|
||||||
= dynamic_pointer_cast<Target> (x);
|
|
||||||
if ( !tmp ) boost::throw_exception( std::bad_cast() );
|
if ( !tmp ) boost::throw_exception( std::bad_cast() );
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -3,16 +3,18 @@
|
|||||||
Copyright (c) 2016 Mikhail Maximov
|
Copyright (c) 2016 Mikhail Maximov
|
||||||
vigorous.activity at gmail dot com
|
vigorous.activity at gmail dot com
|
||||||
|
|
||||||
Copyright (c) 2021 Antony Polukhin
|
Copyright (c) Antony Polukhin, 2021-2026
|
||||||
|
|
||||||
Distributed under the Boost Software License,
|
Distributed under the Boost Software License,
|
||||||
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||||
or copy at http://boost.org/LICENSE_1_0.txt)
|
or copy at http://boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
boost-no-inspect
|
||||||
-->
|
-->
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="refresh" content="0; url=https://www.boost.org/doc/libs/master/doc/html/conversion.html">
|
<meta http-equiv="refresh" content="0; url=../../doc/html/conversion.html">
|
||||||
<title>Boost.Conversion</title>
|
<title>Boost.Conversion</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
@@ -28,10 +30,10 @@
|
|||||||
<body>
|
<body>
|
||||||
<p>
|
<p>
|
||||||
Automatic redirection failed, please go to
|
Automatic redirection failed, please go to
|
||||||
<a href="https://www.boost.org/doc/libs/master/doc/html/conversion.html">https://www.boost.org/doc/libs/master/doc/html/conversion.html</a>
|
<a href="../../doc/html/conversion.html">../../doc/html/conversion.html</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
© 2014-2021 Antony Polukhin
|
© Antony Polukhin, 2014-2024
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+1
-1
@@ -12,5 +12,5 @@
|
|||||||
"maintainers": [
|
"maintainers": [
|
||||||
"Antony Polukhin <antoshkka -at- gmail.com>"
|
"Antony Polukhin <antoshkka -at- gmail.com>"
|
||||||
],
|
],
|
||||||
"cxxstd": "03"
|
"cxxstd": "11"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
@@ -1,18 +1,20 @@
|
|||||||
# Copyright (C) 2001-2003 Douglas Gregor
|
# 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
|
# 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)
|
# 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 testing ;
|
||||||
import feature ;
|
import feature ;
|
||||||
|
|
||||||
project
|
project
|
||||||
: requirements
|
: requirements
|
||||||
<toolset>gcc-4.7:<cxxflags>-ftrapv
|
<library>/boost/conversion//boost_conversion
|
||||||
<toolset>gcc-4.6:<cxxflags>-ftrapv
|
[ requires cxx11_decltype ]
|
||||||
<toolset>clang:<cxxflags>-ftrapv
|
|
||||||
# default to all warnings on:
|
# default to all warnings on:
|
||||||
<warnings>all
|
<warnings>all
|
||||||
# set warnings as errors for those compilers we know we get warning free:
|
# set warnings as errors for those compilers we know we get warning free:
|
||||||
@@ -24,6 +26,6 @@ test-suite conversion
|
|||||||
: [ run implicit_cast.cpp ]
|
: [ run implicit_cast.cpp ]
|
||||||
[ compile-fail implicit_cast_fail.cpp ]
|
[ compile-fail implicit_cast_fail.cpp ]
|
||||||
[ run cast_test.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 ]
|
[ compile-fail implicit_cast_fail2.cpp ]
|
||||||
;
|
;
|
||||||
|
|||||||
+2
-5
@@ -2,7 +2,7 @@
|
|||||||
# subject to the Boost Software License, Version 1.0. (See accompanying
|
# 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)
|
# 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
|
# 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
|
# 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 to build
|
||||||
branches:
|
branches:
|
||||||
@@ -32,9 +32,6 @@ skip_tags: true
|
|||||||
|
|
||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
|
||||||
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
|
|
||||||
ADDRMD: 32
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||||
TOOLSET: msvc-14.1,clang-win
|
TOOLSET: msvc-14.1,clang-win
|
||||||
CXXSTD: 14,17
|
CXXSTD: 14,17
|
||||||
|
|||||||
@@ -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[] )
|
int main( int argc, char * argv[] )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#include <boost/implicit_cast.hpp>
|
#include <boost/implicit_cast.hpp>
|
||||||
#include <boost/detail/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <boost/type.hpp>
|
#include <boost/type.hpp>
|
||||||
|
|
||||||
using boost::implicit_cast;
|
using boost::implicit_cast;
|
||||||
using boost::type;
|
using boost::type;
|
||||||
|
|
||||||
@@ -18,8 +19,8 @@ struct foo
|
|||||||
operator long() const { return 0; }
|
operator long() const { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef type<long> long_type;
|
using long_type = type<long>;
|
||||||
typedef type<foo> foo_type;
|
using foo_type = type<foo>;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -35,7 +36,7 @@ int main()
|
|||||||
(void)z;
|
(void)z;
|
||||||
|
|
||||||
|
|
||||||
BOOST_CONSTEXPR long value = boost::implicit_cast<long>(42);
|
constexpr long value = boost::implicit_cast<long>(42);
|
||||||
BOOST_TEST(value == 42L);
|
BOOST_TEST(value == 42L);
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
// Copyright 1999 Dave Abrahams
|
// Copyright 1999 Dave Abrahams
|
||||||
// Copyright 2014 Peter Dimov
|
// Copyright 2014 Peter Dimov
|
||||||
// Copyright 2014 Boris Rasin, Antony Polukhin
|
// Copyright 2014 Boris Rasin, Antony Polukhin
|
||||||
|
// Copyright 2023 Antony Polukhin
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// 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()
|
static void test_polymorphic_pointer_downcast_std_shared()
|
||||||
{
|
{
|
||||||
std::shared_ptr<Base> base (new Derived);
|
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()
|
static void test_polymorphic_cast_fail()
|
||||||
{
|
{
|
||||||
Base * base = new Base;
|
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 );
|
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 );
|
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 );
|
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;
|
expect_assertion = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_NO_CXX11_SMART_PTR
|
|
||||||
|
|
||||||
static void test_polymorphic_pointer_downcast_std_shared_fail()
|
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;
|
expect_assertion = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void test_polymorphic_pointer_downcast_intrusive_fail()
|
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_boost_shared_fail();
|
||||||
test_polymorphic_pointer_downcast_intrusive_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();
|
||||||
test_polymorphic_pointer_downcast_std_shared_fail();
|
test_polymorphic_pointer_downcast_std_shared_fail();
|
||||||
#endif
|
|
||||||
|
|
||||||
return boost::report_errors();
|
return boost::report_errors();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user