1 // The Art of C++ / Sequences
2 // Copyright (c) 2015 Daniel Frey
3 
4 #ifndef TAOCPP_SEQUENCES_INCLUDE_INTEGER_SEQUENCE_HPP
5 #define TAOCPP_SEQUENCES_INCLUDE_INTEGER_SEQUENCE_HPP
6 
7 #include <cstddef>
8 #include <utility>
9 
10 #include "config.hpp"
11 
12 namespace tao
13 {
14   namespace seq
15   {
16 
17 #ifdef TAOCPP_USE_STD_INTEGER_SEQUENCE
18 
19     using std::integer_sequence;
20     using std::index_sequence;
21 
22 #else
23 
24     template< typename T, T... Ns >
25     struct integer_sequence
26     {
27       using value_type = T;
28 
29       static constexpr std::size_t size() noexcept
30       {
31         return sizeof...( Ns );
32       }
33     };
34 
35     template< std::size_t... Ns >
36     using index_sequence = integer_sequence< std::size_t, Ns... >;
37 
38 #endif
39 
40   }
41 }
42 
43 #endif // TAOCPP_SEQUENCES_INCLUDE_INTEGER_SEQUENCE_HPP
44