diff --git a/include/boost/variant/detail/apply_visitor_binary.hpp b/include/boost/variant/detail/apply_visitor_binary.hpp index 4aaae2a..bfd2844 100644 --- a/include/boost/variant/detail/apply_visitor_binary.hpp +++ b/include/boost/variant/detail/apply_visitor_binary.hpp @@ -31,9 +31,6 @@ #endif #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -# define USE_UNIVERSAL_REF - -# include # include # include # include @@ -51,7 +48,7 @@ namespace boost { namespace detail { namespace variant { -template +template class apply_visitor_binary_invoke { public: // visitor typedefs @@ -74,17 +71,17 @@ public: // structors public: // visitor interfaces -#ifdef USE_UNIVERSAL_REF +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template - typename enable_if>, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type + typename enable_if_c::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type operator()(Value2&& value2) { return visitor_(::boost::move(value1_), ::boost::forward(value2)); } template - typename disable_if>, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type + typename disable_if_c::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type operator()(Value2&& value2) { return visitor_(value1_, ::boost::forward(value2)); @@ -105,7 +102,7 @@ private: apply_visitor_binary_invoke& operator=(const apply_visitor_binary_invoke&); }; -template +template class apply_visitor_binary_unwrap { public: // visitor typedefs @@ -128,29 +125,29 @@ public: // structors public: // visitor interfaces -#ifdef USE_UNIVERSAL_REF +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template - typename enable_if>, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type + typename enable_if_c::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type operator()(Value1&& value1) { apply_visitor_binary_invoke< Visitor , Value1 - , mpl::not_<::boost::is_lvalue_reference> + , ! ::boost::is_lvalue_reference::value > invoker(visitor_, value1); return boost::apply_visitor(invoker, ::boost::move(visitable2_)); } template - typename disable_if>, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type + typename disable_if_c::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type operator()(Value1&& value1) { apply_visitor_binary_invoke< Visitor , Value1 - , mpl::not_<::boost::is_lvalue_reference> + , ! ::boost::is_lvalue_reference::value > invoker(visitor_, value1); return boost::apply_visitor(invoker, visitable2_); @@ -165,7 +162,7 @@ public: // visitor interfaces apply_visitor_binary_invoke< Visitor , Value1 - , ::boost::false_type + , false > invoker(visitor_, value1); return boost::apply_visitor(invoker, visitable2_); @@ -201,7 +198,7 @@ private: #endif // EDG-based compilers workaround -#ifdef USE_UNIVERSAL_REF +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template inline @@ -209,7 +206,7 @@ inline apply_visitor( Visitor& visitor, Visitable1&& visitable1, Visitable2&& visitable2) { ::boost::detail::variant::apply_visitor_binary_unwrap< - Visitor, Visitable2, mpl::not_<::boost::is_lvalue_reference> + Visitor, Visitable2, ! ::boost::is_lvalue_reference::value > unwrapper(visitor, visitable2); return boost::apply_visitor(unwrapper, ::boost::forward(visitable1)); @@ -223,7 +220,7 @@ inline apply_visitor( Visitor& visitor, Visitable1& visitable1, Visitable2& visitable2) { ::boost::detail::variant::apply_visitor_binary_unwrap< - Visitor, Visitable2, ::boost::false_type + Visitor, Visitable2, false > unwrapper(visitor, visitable2); return boost::apply_visitor(unwrapper, visitable1); @@ -237,7 +234,7 @@ apply_visitor( Visitor& visitor, Visitable1& visitable1, Visitable2& visitable2) // const-visitor version: // -#ifdef USE_UNIVERSAL_REF +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template inline @@ -247,7 +244,7 @@ inline apply_visitor( const Visitor& visitor , Visitable1&& visitable1 , Visitable2&& visitable2) { ::boost::detail::variant::apply_visitor_binary_unwrap< - const Visitor, Visitable2, mpl::not_<::boost::is_lvalue_reference> + const Visitor, Visitable2, ! ::boost::is_lvalue_reference::value > unwrapper(visitor, visitable2); return boost::apply_visitor(unwrapper, ::boost::forward(visitable1)); @@ -263,7 +260,7 @@ inline apply_visitor( const Visitor& visitor , Visitable1& visitable1 , Visitable2& visitable2) { ::boost::detail::variant::apply_visitor_binary_unwrap< - const Visitor, Visitable2, ::boost::false_type + const Visitor, Visitable2, false > unwrapper(visitor, visitable2); return boost::apply_visitor(unwrapper, visitable1); @@ -282,7 +279,7 @@ apply_visitor( const Visitor& visitor , Visitable1& visitable1 , Visitable2& vis namespace detail { namespace variant { -template +template class apply_visitor_binary_invoke_cpp14 { Visitor& visitor_; @@ -299,13 +296,13 @@ public: // structors public: // visitor interfaces template - decltype(auto) operator()(Value2&& value2, typename enable_if>>::type* = 0) + decltype(auto) operator()(Value2&& value2, typename enable_if_c::value>::type* = 0) { return visitor_(::boost::move(value1_), ::boost::forward(value2)); } template - decltype(auto) operator()(Value2&& value2, typename disable_if>>::type* = 0) + decltype(auto) operator()(Value2&& value2, typename disable_if_c::value>::type* = 0) { return visitor_(value1_, ::boost::forward(value2)); } @@ -314,7 +311,7 @@ private: apply_visitor_binary_invoke_cpp14& operator=(const apply_visitor_binary_invoke_cpp14&); }; -template +template class apply_visitor_binary_unwrap_cpp14 { Visitor& visitor_; @@ -331,24 +328,24 @@ public: // structors public: // visitor interfaces template - decltype(auto) operator()(Value1&& value1, typename enable_if>>::type* = 0) + decltype(auto) operator()(Value1&& value1, typename enable_if_c::value>::type* = 0) { apply_visitor_binary_invoke_cpp14< Visitor , Value1 - , mpl::not_<::boost::is_lvalue_reference> + , ! ::boost::is_lvalue_reference::value > invoker(visitor_, value1); return boost::apply_visitor(invoker, ::boost::move(visitable2_)); } template - decltype(auto) operator()(Value1&& value1, typename disable_if>>::type* = 0) + decltype(auto) operator()(Value1&& value1, typename disable_if_c::value>::type* = 0) { apply_visitor_binary_invoke_cpp14< Visitor , Value1 - , mpl::not_<::boost::is_lvalue_reference> + , ! ::boost::is_lvalue_reference::value > invoker(visitor_, value1); return boost::apply_visitor(invoker, visitable2_); @@ -367,7 +364,7 @@ inline decltype(auto) apply_visitor(Visitor& visitor, Visitable1&& visitable1, V >::type* = 0) { ::boost::detail::variant::apply_visitor_binary_unwrap_cpp14< - Visitor, Visitable2, mpl::not_<::boost::is_lvalue_reference> + Visitor, Visitable2, ! ::boost::is_lvalue_reference::value > unwrapper(visitor, visitable2); return boost::apply_visitor(unwrapper, ::boost::forward(visitable1)); @@ -380,7 +377,7 @@ inline decltype(auto) apply_visitor(const Visitor& visitor, Visitable1&& visitab >::type* = 0) { ::boost::detail::variant::apply_visitor_binary_unwrap_cpp14< - const Visitor, Visitable2, mpl::not_<::boost::is_lvalue_reference> + const Visitor, Visitable2, ! ::boost::is_lvalue_reference::value > unwrapper(visitor, visitable2); return boost::apply_visitor(unwrapper, ::boost::forward(visitable1)); @@ -391,6 +388,4 @@ inline decltype(auto) apply_visitor(const Visitor& visitor, Visitable1&& visitab } // namespace boost -#undef USE_UNIVERSAL_REF - #endif // BOOST_VARIANT_DETAIL_APPLY_VISITOR_BINARY_HPP diff --git a/include/boost/variant/detail/apply_visitor_unary.hpp b/include/boost/variant/detail/apply_visitor_unary.hpp index 5baf4a4..09f70a0 100644 --- a/include/boost/variant/detail/apply_visitor_unary.hpp +++ b/include/boost/variant/detail/apply_visitor_unary.hpp @@ -65,10 +65,6 @@ namespace boost { #endif // EDG-based compilers workaround #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES -# define USE_UNIVERSAL_REF -#endif - -#ifdef USE_UNIVERSAL_REF template inline BOOST_VARIANT_AUX_APPLY_VISITOR_NON_CONST_RESULT_TYPE(Visitor) @@ -92,7 +88,7 @@ apply_visitor(Visitor& visitor, Visitable& visitable) // const-visitor version: // -#ifdef USE_UNIVERSAL_REF +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template inline BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(typename Visitor::result_type) @@ -110,8 +106,6 @@ apply_visitor(const Visitor& visitor, Visitable& visitable) } #endif -#undef USE_UNIVERSAL_REF - #if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) diff --git a/include/boost/variant/detail/multivisitors_cpp11_based.hpp b/include/boost/variant/detail/multivisitors_cpp11_based.hpp index 13e0f00..56aaf12 100644 --- a/include/boost/variant/detail/multivisitors_cpp11_based.hpp +++ b/include/boost/variant/detail/multivisitors_cpp11_based.hpp @@ -44,16 +44,16 @@ namespace detail { namespace variant { : index_sequence {}; - template + template struct MoveableWrapper //Just a reference with some metadata { typedef T_ T; - typedef MoveSemantics_ MoveSemantics; + static constexpr bool MoveSemantics = MoveSemantics_; T& v; }; - template + template MoveableWrapper wrap(Tp& t) { @@ -61,14 +61,14 @@ namespace detail { namespace variant { } template - typename enable_if::type + typename enable_if_c::type unwrap(Wrapper& w) { return ::boost::move(w.v); } template - typename disable_if::type & + typename disable_if_c::type & unwrap(Wrapper& w) { return w.v; @@ -132,7 +132,7 @@ namespace detail { namespace variant { make_one_by_one_visitor_and_value_referer( visitor_, tuple_tail(visitables_), - std::tuple_cat(values_, std::make_tuple(wrap>>(value))) + std::tuple_cat(values_, std::make_tuple(wrap::value>(value))) ) , unwrap(std::get<0>(visitables_)) // getting Head element ); @@ -167,7 +167,7 @@ namespace detail { namespace variant { BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) operator()(Value&& value) const { return do_call( - std::tuple_cat(values_, std::make_tuple(wrap>>(value))), + std::tuple_cat(values_, std::make_tuple(wrap::value>(value))), make_index_sequence() ); } @@ -183,9 +183,9 @@ namespace detail { namespace variant { ::boost::detail::variant::make_one_by_one_visitor_and_value_referer( visitor, std::make_tuple( - ::boost::detail::variant::wrap>>(v2), - ::boost::detail::variant::wrap>>(v3), - ::boost::detail::variant::wrap>>(vn)... + ::boost::detail::variant::wrap::value>(v2), + ::boost::detail::variant::wrap::value>(v3), + ::boost::detail::variant::wrap::value>(vn)... ), std::tuple<>() ), @@ -201,9 +201,9 @@ namespace detail { namespace variant { ::boost::detail::variant::make_one_by_one_visitor_and_value_referer( visitor, std::make_tuple( - ::boost::detail::variant::wrap>>(v2), - ::boost::detail::variant::wrap>>(v3), - ::boost::detail::variant::wrap>>(vn)... + ::boost::detail::variant::wrap::value>(v2), + ::boost::detail::variant::wrap::value>(v3), + ::boost::detail::variant::wrap::value>(vn)... ), std::tuple<>() ), diff --git a/include/boost/variant/detail/multivisitors_cpp14_based.hpp b/include/boost/variant/detail/multivisitors_cpp14_based.hpp index 1087f99..abf03eb 100644 --- a/include/boost/variant/detail/multivisitors_cpp14_based.hpp +++ b/include/boost/variant/detail/multivisitors_cpp14_based.hpp @@ -62,7 +62,7 @@ namespace detail { namespace variant { make_one_by_one_visitor_and_value_referer_cpp14( visitor_, tuple_tail(visitables_), - std::tuple_cat(values_, std::make_tuple(wrap>>(value))) + std::tuple_cat(values_, std::make_tuple(wrap::value>(value))) ) , unwrap(std::get<0>(visitables_)) // getting Head element ); @@ -95,7 +95,7 @@ namespace detail { namespace variant { decltype(auto) operator()(Value&& value) const { return do_call( - std::tuple_cat(values_, std::make_tuple(wrap>>(value))), + std::tuple_cat(values_, std::make_tuple(wrap::value>(value))), make_index_sequence() ); } @@ -113,9 +113,9 @@ namespace detail { namespace variant { ::boost::detail::variant::make_one_by_one_visitor_and_value_referer_cpp14( visitor, std::make_tuple( - ::boost::detail::variant::wrap>>(v2), - ::boost::detail::variant::wrap>>(v3), - ::boost::detail::variant::wrap>>(vn)... + ::boost::detail::variant::wrap::value>(v2), + ::boost::detail::variant::wrap::value>(v3), + ::boost::detail::variant::wrap::value>(vn)... ), std::tuple<>() ), @@ -134,9 +134,9 @@ namespace detail { namespace variant { ::boost::detail::variant::make_one_by_one_visitor_and_value_referer_cpp14( visitor, std::make_tuple( - ::boost::detail::variant::wrap>>(v2), - ::boost::detail::variant::wrap>>(v3), - ::boost::detail::variant::wrap>>(vn)... + ::boost::detail::variant::wrap::value>(v2), + ::boost::detail::variant::wrap::value>(v3), + ::boost::detail::variant::wrap::value>(vn)... ), std::tuple<>() ), diff --git a/include/boost/variant/variant.hpp b/include/boost/variant/variant.hpp index d2ef424..3e315f3 100644 --- a/include/boost/variant/variant.hpp +++ b/include/boost/variant/variant.hpp @@ -1019,7 +1019,7 @@ struct less_comp // * for wrappers (e.g., recursive_wrapper), the wrapper's held value. // * for all other values, the value itself. // -template +template class invoke_visitor { private: // representation @@ -1046,14 +1046,14 @@ public: // internal visitor interfaces //using workaround with is_same to prenvent compilation error, because we need to use T in enable_if to make SFINAE work template - typename enable_if>, result_type>::type internal_visit(T&& operand, int) + typename enable_if_c::value, result_type>::type internal_visit(T&& operand, int) { return visitor_(::boost::move(operand)); } //using workaround with is_same to prenvent compilation error, because we need to use T in enable_if to make SFINAE work template - typename disable_if>, result_type>::type internal_visit(T&& operand, int) + typename disable_if_c::value, result_type>::type internal_visit(T&& operand, int) { return visitor_(operand); } @@ -1084,7 +1084,7 @@ private: // helpers, for internal visitor interfaces (below) //using workaround with is_same to prenvent compilation error, because we need to use T in enable_if to make SFINAE work template - typename enable_if>, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type + typename enable_if::value>, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type visit_impl(T&& operand, mpl::false_) { return visitor_(::boost::move(operand)); @@ -1092,7 +1092,7 @@ private: // helpers, for internal visitor interfaces (below) //using workaround with is_same to prenvent compilation error, because we need to use T in enable_if to make SFINAE work template - typename enable_if>, BOOST_VARIANT_AUX_RETURN_VOID_TYPE>::type + typename enable_if_c::value, BOOST_VARIANT_AUX_RETURN_VOID_TYPE>::type visit_impl(T&& operand, mpl::true_) { visitor_(::boost::move(operand)); @@ -1101,7 +1101,7 @@ private: // helpers, for internal visitor interfaces (below) //using workaround with is_same to prenvent compilation error, because we need to use T in enable_if to make SFINAE work template - typename disable_if>, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type + typename disable_if_c::value, BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type)>::type visit_impl(T&& operand, mpl::false_) { return visitor_(operand); @@ -1109,7 +1109,7 @@ private: // helpers, for internal visitor interfaces (below) //using workaround with is_same to prenvent compilation error, because we need to use T in enable_if to make SFINAE work template - typename disable_if>, BOOST_VARIANT_AUX_RETURN_VOID_TYPE>::type + typename disable_if::value, BOOST_VARIANT_AUX_RETURN_VOID_TYPE>::type visit_impl(T&& operand, mpl::true_) { visitor_(operand); @@ -2489,7 +2489,7 @@ public: // visitation support ) apply_visitor(Visitor& visitor) && { - detail::variant::invoke_visitor invoker(visitor); + detail::variant::invoke_visitor invoker(visitor); return this->internal_apply_visitor(invoker); } @@ -2499,7 +2499,7 @@ public: // visitation support ) apply_visitor(Visitor& visitor) const&& { - detail::variant::invoke_visitor invoker(visitor); + detail::variant::invoke_visitor invoker(visitor); return this->internal_apply_visitor(invoker); } @@ -2514,7 +2514,7 @@ public: // visitation support & #endif { - detail::variant::invoke_visitor invoker(visitor); + detail::variant::invoke_visitor invoker(visitor); return this->internal_apply_visitor(invoker); } @@ -2527,7 +2527,7 @@ public: // visitation support & #endif { - detail::variant::invoke_visitor invoker(visitor); + detail::variant::invoke_visitor invoker(visitor); return this->internal_apply_visitor(invoker); }