diff --git a/include/boost/expected/detail/static_addressof.hpp b/include/boost/expected/detail/static_addressof.hpp index 547d898..1019250 100644 --- a/include/boost/expected/detail/static_addressof.hpp +++ b/include/boost/expected/detail/static_addressof.hpp @@ -8,16 +8,16 @@ #include -#include +#ifdef BOOST_CONFIG_HPP #include -#include +#endif //#include #include -# define REQUIRES(...) typename ::boost::enable_if_c<__VA_ARGS__, void*>::type = 0 -# define T_REQUIRES(...) typename = typename ::boost::enable_if_c<(__VA_ARGS__)>::type +# define REQUIRES(...) typename ::std::enable_if<__VA_ARGS__, void*>::type = 0 +# define T_REQUIRES(...) typename = typename ::std::enable_if<(__VA_ARGS__)>::type namespace boost { namespace detail { diff --git a/include/boost/expected/expected.hpp b/include/boost/expected/expected.hpp index b83d0c4..1d24bcd 100644 --- a/include/boost/expected/expected.hpp +++ b/include/boost/expected/expected.hpp @@ -12,6 +12,7 @@ #include #include +#ifdef BOOST_CONFIG_HPP #include #include #include @@ -19,14 +20,15 @@ #include #include #include +#endif #include #include #include #include -# define REQUIRES(...) typename ::boost::enable_if_c<__VA_ARGS__, void*>::type = 0 -# define T_REQUIRES(...) typename = typename ::boost::enable_if_c<(__VA_ARGS__)>::type +# define REQUIRES(...) typename ::std::enable_if<__VA_ARGS__, void*>::type = 0 +# define T_REQUIRES(...) typename = typename ::std::enable_if<(__VA_ARGS__)>::type namespace boost { @@ -67,7 +69,7 @@ namespace no_adl { T value; }; template - wrapper> wrap(T&& v) { return wrapper>(forward(v)); } + wrapper> wrap(T&& v) { return wrapper>(std::forward(v)); } } template @@ -86,6 +88,7 @@ E make_error_from_current_exception(E) return E(); } +#ifdef BOOST_CONFIG_HPP template exception_ptr make_error(Error e, exception_ptr) { @@ -99,7 +102,7 @@ inline exception_ptr make_error_from_current_exception(exception_ptr) { return current_exception(); } - +#endif } @@ -126,7 +129,9 @@ namespace error { template E make_error(Error e) { +#ifdef BOOST_CONFIG_HPP using boost::make_error; +#endif using std::make_error; return make_error(e, E()); } @@ -238,7 +243,7 @@ union trivial_expected_storage #endif BOOST_CONSTEXPR trivial_expected_storage() - BOOST_NOEXCEPT_IF(has_nothrow_default_constructor::value) + BOOST_NOEXCEPT_IF(std::is_nothrow_default_constructible::value) : _err(boost_expected_unrestricted_union_emulation_default_tag()) {} @@ -390,7 +395,7 @@ union no_trivial_expected_storage : _err(e.value()) {} BOOST_CONSTEXPR no_trivial_expected_storage(unexpected_type && e) - : _err(boost::move(e.value())) + : _err(std::move(e.value())) {} template @@ -417,7 +422,7 @@ struct trivial_expected_base trivial_expected_storage storage; BOOST_CONSTEXPR trivial_expected_base() - //BOOST_NOEXCEPT_IF(has_nothrow_default_constructor::value) + //BOOST_NOEXCEPT_IF(std::is_nothrow_default_constructible::value) : has_value(false), storage() {} @@ -513,7 +518,7 @@ struct no_trivial_expected_base no_trivial_expected_storage storage; BOOST_CONSTEXPR no_trivial_expected_base() - //BOOST_NOEXCEPT_IF(has_nothrow_default_constructor::value) + //BOOST_NOEXCEPT_IF(std::is_nothrow_default_constructible::value) : has_value(false), storage() {} @@ -608,7 +613,7 @@ struct no_trivial_expected_base { template using expected_base = typename std::conditional< - has_trivial_destructor::value && has_trivial_destructor::value, + std::is_trivially_destructible::value && std::is_trivially_destructible::value, trivial_expected_base, no_trivial_expected_base >::type; @@ -641,9 +646,9 @@ namespace expected_detail } template -struct is_expected : false_type {}; +struct is_expected : std::false_type {}; template -struct is_expected > : true_type {}; +struct is_expected > : std::true_type {}; template class expected @@ -661,19 +666,19 @@ class expected // Static asserts. typedef boost::is_unexpected is_unexpected_value_t; BOOST_STATIC_ASSERT_MSG( !is_unexpected_value_t::value, "bad ValueType" ); - typedef boost::is_same is_same_value_in_place_t; + typedef std::is_same is_same_value_in_place_t; BOOST_STATIC_ASSERT_MSG( !is_same_value_in_place_t::value, "bad ValueType" ); - typedef boost::is_same is_same_value_unexpect_t; + typedef std::is_same is_same_value_unexpect_t; BOOST_STATIC_ASSERT_MSG( !is_same_value_unexpect_t::value, "bad ValueType" ); - typedef boost::is_same is_same_value_expect_t; + typedef std::is_same is_same_value_expect_t; BOOST_STATIC_ASSERT_MSG( !is_same_value_expect_t::value, "bad ValueType" ); typedef boost::is_unexpected is_unexpected_error_t; BOOST_STATIC_ASSERT_MSG( !is_unexpected_error_t::value, "bad ErrorType" ); - typedef boost::is_same is_same_error_in_place_t; + typedef std::is_same is_same_error_in_place_t; BOOST_STATIC_ASSERT_MSG( !is_same_error_in_place_t::value, "bad ErrorType" ); - typedef boost::is_same is_same_error_unexpect_t; + typedef std::is_same is_same_error_unexpect_t; BOOST_STATIC_ASSERT_MSG( !is_same_error_unexpect_t::value, "bad ErrorType" ); - typedef boost::is_same is_same_error_expect_t; + typedef std::is_same is_same_error_expect_t; BOOST_STATIC_ASSERT_MSG( !is_same_error_expect_t::value, "bad ErrorType" ); value_type* dataptr() { return std::addressof(base_type::storage.val()); } @@ -709,8 +714,10 @@ class expected error_type& contained_err() { return base_type::storage.err(); } #endif +#ifdef BOOST_CONFIG_HPP // C++03 movable support BOOST_COPYABLE_AND_MOVABLE(this_type) +#endif public: @@ -730,7 +737,7 @@ class expected BOOST_CONSTEXPR expected( //REQUIRES(std::is_default_constructible::value) ) BOOST_NOEXCEPT_IF( - has_nothrow_default_constructor::value + std::is_nothrow_default_constructible::value ) : base_type() {} @@ -738,7 +745,7 @@ class expected BOOST_CONSTEXPR expected(const value_type& v //, REQUIRES(std::is_copy_constructible::value) ) - BOOST_NOEXCEPT_IF(has_nothrow_copy_constructor::value) + BOOST_NOEXCEPT_IF(std::is_nothrow_copy_constructible::value) : base_type(v) {} @@ -756,8 +763,8 @@ class expected // && std::is_copy_constructible::value) ) BOOST_NOEXCEPT_IF( - has_nothrow_copy_constructor::value && - has_nothrow_copy_constructor::value + std::is_nothrow_copy_constructible::value && + std::is_nothrow_copy_constructible::value ) : base_type(detail::only_set_valid, rhs.valid()) { @@ -783,11 +790,11 @@ class expected { if (rhs.valid()) { - ::new (dataptr()) value_type(boost::move(rhs.contained_val())); + ::new (dataptr()) value_type(std::move(rhs.contained_val())); } else { - ::new (errorptr()) error_type(boost::move(rhs.contained_err())); + ::new (errorptr()) error_type(std::move(rhs.contained_err())); } } @@ -795,7 +802,7 @@ class expected //, REQUIRES(std::is_copy_constructible::value) ) BOOST_NOEXCEPT_IF( - has_nothrow_copy_constructor::value + std::is_nothrow_copy_constructible::value ) : base_type(e) {} @@ -813,7 +820,7 @@ class expected // , REQUIRES(std::is_copy_constructible::value) ) //BOOST_NOEXCEPT_IF( - //has_nothrow_copy_constructor::value + //std::is_nothrow_copy_constructible::value //std::is_nothrow_copy_constructible::value //) : base_type(e) @@ -836,7 +843,7 @@ class expected expected(unexpect_t, BOOST_FWD_REF(Args)... args ) BOOST_NOEXCEPT_IF( - has_nothrow_copy_constructor::value + std::is_nothrow_copy_constructible::value ) : base_type(unexpected_type(error_type(std::forward(args)...))) {} @@ -889,21 +896,21 @@ class expected expected& operator=(BOOST_RV_REF(expected) e) { - this_type(boost::move(e)).swap(*this); + this_type(std::move(e)).swap(*this); return *this; } - template , value_type>::value)> + template , value_type>::value)> expected& operator=(BOOST_COPY_ASSIGN_REF(U) value) { this_type(value).swap(*this); return *this; } - template , value_type>::value)> + template , value_type>::value)> expected& operator=(BOOST_RV_REF(U) value) { - this_type(boost::move(value)).swap(*this); + this_type(std::move(value)).swap(*this); return *this; } @@ -934,12 +941,12 @@ class expected { if (rhs.valid()) { - boost::swap(contained_val(), rhs.contained_val()); + std::swap(contained_val(), rhs.contained_val()); } else { - error_type t = boost::move(rhs.contained_err()); - new (rhs.dataptr()) value_type(boost::move(contained_val())); + error_type t = std::move(rhs.contained_err()); + new (rhs.dataptr()) value_type(std::move(contained_val())); new (errorptr()) error_type(t); std::swap(contained_has_value(), rhs.contained_has_value()); } @@ -952,7 +959,7 @@ class expected } else { - boost::swap(contained_err(), rhs.contained_err()); + std::swap(contained_err(), rhs.contained_err()); } } } @@ -1165,10 +1172,10 @@ class expected } template - typename result_of::type + typename std::result_of::type catch_all_type_type(BOOST_RV_REF(F) f) { - typedef typename result_of::type result_type; + typedef typename std::result_of::type result_type; try { return f(std::move(**this)); } catch (...) { @@ -1176,10 +1183,10 @@ class expected } } template - typename rebind::type>::type + typename rebind::type>::type catch_all_type_etype(BOOST_RV_REF(F) f) { - typedef typename rebind::type>::type result_type; + typedef typename rebind::type>::type result_type; try { return f(std::move(**this)); } catch (...) { @@ -1200,10 +1207,10 @@ class expected } template - typename result_of::type + typename std::result_of::type catch_all_etype_type(BOOST_RV_REF(F) f) { - typedef typename result_of::type result_type; + typedef typename std::result_of::type result_type; try { return f(std::move(*this)); } catch (...) { @@ -1211,10 +1218,10 @@ class expected } } template - typename rebind::type>::type + typename rebind::type>::type catch_all_etype_etype(BOOST_RV_REF(F) f) { - typedef typename rebind::type>::type result_type; + typedef typename rebind::type>::type result_type; try { return f(std::move(*this)); } catch (...) { @@ -1226,7 +1233,7 @@ class expected template typename rebind::type map(BOOST_RV_REF(F) f, - REQUIRES(boost::is_same::type, void>::value)) + REQUIRES(std::is_same::type, void>::value)) { typedef typename rebind::type result_type; #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR @@ -1244,11 +1251,11 @@ class expected } template - typename rebind::type>::type + typename rebind::type>::type map(BOOST_RV_REF(F) f, - REQUIRES(!boost::is_same::type, void>::value)) + REQUIRES(!std::is_same::type, void>::value)) { - typedef typename rebind::type>::type result_type; + typedef typename rebind::type>::type result_type; #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR if(valid()) { @@ -1266,7 +1273,7 @@ class expected template typename rebind::type bind(BOOST_RV_REF(F) f, - REQUIRES(boost::is_same::type, void>::value)) + REQUIRES(std::is_same::type, void>::value)) { typedef typename rebind::type result_type; #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR @@ -1284,13 +1291,13 @@ class expected } template - typename rebind::type>::type + typename rebind::type>::type bind(BOOST_RV_REF(F) f, - REQUIRES(!boost::is_same::type, void>::value - && !boost::is_expected::type>::value + REQUIRES(!std::is_same::type, void>::value + && !boost::is_expected::type>::value )) { - typedef typename rebind::type>::type result_type; + typedef typename rebind::type>::type result_type; #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR if(valid()) { @@ -1306,10 +1313,10 @@ class expected } template - typename result_of::type + typename std::result_of::type bind(BOOST_RV_REF(F) f, - REQUIRES(!boost::is_same::type, void>::value - && boost::is_expected::type>::value + REQUIRES(!std::is_same::type, void>::value + && boost::is_expected::type>::value ) ) { @@ -1322,45 +1329,45 @@ class expected #else return valid() ? f(value()) - : typename result_of::type(get_unexpected()); + : typename std::result_of::type(get_unexpected()); #endif } template typename rebind::type then(BOOST_RV_REF(F) f, - REQUIRES(boost::is_same::type, void>::value)) + REQUIRES(std::is_same::type, void>::value)) { typedef typename rebind::type result_type; return catch_all_etype_void(std::forward(f)); } template - typename rebind::type>::type + typename rebind::type>::type then(BOOST_RV_REF(F) f, - REQUIRES(!boost::is_same::type, void>::value - && !boost::is_expected::type>::value + REQUIRES(!std::is_same::type, void>::value + && !boost::is_expected::type>::value )) { return catch_all_etype_etype(std::forward(f)); - //typedef typename rebind::type>::type result_type; - //return result_type(f(boost::move(*this))); + //typedef typename rebind::type>::type result_type; + //return result_type(f(std::move(*this))); } template - typename result_of::type + typename std::result_of::type then(BOOST_RV_REF(F) f, - REQUIRES(boost::is_expected::type>::value) + REQUIRES(boost::is_expected::type>::value) ) { return catch_all_etype_type(std::forward(f)); - //return f(boost::move(*this)); + //return f(std::move(*this)); } template this_type catch_error(BOOST_RV_REF(F) f, - REQUIRES(boost::is_same::type, value_type>::value)) + REQUIRES(std::is_same::type, value_type>::value)) { #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR if(!valid()) @@ -1378,7 +1385,7 @@ class expected template this_type catch_error(BOOST_RV_REF(F) f, - REQUIRES(boost::is_same::type, this_type>::value)) + REQUIRES(std::is_same::type, this_type>::value)) { #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR if(!valid()) @@ -1396,7 +1403,7 @@ class expected template this_type catch_error(BOOST_RV_REF(F) f, - REQUIRES(boost::is_same::type, unexpected_type >::value)) + REQUIRES(std::is_same::type, unexpected_type >::value)) { #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR if(!valid()) @@ -1415,7 +1422,7 @@ class expected template this_type catch_exception(BOOST_RV_REF(F) f, REQUIRES( - boost::is_same::type, this_type>::value + std::is_same::type, this_type>::value )) const { try { @@ -1435,7 +1442,7 @@ class expected template this_type catch_exception(BOOST_RV_REF(F) f, REQUIRES( - boost::is_same::type, value_type>::value + std::is_same::type, value_type>::value )) const { try { @@ -1500,11 +1507,11 @@ class expected // Static asserts. typedef boost::is_unexpected is_unexpected_error_t; BOOST_STATIC_ASSERT_MSG( !is_unexpected_error_t::value, "bad ErrorType" ); - typedef boost::is_same is_same_error_in_place_t; + typedef std::is_same is_same_error_in_place_t; BOOST_STATIC_ASSERT_MSG( !is_same_error_in_place_t::value, "bad ErrorType" ); - typedef boost::is_same is_same_error_unexpect_t; + typedef std::is_same is_same_error_unexpect_t; BOOST_STATIC_ASSERT_MSG( !is_same_error_unexpect_t::value, "bad ErrorType" ); - typedef boost::is_same is_same_error_expect_t; + typedef std::is_same is_same_error_expect_t; BOOST_STATIC_ASSERT_MSG( !is_same_error_expect_t::value, "bad ErrorType" ); error_type* errorptr() { return std::addressof(base_type::storage.err()); } @@ -1530,8 +1537,10 @@ class expected error_type& contained_err() { return base_type::storage.err(); } #endif +#ifdef BOOST_CONFIG_HPP // C++03 movable support BOOST_COPYABLE_AND_MOVABLE(this_type) +#endif public: @@ -1551,7 +1560,7 @@ class expected , REQUIRES( std::is_copy_constructible::value) ) BOOST_NOEXCEPT_IF( - has_nothrow_copy_constructor::value + std::is_nothrow_copy_constructible::value ) : base_type(detail::only_set_valid, rhs.valid()) { @@ -1571,7 +1580,7 @@ class expected { if (! rhs.valid()) { - ::new (errorptr()) error_type(boost::move(rhs.contained_err())); + ::new (errorptr()) error_type(std::move(rhs.contained_err())); } } @@ -1585,7 +1594,7 @@ class expected BOOST_CONSTEXPR expected( REQUIRES(std::is_default_constructible::value) ) BOOST_NOEXCEPT_IF( - has_nothrow_default_constructor::value + std::is_nothrow_default_constructible::value ) : base_type() {} @@ -1595,7 +1604,7 @@ class expected , REQUIRES(std::is_copy_constructible::value) ) BOOST_NOEXCEPT_IF( - has_nothrow_copy_constructor::value + std::is_nothrow_copy_constructible::value ) : base_type(e) {} @@ -1603,7 +1612,7 @@ class expected , REQUIRES(std::is_move_constructible::value) ) //BOOST_NOEXCEPT_IF( - // has_nothrow_copy_constructor::value + // std::is_nothrow_copy_constructible::value //) : base_type(std::forward>(e)) {} @@ -1613,7 +1622,7 @@ class expected // , REQUIRES(std::is_copy_constructible::value) ) // BOOST_NOEXCEPT_IF( -// has_nothrow_copy_constructor::value +// std::is_nothrow_copy_constructible::value // ) : base_type(e) {} @@ -1622,7 +1631,7 @@ class expected // , REQUIRES(std::is_copy_constructible::value) ) // BOOST_NOEXCEPT_IF( -// has_nothrow_copy_constructor::value +// std::is_nothrow_copy_constructible::value // ) : base_type(std::forward>(e)) {} @@ -1635,7 +1644,7 @@ class expected expected(unexpect_t, BOOST_FWD_REF(Args)... args ) BOOST_NOEXCEPT_IF( - has_nothrow_copy_constructor::value + std::is_nothrow_copy_constructible::value ) : base_type(unexpected_type(error_type(std::forward(args)...))) {} @@ -1651,7 +1660,7 @@ class expected expected& operator=(BOOST_RV_REF(expected) e) { - this_type(boost::move(e)).swap(*this); + this_type(std::move(e)).swap(*this); return *this; } @@ -1668,7 +1677,7 @@ class expected { if (! rhs.valid()) { - error_type t = boost::move(rhs.contained_err()); + error_type t = std::move(rhs.contained_err()); new (errorptr()) error_type(t); std::swap(contained_has_value(), rhs.contained_has_value()); } @@ -1681,7 +1690,7 @@ class expected } else { - boost::swap(contained_err(), rhs.contained_err()); + std::swap(contained_err(), rhs.contained_err()); } } } @@ -1768,10 +1777,10 @@ class expected return result_type(in_place_t{}); } template - typename result_of::type + typename std::result_of::type catch_all_void_type(BOOST_RV_REF(F) f) { - typedef typename result_of::type result_type; + typedef typename std::result_of::type result_type; try { return f(); } catch (...) { @@ -1779,10 +1788,10 @@ class expected } } template - typename rebind::type>::type + typename rebind::type>::type catch_all_void_etype(BOOST_RV_REF(F) f) { - typedef typename rebind::type>::type result_type; + typedef typename rebind::type>::type result_type; try { return f(); } catch (...) { @@ -1802,10 +1811,10 @@ class expected return result_type(in_place_t{}); } template - typename result_of::type + typename std::result_of::type catch_all_evoid_type(BOOST_RV_REF(F) f) { - typedef typename result_of::type result_type; + typedef typename std::result_of::type result_type; try { return f(std::move(*this)); } catch (...) { @@ -1813,10 +1822,10 @@ class expected } } template - typename rebind::type>::type + typename rebind::type>::type catch_all_evoid_etype(BOOST_RV_REF(F) f) { - typedef typename rebind::type>::type result_type; + typedef typename rebind::type>::type result_type; try { return f(std::move(*this)); } catch (...) { @@ -1828,7 +1837,7 @@ class expected template BOOST_CONSTEXPR typename rebind::type bind(BOOST_RV_REF(F) f, - REQUIRES(boost::is_same::type, void>::value)) const + REQUIRES(std::is_same::type, void>::value)) const { typedef typename rebind::type result_type; #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR @@ -1847,11 +1856,11 @@ class expected } template - typename rebind::type>::type + typename rebind::type>::type bind(BOOST_RV_REF(F) f, - REQUIRES( ! boost::is_same::type, void>::value) ) + REQUIRES( ! std::is_same::type, void>::value) ) { - typedef typename rebind::type>::type result_type; + typedef typename rebind::type>::type result_type; #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR if(valid()) { @@ -1869,44 +1878,44 @@ class expected template typename rebind::type then(BOOST_RV_REF(F) f, - REQUIRES(boost::is_same::type, void>::value)) + REQUIRES(std::is_same::type, void>::value)) { typedef typename rebind::type result_type; #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR - f(boost::move(*this)); + f(std::move(*this)); return result_type(in_place_t{}); #else - return ( f(boost::move(*this)), result_type(in_place_t{}) ); + return ( f(std::move(*this)), result_type(in_place_t{}) ); #endif } // then factory template - typename rebind::type>::type + typename rebind::type>::type then(BOOST_RV_REF(F) f, - REQUIRES(!boost::is_expected::type>::value + REQUIRES(!boost::is_expected::type>::value )) { - typedef typename rebind::type>::type result_type; - return result_type(f(boost::move(*this))); + typedef typename rebind::type>::type result_type; + return result_type(f(std::move(*this))); } template - typename result_of::type + typename std::result_of::type then(BOOST_RV_REF(F) f, - REQUIRES(!boost::is_same::type, void>::value - && boost::is_expected::type>::value + REQUIRES(!std::is_same::type, void>::value + && boost::is_expected::type>::value ) ) { - return f(boost::move(*this)); + return f(std::move(*this)); } // catch_error factory template this_type catch_error(BOOST_RV_REF(F) f, - REQUIRES(boost::is_same::type, value_type>::value)) + REQUIRES(std::is_same::type, value_type>::value)) { #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR if(! valid()) @@ -1924,7 +1933,7 @@ class expected template this_type catch_error(BOOST_RV_REF(F) f, - REQUIRES(! boost::is_same::type, value_type>::value)) + REQUIRES(! std::is_same::type, value_type>::value)) { #if ! defined BOOST_NO_CXX14_RELAXED_CONSTEXPR if(!valid()) @@ -1943,7 +1952,7 @@ class expected template this_type catch_exception(BOOST_RV_REF(F) f, REQUIRES( - boost::is_same::type, this_type>::value + std::is_same::type, this_type>::value )) const { try { @@ -1963,7 +1972,7 @@ class expected template this_type catch_exception(BOOST_RV_REF(F) f, REQUIRES( - boost::is_same::type, value_type>::value + std::is_same::type, value_type>::value )) const { try { @@ -2243,9 +2252,9 @@ expected > make_expected_from_error(E e) BOOST_NOEXCEPT } template -expected::type, std::exception_ptr> +expected::type, std::exception_ptr> BOOST_FORCEINLINE make_expected_from_call(F funct - , REQUIRES( ! boost::is_same::type, void>::value) + , REQUIRES( ! std::is_same::type, void>::value) ) BOOST_NOEXCEPT { try @@ -2261,7 +2270,7 @@ BOOST_FORCEINLINE make_expected_from_call(F funct template inline expected make_expected_from_call(F funct - , REQUIRES( boost::is_same::type, void>::value) + , REQUIRES( std::is_same::type, void>::value) ) BOOST_NOEXCEPT { try diff --git a/include/boost/expected/unexpected.hpp b/include/boost/expected/unexpected.hpp index db83ab7..e87b103 100644 --- a/include/boost/expected/unexpected.hpp +++ b/include/boost/expected/unexpected.hpp @@ -10,9 +10,10 @@ #include #include - +#ifdef BOOST_CONFIG_HPP #include #include +#endif #include #include @@ -70,6 +71,7 @@ namespace boost return unexpected_type> (std::forward(ex)); } +#ifdef BOOST_CONFIG_HPP template <> struct unexpected_type { @@ -97,6 +99,7 @@ namespace boost return error_; } }; +#endif template <> struct unexpected_type @@ -178,6 +181,7 @@ namespace boost return x==y; } +#ifdef BOOST_CONFIG_HPP inline BOOST_CONSTEXPR bool operator<(const unexpected_type& x, const unexpected_type& y) { return false; @@ -194,11 +198,12 @@ namespace boost { return x==y; } +#endif template - struct is_unexpected : false_type {}; + struct is_unexpected : std::false_type {}; template - struct is_unexpected > : true_type {}; + struct is_unexpected > : std::true_type {}; BOOST_FORCEINLINE unexpected_type make_unexpected_from_current_exception() { diff --git a/include/boost/functional/monads/adaptor.hpp b/include/boost/functional/monads/adaptor.hpp index e1d96cf..3aa5164 100644 --- a/include/boost/functional/monads/adaptor.hpp +++ b/include/boost/functional/monads/adaptor.hpp @@ -128,11 +128,11 @@ namespace detail }; template - struct if_valued0 : if_valued2::type> + struct if_valued0 : if_valued2::type> { explicit if_valued0(F f) : - if_valued2::type> (f) + if_valued2::type> (f) { } @@ -170,7 +170,7 @@ namespace detail { } - typedef typename result_of::type result_type; + typedef typename std::result_of::type result_type; template result_type operator()(G e) diff --git a/include/boost/functional/monads/categories/errored.hpp b/include/boost/functional/monads/categories/errored.hpp index 583a5be..cf95734 100644 --- a/include/boost/functional/monads/categories/errored.hpp +++ b/include/boost/functional/monads/categories/errored.hpp @@ -68,7 +68,7 @@ namespace functional template ()( errored::deref(std::declval()) ) )> static BOOST_CONSTEXPR auto bind(M&& m, F&& f, - REQUIRES(boost::is_same::value) + REQUIRES(std::is_same::value) ) -> typename errored::rebind, FR>::type { using namespace errored; @@ -91,7 +91,7 @@ namespace functional template ()( errored::deref(std::declval()) ) )> static BOOST_CONSTEXPR auto bind(M&& m, F&& f, - REQUIRES((! boost::is_same::value + REQUIRES((! std::is_same::value && ! boost::functional::is_monad::value) )) -> typename errored::rebind, FR>::type {