diff options
Diffstat (limited to 'boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp')
-rw-r--r-- | boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp b/boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp index 41e0d434e8..b60dc76fcc 100644 --- a/boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp +++ b/boost/fusion/adapted/std_tuple/detail/build_std_tuple.hpp @@ -7,26 +7,26 @@ #if !defined(BOOST_FUSION_BUILD_STD_TUPLE_05292014_0100) #define BOOST_FUSION_BUILD_STD_TUPLE_05292014_0100 -#include <boost/mpl/eval_if.hpp> -#include <boost/mpl/identity.hpp> #include <boost/fusion/support/config.hpp> +#include <boost/fusion/support/detail/index_sequence.hpp> #include <boost/fusion/iterator/equal_to.hpp> #include <boost/fusion/iterator/next.hpp> #include <boost/fusion/iterator/value_of.hpp> #include <boost/fusion/iterator/deref.hpp> #include <tuple> +#include <cstddef> namespace boost { namespace fusion { namespace detail { - template <typename First, typename Last - , bool is_empty = result_of::equal_to<First, Last>::value - > + template <typename First, typename Last, + bool is_empty = result_of::equal_to<First, Last>::value> struct build_std_tuple; template <typename First, typename Last> struct build_std_tuple<First, Last, true> { typedef std::tuple<> type; + BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type call(First const&, Last const&) @@ -35,35 +35,18 @@ namespace boost { namespace fusion { namespace detail } }; - template <int ...> struct indexed_tuple { }; - - template <int, typename = indexed_tuple<>> - struct make_indexed_tuple; - - template <int Head, int ...Tail> - struct make_indexed_tuple<Head, indexed_tuple<Tail...>> - { - typedef typename - boost::mpl::eval_if_c< - (Head == 0), - boost::mpl::identity<indexed_tuple<Tail...>>, - make_indexed_tuple<Head - 1, indexed_tuple<Head - 1, Tail...>> - >::type - type; - }; - template <typename T, typename Rest> struct push_front_std_tuple; template <typename T, typename ...Rest> - struct push_front_std_tuple<T, std::tuple<Rest...>> + struct push_front_std_tuple<T, std::tuple<Rest...> > { typedef std::tuple<T, Rest...> type; - template <int ...I> + template <std::size_t ...I> BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED static type - indexed_call(T const& first, std::tuple<Rest...> const& rest, indexed_tuple<I...>) + indexed_call(T const& first, std::tuple<Rest...> const& rest, index_sequence<I...>) { return type(first, std::get<I>(rest)...); } @@ -72,7 +55,7 @@ namespace boost { namespace fusion { namespace detail static type call(T const& first, std::tuple<Rest...> const& rest) { - typedef typename make_indexed_tuple<sizeof...(Rest)>::type gen; + typedef typename make_index_sequence<sizeof...(Rest)>::type gen; return indexed_call(first, rest, gen()); } }; |