drop c++03 support

This commit is contained in:
Antony Polukhin
2023-08-10 18:52:03 +03:00
parent a1104f580c
commit 2598281d10
7 changed files with 30 additions and 94 deletions
+3 -16
View File
@@ -11,22 +11,9 @@
# pragma once
#endif
#include <boost/config/pragma_message.hpp>
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \
defined(BOOST_NO_CXX11_CONSTEXPR) || \
defined(BOOST_NO_CXX11_NULLPTR) || \
defined(BOOST_NO_CXX11_NOEXCEPT) || \
defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \
defined(BOOST_NO_CXX11_FINAL) || \
defined(BOOST_NO_CXX11_ALIGNOF) || \
defined(BOOST_NO_CXX11_STATIC_ASSERT) || \
defined(BOOST_NO_CXX11_SMART_PTR) || \
defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || \
defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.Conversion 1.82 and will be removed in Boost.Conversion 1.84.")
#if defined(BOOST_NO_CXX11_CONSTEXPR)
#error C++03 support is removed in Boost.Conversion 1.84
#endif
namespace boost {
@@ -46,7 +33,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>
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;
}
+12 -26
View File
@@ -49,38 +49,24 @@
#ifndef BOOST_POLYMORPHIC_CAST_HPP
#define BOOST_POLYMORPHIC_CAST_HPP
# include <boost/config.hpp>
#include <boost/config/assert_cxx11.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <boost/config/pragma_message.hpp>
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \
defined(BOOST_NO_CXX11_CONSTEXPR) || \
defined(BOOST_NO_CXX11_NULLPTR) || \
defined(BOOST_NO_CXX11_NOEXCEPT) || \
defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \
defined(BOOST_NO_CXX11_FINAL) || \
defined(BOOST_NO_CXX11_ALIGNOF) || \
defined(BOOST_NO_CXX11_STATIC_ASSERT) || \
defined(BOOST_NO_CXX11_SMART_PTR) || \
defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || \
defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.Conversion 1.82 and will be removed in Boost.Conversion 1.84.")
#if defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
#error C++03 support is removed in Boost.Conversion 1.84
#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 <boost/assert.hpp>
# include <boost/throw_exception.hpp>
# include <memory> // std::addressof
# include <typeinfo>
# include <type_traits>
namespace boost
{
@@ -129,13 +115,13 @@ namespace boost
// Contributed by Julien Delacroix
template <class Target, class Source>
inline typename boost::enable_if_c<
boost::is_reference<Target>::value, Target
inline 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;
typedef typename std::remove_reference<Target>::type* target_pointer_type;
return *boost::polymorphic_downcast<target_pointer_type>(
boost::addressof(x)
std::addressof(x)
);
}
+9 -34
View File
@@ -15,31 +15,16 @@
# pragma once
#endif
#if defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || defined(BOOST_NO_CXX11_DECLTYPE)
#error C++03 support is removed in Boost.Conversion 1.84
#endif
# 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/pragma_message.hpp>
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \
defined(BOOST_NO_CXX11_CONSTEXPR) || \
defined(BOOST_NO_CXX11_NULLPTR) || \
defined(BOOST_NO_CXX11_NOEXCEPT) || \
defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \
defined(BOOST_NO_CXX11_FINAL) || \
defined(BOOST_NO_CXX11_ALIGNOF) || \
defined(BOOST_NO_CXX11_STATIC_ASSERT) || \
defined(BOOST_NO_CXX11_SMART_PTR) || \
defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || \
defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
# include <utility> // std::declval
BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.Conversion 1.82 and will be removed in Boost.Conversion 1.84.")
#endif
namespace boost
{
@@ -62,19 +47,11 @@ namespace boost
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
};
using dynamic_pointer_cast_result = decltype(dynamic_pointer_cast<Target>(std::declval<Source>()));
}
template <typename Target, typename Source>
inline typename detail::dynamic_pointer_cast_result<Target, Source>::type
inline detail::dynamic_pointer_cast_result<Target, Source>
polymorphic_pointer_downcast (const Source& x)
{
BOOST_ASSERT(dynamic_pointer_cast<Target> (x) == x);
@@ -82,13 +59,11 @@ namespace boost
}
template <typename Target, typename Source>
inline typename detail::dynamic_pointer_cast_result<Target, Source>::type
inline detail::dynamic_pointer_cast_result<Target, Source>
polymorphic_pointer_cast (const Source& 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;
}