diff --git a/include/boost/variant/detail/apply_visitor_unary.hpp b/include/boost/variant/detail/apply_visitor_unary.hpp index 71610cb..c3a741e 100644 --- a/include/boost/variant/detail/apply_visitor_unary.hpp +++ b/include/boost/variant/detail/apply_visitor_unary.hpp @@ -23,6 +23,7 @@ # include # include # include +# include # include # include #endif @@ -85,7 +86,7 @@ namespace detail { namespace variant { // This class serves only metaprogramming purposes. none of its methods must be called at runtime! template struct result_multideduce1 { - typedef typename Variant::types types; + typedef typename remove_reference::type::types types; typedef typename boost::mpl::begin::type begin_it; typedef typename boost::mpl::advance< begin_it, boost::mpl::int_::type::value - 1> @@ -95,14 +96,14 @@ struct result_multideduce1 { struct deduce_impl { typedef typename boost::mpl::next::type next_t; typedef typename boost::mpl::deref::type value_t; - typedef decltype(true ? boost::declval< Visitor& >()( boost::declval< value_t >() ) + typedef decltype(true ? boost::declval< Visitor& >()( boost::declval< copy_cv_ref_t< value_t, Variant > >() ) : boost::declval< typename deduce_impl::type >()) type; }; template struct deduce_impl { typedef typename boost::mpl::deref::type value_t; - typedef decltype(boost::declval< Visitor& >()( boost::declval< value_t >() )) type; + typedef decltype(boost::declval< Visitor& >()( boost::declval< copy_cv_ref_t< value_t, Variant > >() )) type; }; typedef typename deduce_impl::type type; @@ -132,7 +133,7 @@ inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable, boost::detail::variant::has_result_type >::type* = 0) { - boost::detail::variant::result_wrapper1::type> cpp14_vis(::boost::forward(visitor)); + boost::detail::variant::result_wrapper1 cpp14_vis(::boost::forward(visitor)); return ::boost::forward(visitable).apply_visitor(cpp14_vis); }