SUNphi  1.0
IntSeqSplit.hpp
Go to the documentation of this file.
1 #ifndef _INTSEQSPLIT_HPP
2 #define _INTSEQSPLIT_HPP
3 
4 /// \file IntSeqSplit.hpp
5 ///
6 /// \brief Take portions of integer sequences
7 
8 #include <ints/IntSeq.hpp>
9 
10 namespace SUNphi
11 {
12  /// Returns the first N components of an IntSeq
13  ///
14  /// Internal implementation
15  template <int N, // Number of id to take
16  typename ISeq, // IntSeq to operate upon
17  typename=ConstrainIsIntSeq<ISeq>>
18  struct _IntSeqFirstN
19  {
20  /// Internal type
21  using type=typename IntSeq<>::AppendFirstN<N,ISeq>;
22  };
23 
24  /// Returns the first N components of an IntSeq
25  ///
26  /// Gives visibility to internal implementation
27  template <int N,
28  typename ISeq,
29  typename=EnableIf<isIntSeq<ISeq>>>
30  using IntSeqFirstN=typename _IntSeqFirstN<N,ISeq>::type;
31 
32  /////////////////////////////////////////////////////////////////
33 
34  /// Filter an IntSeq according to another one
35  ///
36  /// Internal implementation, forward declaration
37  template <typename Is,
38  typename Fi>
39  struct _IntSeqFilter;
40 
41  /// Filter an IntSeq according to another one
42  ///
43  /// Internal implementation
44  template <int...Ints,
45  int...Ids>
46  struct _IntSeqFilter<IntSeq<Ints...>,IntSeq<Ids...>>
47  {
48  /// Internal type
49  using type=IntSeq<getIntOfList<Ids,Ints...>...>;
50  };
51 
52  /// Filter an IntSeq according to another one
53  template <typename Is,
54  typename Fi>
55  using IntSeqFilter=typename _IntSeqFilter<Is,Fi>::type;
56 }
57 
58 #endif
static constexpr int element()
Get the I element of the sequence.
Definition: IntSeq.hpp:95