Midge  v3.9.2
Data Processing Framework
typechain.hh
Go to the documentation of this file.
1 #ifndef _midge_typechain_hh_
2 #define _midge_typechain_hh_
3 
4 #include "typeint.hh"
5 #include "typereplace.hh"
6 
7 namespace midge
8 {
35  class _type
37  {};
38 
40  class _index
41  {};
42 
44  template< class x_prototype, int x_index, class... x_types >
45  class type_chain;
46 
47  // Alias to start a chain
48  template< class x_prototype, class... x_types >
49  using type_start_chain = type_chain< x_prototype, 0, x_types... >;
50 
52  template< class x_prototype, int x_index, class x_head, class... x_tail >
53  class type_chain< x_prototype, x_index, x_head, x_tail... > :
54  public type_replace< type_replace< x_prototype, _type, x_head >, _index, type_int< x_index > >,
55  public type_chain< x_prototype, x_index + 1, x_tail... >
56  {
57  private:
59  using next_type = type_chain< x_prototype, x_index + 1, x_tail... >;
60 
61  public:
62  template< class... x_args >
63  type_chain( x_args... args ) :
64  this_type( args... ),
65  next_type( args... )
66  {
67  }
68 
69  virtual ~type_chain()
70  {
71  }
72  };
73 
75  template< class x_prototype, int x_index >
76  class type_chain< x_prototype, x_index >
77  {
78  public:
79  template< class... x_args >
80  type_chain( x_args... )
81  {
82  }
83 
84  virtual ~type_chain()
85  {
86  }
87  };
88 
89 }
90 
91 #endif
Definition: _buffer.hh:11
typename type_replace_imp< x_list, x_find, x_replace >::type type_replace
Definition: typereplace.hh:32
Template prototype.
Definition: typechain.hh:45
std::integral_constant< int, x_value > type_int
Wraps integral constant x_value in a type; value is available as type_int::value. ...
Definition: typeint.hh:9
The prototype class that gets replaced by a type index (or rather the struct that wraps a type&#39;s inde...
Definition: typechain.hh:40
type_replace< type_replace< x_prototype, _type, x_head >, _index, type_int< x_index > > this_type
Definition: typechain.hh:58