summaryrefslogtreecommitdiff
path: root/boost/variant
diff options
context:
space:
mode:
Diffstat (limited to 'boost/variant')
-rw-r--r--boost/variant/detail/apply_visitor_unary.hpp21
-rw-r--r--boost/variant/detail/substitute.hpp28
-rw-r--r--boost/variant/variant.hpp4
3 files changed, 34 insertions, 19 deletions
diff --git a/boost/variant/detail/apply_visitor_unary.hpp b/boost/variant/detail/apply_visitor_unary.hpp
index 09f70a0b47..7e93a51415 100644
--- a/boost/variant/detail/apply_visitor_unary.hpp
+++ b/boost/variant/detail/apply_visitor_unary.hpp
@@ -155,9 +155,9 @@ struct result_wrapper1
{
typedef decltype(result_multideduce1<Visitor, Variant>::deduce()) result_type;
- Visitor& visitor_;
- explicit result_wrapper1(Visitor& visitor) BOOST_NOEXCEPT
- : visitor_(visitor)
+ Visitor&& visitor_;
+ explicit result_wrapper1(Visitor&& visitor) BOOST_NOEXCEPT
+ : visitor_(::boost::forward<Visitor>(visitor))
{}
template <class T>
@@ -169,26 +169,15 @@ struct result_wrapper1
}} // namespace detail::variant
template <typename Visitor, typename Visitable>
-inline decltype(auto) apply_visitor(Visitor& visitor, Visitable&& visitable,
+inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable,
typename boost::disable_if<
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
{
- boost::detail::variant::result_wrapper1<Visitor, typename remove_reference<Visitable>::type> cpp14_vis(visitor);
+ boost::detail::variant::result_wrapper1<Visitor, typename remove_reference<Visitable>::type> cpp14_vis(::boost::forward<Visitor>(visitor));
return ::boost::forward<Visitable>(visitable).apply_visitor(cpp14_vis);
}
-template <typename Visitor, typename Visitable>
-inline decltype(auto) apply_visitor(const Visitor& visitor, Visitable&& visitable,
- typename boost::disable_if<
- boost::detail::variant::has_result_type<Visitor>
- >::type* = 0)
-{
- boost::detail::variant::result_wrapper1<const Visitor, typename remove_reference<Visitable>::type> cpp14_vis(visitor);
- return ::boost::forward<Visitable>(visitable).apply_visitor(cpp14_vis);
-}
-
-
#endif // !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276)
} // namespace boost
diff --git a/boost/variant/detail/substitute.hpp b/boost/variant/detail/substitute.hpp
index 2579eb51bb..f9d29a50c5 100644
--- a/boost/variant/detail/substitute.hpp
+++ b/boost/variant/detail/substitute.hpp
@@ -145,7 +145,32 @@ struct substitute<
Ts, Dest, Source
>::type...> type;
};
-#endif // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
+
+//
+// function specializations
+//
+template <
+ typename R
+ , typename... A
+ , typename Dest
+ , typename Source
+ >
+struct substitute<
+ R (*)(A...)
+ , Dest
+ , Source
+ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(mpl::int_<-1>)
+ >
+{
+private:
+ typedef typename substitute< R, Dest, Source >::type r;
+
+public:
+ typedef r (*type)(typename substitute<
+ A, Dest, Source
+ >::type...);
+};
+#else
#define BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL(N) \
typedef typename substitute< \
@@ -164,6 +189,7 @@ struct substitute<
#undef BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL
#undef BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF
+#endif // !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES)
#endif // !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE)
}} // namespace detail::variant
diff --git a/boost/variant/variant.hpp b/boost/variant/variant.hpp
index 2e99fbd521..d33a23e477 100644
--- a/boost/variant/variant.hpp
+++ b/boost/variant/variant.hpp
@@ -40,7 +40,7 @@
#include <boost/detail/reference_content.hpp>
#include <boost/aligned_storage.hpp>
#include <boost/blank.hpp>
-#include <boost/math/common_factor_ct.hpp>
+#include <boost/integer/common_factor_ct.hpp>
#include <boost/static_assert.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repeat.hpp>
@@ -145,7 +145,7 @@ struct add_alignment
template <typename State, typename Item>
struct apply
: mpl::size_t<
- ::boost::math::static_lcm<
+ ::boost::integer::static_lcm<
BOOST_MPL_AUX_VALUE_WKND(State)::value
, ::boost::alignment_of<Item>::value
>::value