old compiler workarounds for the previous two fixes

This commit is contained in:
Andrzej Krzemienski
2016-11-20 23:42:41 +01:00
parent fafb3abb64
commit b4907c2a51
4 changed files with 38 additions and 12 deletions

View File

@ -733,9 +733,7 @@ struct is_optional_related
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)
// this condition is a copy paste from is_constructible.hpp
// I also disable SUNPRO, as it seems not to support type_traits correctly
#if !defined(BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT)
template <typename T, typename U>
struct is_convertible_to_T_or_factory
@ -751,8 +749,6 @@ struct is_optional_constructible : boost::is_constructible<T, U>
#else
#define BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT
template <typename, typename>
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.
// Can throw if T::T(U const&) does
template<class U>
explicit optional ( optional<U> const& rhs,
typename boost::enable_if< optional_detail::is_optional_constructible<T, U const&> >::type* = 0)
explicit optional ( optional<U> const& rhs
#ifdef BOOST_OPTIONAL_DETAIL_USE_SFINAE_FRIENDLY_CONSTRUCTORS
,typename boost::enable_if< optional_detail::is_optional_constructible<T, U const&> >::type* = 0
#endif
)
:
base()
{
@ -834,8 +833,11 @@ class optional : public optional_detail::optional_base<T>
// Requires a valid conversion from U to T.
// Can throw if T::T(U&&) does
template<class U>
explicit optional ( optional<U> && rhs,
typename boost::enable_if< optional_detail::is_optional_constructible<T, U> >::type* = 0 )
explicit optional ( optional<U> && rhs
#ifdef BOOST_OPTIONAL_DETAIL_USE_SFINAE_FRIENDLY_CONSTRUCTORS
,typename boost::enable_if< optional_detail::is_optional_constructible<T, U> >::type* = 0
#endif
)
:
base()
{
@ -954,8 +956,7 @@ class optional : public optional_detail::optional_base<T>
}
#endif
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
// Assigns from a T (deep-moves/copies the rhs value)
template <typename T_>
@ -965,6 +966,7 @@ class optional : public optional_detail::optional_base<T>
this->assign( boost::forward<T_>(val) ) ;
return *this ;
}
#else
// Assigns from a T (deep-copies the rhs value)
@ -975,8 +977,17 @@ class optional : public optional_detail::optional_base<T>
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 // BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
// Assigns from a "none"
// Which destroys the current value, if any, leaving this UNINITIALIZED
// No-throw (assuming T::~T() doesn't)