uTL
micro Template library
integral.h
Go to the documentation of this file.
1 
20 #ifndef __utl_meta_integralconstant_h__
21 #define __utl_meta_integralconstant_h__
22 
23 #include <utl/core/impl.h>
24 #include <type_traits>
25 #include <utility>
26 
32 
34 namespace utl {
35 namespace meta {
36 
43  struct nil_ {
44  using type = nil_;
45  };
46 
48  template <typename Tp>
49  using eval = typename Tp::type;
50 
57  template <typename Tp, Tp v>
58  using integral_ = std::integral_constant<Tp, v>;
60 
63 
65  template<bool v>
67 
68  using true_ = bool_<true>;
69  using false_ = bool_<false>;
70 
72  template<int8_t v>
75  template<uint8_t v>
77 
79  template<int16_t v>
82  template<uint16_t v>
84 
86  template<int32_t v>
89  template<uint32_t v>
91 
93  template<char v>
95 
97  template<int v>
99 
101  template<long v>
103 
105  template<index_t v>
107 
109  template<size_t v>
111 
114  template <typename Tp>
116 
119  template <typename Tp>
122 
124  using Npos = size_<index_t(-1)>;
125 
128  template< class Tp, Tp... Ints >
130 
131  template<typename Tp, Tp Num>
132  using make_integer_sequence = std::make_integer_sequence<Tp, Num>;
133 
135  template<index_t... Idx>
137 
139  template<index_t Num>
141 
143  template<typename... Types>
144  using index_sequence_for = make_index_sequence<sizeof...(Types)>;
145 
147 }}
148 
150 
151 #endif /* __utl_meta_integralconstant_h__ */
make_integer_sequence< index_t, Num > make_index_sequence
Alias template make_index_sequence.
Definition: integral.h:140
integral_< uint8_t, v > uint8_
uint8_ type: integral constant wrapper for uint8_t
Definition: integral.h:76
integral_< int8_t, v > int8_
int8_ type: integral constant wrapper for int8_t
Definition: integral.h:73
bool_< true > true_
The type used as a compile-time boolean with true value.
Definition: integral.h:68
integral_< size_t, v > size_
size_ type: integral constant wrapper for size_t a.k.a std::size_t
Definition: integral.h:110
integral_< long, v > long_
long_ type: integral constant wrapper for long
Definition: integral.h:102
std::integral_constant< Tp, v > integral_
Definition: integral.h:58
size_< index_t(-1)> Npos
The last position we can express for indexing.
Definition: integral.h:124
std::make_integer_sequence< Tp, Num > make_integer_sequence
Definition: integral.h:132
integral_< int, v > int_
int_ type: integral constant wrapper for int
Definition: integral.h:98
make_index_sequence< sizeof...(Types)> index_sequence_for
Alias template index_sequence_for.
Definition: integral.h:144
bool_< false > false_
The type used as a compile-time boolean with false value.
Definition: integral.h:69
typename Tp::type eval
Type alias for Tp::type. Used to evaluate/extract return type of metafunctions.
Definition: integral.h:49
integral_< char, v > char_
char_ type: integral constant wrapper for char
Definition: integral.h:94
integral_< uint16_t, v > uint16_
uint16_ type: integral constant wrapper for uint16_t
Definition: integral.h:83
STL&#39;s core language concepts.
Definition: _1wire.h:30
integer_sequence< index_t, Idx... > index_sequence
Alias template index_sequence.
Definition: integral.h:136
integral_< index_t, v > index_
index_ type: integral constant wrapper for index_t a.k.a std::size_t
Definition: integral.h:106
size_< alignof(Tp)> alignof_
Definition: integral.h:120
integral_< bool, v > bool_
bool_ type: integral constant wrapper for bool
Definition: integral.h:66
size_t index_t
index_t and size_t mend to be interchangeable
Definition: types.h:38
integral_< int32_t, v > int32_
int32_ type: integral constant wrapper for int32_t
Definition: integral.h:87
size_< sizeof(Tp)> sizeof_
Definition: integral.h:115
std::integer_sequence< Tp, Ints... > integer_sequence
Definition: integral.h:129
integral_< uint32_t, v > uint32_
uint32_ type: integral constant wrapper for uint32_t
Definition: integral.h:90
integral_< int16_t, v > int16_
int16_ type: integral constant wrapper for int16_t
Definition: integral.h:80
Implementation detail main forward header.