mirror of
https://github.com/boostorg/optional.git
synced 2025-07-30 20:47:18 +02:00
old compiler workarounds for the previous two fixes
This commit is contained in:
@ -96,4 +96,17 @@
|
|||||||
|
|
||||||
#endif // defined(__GNUC__)
|
#endif // defined(__GNUC__)
|
||||||
|
|
||||||
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) && !defined(__SUNPRO_CC)
|
||||||
|
// this condition is a copy paste from is_constructible.hpp
|
||||||
|
// I also disable SUNPRO, as it seems not to support type_traits correctly
|
||||||
|
#else
|
||||||
|
# define BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined __SUNPRO_CC
|
||||||
|
# define BOOST_OPTIONAL_DETAIL_USE_SFINAE_FRIENDLY_CONSTRUCTORS
|
||||||
|
#elif (defined _MSC_FULL_VER) && (_MSC_FULL_VER < 190023026)
|
||||||
|
# define BOOST_OPTIONAL_DETAIL_USE_SFINAE_FRIENDLY_CONSTRUCTORS
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // header guard
|
#endif // header guard
|
||||||
|
@ -733,9 +733,7 @@ struct is_optional_related
|
|||||||
boost::true_type, boost::false_type>::type
|
boost::true_type, boost::false_type>::type
|
||||||
{};
|
{};
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) && !defined(__SUNPRO_CC)
|
#if !defined(BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT)
|
||||||
// this condition is a copy paste from is_constructible.hpp
|
|
||||||
// I also disable SUNPRO, as it seems not to support type_traits correctly
|
|
||||||
|
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
struct is_convertible_to_T_or_factory
|
struct is_convertible_to_T_or_factory
|
||||||
@ -751,8 +749,6 @@ struct is_optional_constructible : boost::is_constructible<T, U>
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT
|
|
||||||
|
|
||||||
template <typename, typename>
|
template <typename, typename>
|
||||||
struct is_convertible_to_T_or_factory : boost::true_type
|
struct is_convertible_to_T_or_factory : boost::true_type
|
||||||
{};
|
{};
|
||||||
@ -820,8 +816,11 @@ class optional : public optional_detail::optional_base<T>
|
|||||||
// Requires a valid conversion from U to T.
|
// Requires a valid conversion from U to T.
|
||||||
// Can throw if T::T(U const&) does
|
// Can throw if T::T(U const&) does
|
||||||
template<class U>
|
template<class U>
|
||||||
explicit optional ( optional<U> const& rhs,
|
explicit optional ( optional<U> const& rhs
|
||||||
typename boost::enable_if< optional_detail::is_optional_constructible<T, U const&> >::type* = 0)
|
#ifdef BOOST_OPTIONAL_DETAIL_USE_SFINAE_FRIENDLY_CONSTRUCTORS
|
||||||
|
,typename boost::enable_if< optional_detail::is_optional_constructible<T, U const&> >::type* = 0
|
||||||
|
#endif
|
||||||
|
)
|
||||||
:
|
:
|
||||||
base()
|
base()
|
||||||
{
|
{
|
||||||
@ -834,8 +833,11 @@ class optional : public optional_detail::optional_base<T>
|
|||||||
// Requires a valid conversion from U to T.
|
// Requires a valid conversion from U to T.
|
||||||
// Can throw if T::T(U&&) does
|
// Can throw if T::T(U&&) does
|
||||||
template<class U>
|
template<class U>
|
||||||
explicit optional ( optional<U> && rhs,
|
explicit optional ( optional<U> && rhs
|
||||||
typename boost::enable_if< optional_detail::is_optional_constructible<T, U> >::type* = 0 )
|
#ifdef BOOST_OPTIONAL_DETAIL_USE_SFINAE_FRIENDLY_CONSTRUCTORS
|
||||||
|
,typename boost::enable_if< optional_detail::is_optional_constructible<T, U> >::type* = 0
|
||||||
|
#endif
|
||||||
|
)
|
||||||
:
|
:
|
||||||
base()
|
base()
|
||||||
{
|
{
|
||||||
@ -954,8 +956,7 @@ class optional : public optional_detail::optional_base<T>
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||||
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
|
||||||
|
|
||||||
// Assigns from a T (deep-moves/copies the rhs value)
|
// Assigns from a T (deep-moves/copies the rhs value)
|
||||||
template <typename T_>
|
template <typename T_>
|
||||||
@ -965,6 +966,7 @@ class optional : public optional_detail::optional_base<T>
|
|||||||
this->assign( boost::forward<T_>(val) ) ;
|
this->assign( boost::forward<T_>(val) ) ;
|
||||||
return *this ;
|
return *this ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Assigns from a T (deep-copies the rhs value)
|
// Assigns from a T (deep-copies the rhs value)
|
||||||
@ -975,8 +977,17 @@ class optional : public optional_detail::optional_base<T>
|
|||||||
return *this ;
|
return *this ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
|
||||||
|
// Assigns from a T (deep-moves the rhs value)
|
||||||
|
optional& operator= ( rval_reference_type val )
|
||||||
|
{
|
||||||
|
this->assign( boost::move(val) ) ;
|
||||||
|
return *this ;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
|
||||||
|
|
||||||
// Assigns from a "none"
|
// Assigns from a "none"
|
||||||
// Which destroys the current value, if any, leaving this UNINITIALIZED
|
// Which destroys the current value, if any, leaving this UNINITIALIZED
|
||||||
// No-throw (assuming T::~T() doesn't)
|
// No-throw (assuming T::~T() doesn't)
|
||||||
|
@ -42,7 +42,7 @@ import testing ;
|
|||||||
[ run optional_test_emplace.cpp ]
|
[ run optional_test_emplace.cpp ]
|
||||||
[ run optional_test_minimum_requirements.cpp ]
|
[ run optional_test_minimum_requirements.cpp ]
|
||||||
[ run optional_test_msvc_bug_workaround.cpp ]
|
[ run optional_test_msvc_bug_workaround.cpp ]
|
||||||
[ compile optional_test_sfinae_friendly_value_ctor.cpp ]
|
[ compile optional_test_sfinae_friendly_ctor.cpp ]
|
||||||
[ compile-fail optional_test_ref_convert_assign_const_int_prevented.cpp ]
|
[ compile-fail optional_test_ref_convert_assign_const_int_prevented.cpp ]
|
||||||
[ compile-fail optional_test_fail1.cpp ]
|
[ compile-fail optional_test_fail1.cpp ]
|
||||||
[ compile-fail optional_test_fail3a.cpp ]
|
[ compile-fail optional_test_fail3a.cpp ]
|
||||||
|
@ -33,6 +33,7 @@ BOOST_STATIC_ASSERT(( !boost::is_constructible<Resource, const Y&>::value ));
|
|||||||
BOOST_STATIC_ASSERT(( boost::is_constructible<optional<Resource>, const X&>::value ));
|
BOOST_STATIC_ASSERT(( boost::is_constructible<optional<Resource>, const X&>::value ));
|
||||||
BOOST_STATIC_ASSERT(( !boost::is_constructible<optional<Resource>, const Y&>::value ));
|
BOOST_STATIC_ASSERT(( !boost::is_constructible<optional<Resource>, const Y&>::value ));
|
||||||
|
|
||||||
|
#ifdef BOOST_OPTIONAL_DETAIL_USE_SFINAE_FRIENDLY_CONSTRUCTORS
|
||||||
BOOST_STATIC_ASSERT(( boost::is_constructible< optional< optional<int> >, optional<int> >::value ));
|
BOOST_STATIC_ASSERT(( boost::is_constructible< optional< optional<int> >, optional<int> >::value ));
|
||||||
BOOST_STATIC_ASSERT(( !boost::is_constructible< optional<int>, optional< optional<int> > >::value ));
|
BOOST_STATIC_ASSERT(( !boost::is_constructible< optional<int>, optional< optional<int> > >::value ));
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ BOOST_STATIC_ASSERT(( !boost::is_constructible< optional<int>, const optional< o
|
|||||||
|
|
||||||
BOOST_STATIC_ASSERT(( boost::is_constructible<optional<Resource>, const optional<X>&>::value ));
|
BOOST_STATIC_ASSERT(( boost::is_constructible<optional<Resource>, const optional<X>&>::value ));
|
||||||
BOOST_STATIC_ASSERT(( !boost::is_constructible<optional<Resource>, const optional<Y>&>::value ));
|
BOOST_STATIC_ASSERT(( !boost::is_constructible<optional<Resource>, const optional<Y>&>::value ));
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Reference in New Issue
Block a user