1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/* Copyright 2016 Joaquin M Lopez Munoz.
* 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)
*
* See http://www.boost.org/libs/poly_collection for library home page.
*/
#ifndef BOOST_POLY_COLLECTION_DETAIL_INTEGER_SEQUENCE_HPP
#define BOOST_POLY_COLLECTION_DETAIL_INTEGER_SEQUENCE_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <cstddef>
namespace boost{
namespace poly_collection{
namespace detail{
/* ripped from http://pdimov.com/cpp2/simple_cxx11_metaprogramming.html */
template<typename T,T... Ints> struct integer_sequence{};
template<typename S> struct next_integer_sequence;
template<typename T,T... Ints>
struct next_integer_sequence<integer_sequence<T,Ints...>>
{
using type=integer_sequence<T,Ints...,sizeof...(Ints)>;
};
template<typename T,T I,T N> struct make_int_seq_impl;
template<typename T,T N>
using make_integer_sequence=typename make_int_seq_impl<T,0,N>::type;
template<typename T,T I,T N> struct make_int_seq_impl
{
using type=typename next_integer_sequence<
typename make_int_seq_impl<T,I+1,N>::type>::type;
};
template<typename T,T N> struct make_int_seq_impl<T,N,N>
{
using type=integer_sequence<T>;
};
template<std::size_t... Ints>
using index_sequence=integer_sequence<std::size_t,Ints...>;
template<std::size_t N>
using make_index_sequence=make_integer_sequence<std::size_t,N>;
} /* namespace poly_collection::detail */
} /* namespace poly_collection */
} /* namespace boost */
#endif
|