diff options
Diffstat (limited to 'boost/fusion/support/detail')
-rw-r--r-- | boost/fusion/support/detail/as_fusion_element.hpp | 12 | ||||
-rw-r--r-- | boost/fusion/support/detail/enabler.hpp | 18 | ||||
-rw-r--r-- | boost/fusion/support/detail/result_of.hpp | 53 | ||||
-rw-r--r-- | boost/fusion/support/detail/segmented_fold_until_impl.hpp | 24 |
4 files changed, 95 insertions, 12 deletions
diff --git a/boost/fusion/support/detail/as_fusion_element.hpp b/boost/fusion/support/detail/as_fusion_element.hpp index 628dca4d16..2af960eedf 100644 --- a/boost/fusion/support/detail/as_fusion_element.hpp +++ b/boost/fusion/support/detail/as_fusion_element.hpp @@ -11,6 +11,10 @@ #include <boost/fusion/support/config.hpp> #include <boost/ref.hpp> +#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL +#include <functional> +#endif + namespace boost { namespace fusion { namespace detail { template <typename T> @@ -25,6 +29,14 @@ namespace boost { namespace fusion { namespace detail typedef T& type; }; +#ifndef BOOST_NO_CXX11_HDR_FUNCTIONAL + template <typename T> + struct as_fusion_element<std::reference_wrapper<T> > + { + typedef T& type; + }; +#endif + template <typename T, int N> struct as_fusion_element<T[N]> { diff --git a/boost/fusion/support/detail/enabler.hpp b/boost/fusion/support/detail/enabler.hpp new file mode 100644 index 0000000000..48b69f3227 --- /dev/null +++ b/boost/fusion/support/detail/enabler.hpp @@ -0,0 +1,18 @@ +/*============================================================================= + Copyright (c) 2015 Kohei Takahashi + + Use modification and distribution are subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt). +==============================================================================*/ +#ifndef FUSION_DETAIL_ENABLER_02082015_163810 +#define FUSION_DETAIL_ENABLER_02082015_163810 + +namespace boost { namespace fusion { namespace detail +{ + template <typename, typename T = void> + struct enabler { typedef T type; }; +}}} + +#endif + diff --git a/boost/fusion/support/detail/result_of.hpp b/boost/fusion/support/detail/result_of.hpp new file mode 100644 index 0000000000..e53ea9e354 --- /dev/null +++ b/boost/fusion/support/detail/result_of.hpp @@ -0,0 +1,53 @@ +/*============================================================================= + Copyright (c) 2001-2014 Joel de Guzman + + Distributed under the Boost Software License, Version 1.0. (See accompanying + file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +==============================================================================*/ +#if !defined(FUSION_RESULT_OF_10272014_0654) +#define FUSION_RESULT_OF_10272014_0654 + +#include <boost/config.hpp> +#include <boost/utility/result_of.hpp> + +#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#define BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF +#endif + +#if !defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) +#include <boost/mpl/if.hpp> +#include <boost/mpl/or.hpp> +#include <boost/mpl/has_xxx.hpp> +#endif + +namespace boost { namespace fusion { namespace detail +{ + // This is a temporary workaround for result_of before we make fusion fully + // sfinae result_of friendy, which will require some heavy lifting for some + // low level code. So far this is used only in the fold algorithm. This will + // be removed once we overhaul fold. + +#if defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) + + template <typename Sig> + struct result_of_with_decltype : boost::tr1_result_of<Sig> {}; + +#else // defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) + + BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) + BOOST_MPL_HAS_XXX_TEMPLATE_DEF(result) + + template <typename Sig> + struct result_of_with_decltype; + + template <typename F, typename... Args> + struct result_of_with_decltype<F(Args...)> + : mpl::if_<mpl::or_<has_result_type<F>, detail::has_result<F> >, + boost::tr1_result_of<F(Args...)>, + boost::detail::cpp0x_result_of<F(Args...)> >::type {}; + +#endif // defined(BOOST_FUSION_NO_DECLTYPE_BASED_RESULT_OF) + +}}} + +#endif diff --git a/boost/fusion/support/detail/segmented_fold_until_impl.hpp b/boost/fusion/support/detail/segmented_fold_until_impl.hpp index 514e8d950b..6a388bf834 100644 --- a/boost/fusion/support/detail/segmented_fold_until_impl.hpp +++ b/boost/fusion/support/detail/segmented_fold_until_impl.hpp @@ -66,8 +66,8 @@ namespace boost { namespace fusion } template <typename Cur, typename Context> - BOOST_FUSION_GPU_ENABLED - typename result_of::make_segmented_iterator<Cur, Context>::type + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED + inline typename result_of::make_segmented_iterator<Cur, Context>::type make_segmented_iterator(Cur const& cur, Context const& context) { typedef result_of::make_segmented_iterator<Cur, Context> impl_type; @@ -121,7 +121,7 @@ namespace boost { namespace fusion typedef iterator_range<Cur, End> range_type; typedef cons<range_type, Context> type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Cur const& cur, End const& end, Context const& context) { return cons<range_type, Context>(range_type(cur, end), context); @@ -170,7 +170,7 @@ namespace boost { namespace fusion typedef typename impl::type type; typedef typename impl::continue_type continue_type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence& seq, State const& state, Context const& context, Fun const& fun) { return impl::call(fusion::segments(seq), state, context, fun); @@ -192,7 +192,7 @@ namespace boost { namespace fusion typedef typename apply_type::type type; typedef typename apply_type::continue_type continue_type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Sequence& seq, State const& state, Context const& context, Fun const& fun) { return apply_type::call(seq, state, context, fun); @@ -274,14 +274,14 @@ namespace boost { namespace fusion >::type continue_type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Begin const& beg, End const& end, State const& state , Context const& context, Fun const& fun) { return call(beg, end, state, context, fun, typename fold_recurse_impl::continue_type()); } - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Begin const& beg, End const& end, State const& state , Context const& context, Fun const& fun, mpl::true_) // continue { @@ -297,7 +297,7 @@ namespace boost { namespace fusion , fun); } - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Begin const& beg, End const& end, State const& state , Context const& context, Fun const& fun, mpl::false_) // break { @@ -325,7 +325,7 @@ namespace boost { namespace fusion typedef typename impl::type type; typedef typename impl::continue_type continue_type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Begin const& beg, End const& end, State const& state , Context const& context, Fun const& fun) { @@ -351,7 +351,7 @@ namespace boost { namespace fusion typedef typename impl::type type; typedef typename impl::continue_type continue_type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Begin const& beg, End const& end, State const& state , Context const& context, Fun const& fun) { @@ -365,7 +365,7 @@ namespace boost { namespace fusion typedef State type; typedef mpl::true_ continue_type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Begin const&, End const&, State const& state , Context const&, Fun const&) { @@ -389,7 +389,7 @@ namespace boost { namespace fusion typedef typename impl::type type; typedef typename impl::continue_type continue_type; - BOOST_FUSION_GPU_ENABLED + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(Segments& segs, State const& state, Context const& context, Fun const& fun) { return impl::call(fusion::begin(segs), fusion::end(segs), state, context, fun); |