]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/test/include/boost/test/data/index_sequence.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / test / include / boost / test / data / index_sequence.hpp
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)
5
6 // See http://www.boost.org/libs/test for the library home page.
7 //
8 /// @file
9 /// Defines c++14 index_sequence implementation
10 // ***************************************************************************
11
12 #ifndef BOOST_TEST_DATA_INDEX_SEQUENCE_HPP
13 #define BOOST_TEST_DATA_INDEX_SEQUENCE_HPP
14
15 // Boost.Test
16 #include <boost/test/data/config.hpp>
17
18 #include <boost/test/detail/suppress_warnings.hpp>
19
20 //____________________________________________________________________________//
21
22 namespace boost {
23 namespace unit_test {
24 namespace data {
25
26 // ************************************************************************** //
27 // ************** data::index_sequence ************** //
28 // ************************************************************************** //
29
30 template <std::size_t... Ns>
31 struct index_sequence {};
32
33 template<typename IS1, typename IS2>
34 struct merge_index_sequence;
35
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;
39 };
40
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;
45 };
46
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;
50 };
51
52 template <typename... T>
53 using index_sequence_for = typename make_index_sequence<0, sizeof...(T)>::type;
54
55 } // namespace data
56 } // namespace unit_test
57 } // namespace boost
58
59 #include <boost/test/detail/enable_warnings.hpp>
60
61 #endif // BOOST_TEST_DATA_INDEX_SEQUENCE_HPP
62