Lodestar
An integrated real-time control package in C++
Repeat.hpp
1 //
2 // Created by Hamza El-Kebir on 6/10/21.
3 //
4 
5 #ifndef LODESTAR_REPEAT_HPP
6 #define LODESTAR_REPEAT_HPP
7 
8 #include <tuple>
9 #include "Indices.hpp"
10 
11 // Structs that serve to construct a template pack with repeated types.
12 // See https://stackoverflow.com/a/16853853
13 template<typename TDependent, int TIndex>
14 using DependOn = TDependent;
15 
16 template<typename TType, int TTimes, typename TIndices = typename Indices<TTimes>::type>
17 struct Repeat;
18 
19 template<typename TType, int TTimes, int... TIndices>
20 struct Repeat<TType, TTimes, IndexSequence<TIndices...>> {
21  using type = std::tuple<DependOn<TType, TIndices>...>;
22 };
23 
24 #endif //LODESTAR_REPEAT_HPP
Repeat
Definition: Repeat.hpp:17
IndexSequence
Definition: Indices.hpp:11