1 // (C) Copyright Gennadiy Rozental 2001.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/test for the library home page.
9 /// Defines c++14 index_sequence implementation
10 // ***************************************************************************
12 #ifndef BOOST_TEST_DATA_INDEX_SEQUENCE_HPP
13 #define BOOST_TEST_DATA_INDEX_SEQUENCE_HPP
16 #include <boost/test/data/config.hpp>
18 #include <boost/test/detail/suppress_warnings.hpp>
20 //____________________________________________________________________________//
26 // ************************************************************************** //
27 // ************** data::index_sequence ************** //
28 // ************************************************************************** //
30 template <std::size_t... Ns>
31 struct index_sequence {};
33 template<typename IS1, typename IS2>
34 struct merge_index_sequence;
36 template <std::size_t... Ns1, std::size_t... Ns2>
37 struct merge_index_sequence<index_sequence<Ns1...>, index_sequence<Ns2...>> {
38 typedef index_sequence<Ns1..., Ns2...> type;
41 template <std::size_t B, std::size_t E, typename Enabler = void>
42 struct make_index_sequence {
43 typedef typename merge_index_sequence<typename make_index_sequence<B,(B+E)/2>::type,
44 typename make_index_sequence<(B+E)/2,E>::type>::type type;
47 template <std::size_t B, std::size_t E>
48 struct make_index_sequence<B,E,typename std::enable_if<E==B+1,void>::type> {
49 typedef index_sequence<B> type;
52 template <typename... T>
53 using index_sequence_for = typename make_index_sequence<0, sizeof...(T)>::type;
56 } // namespace unit_test
59 #include <boost/test/detail/enable_warnings.hpp>
61 #endif // BOOST_TEST_DATA_INDEX_SEQUENCE_HPP