15#ifndef IRQUS_TYPESTRING_HH_
16#define IRQUS_TYPESTRING_HH_
34 static constexpr char const vals[
sizeof...(C)+1] = {
C...,
'\0' };
35 static constexpr unsigned int sval =
sizeof...(C);
38 static constexpr char const *
data() noexcept
41 static constexpr unsigned int size() noexcept
44 static constexpr char const *
cbegin() noexcept
47 static constexpr char const *
cend() noexcept
48 {
return &vals[sval]; }
52constexpr char const typestring<
C...>::vals[
sizeof...(C)+1];
89constexpr char tygrab(
char const(&c)[M])
noexcept
90{
return c[N < M ? N : M-1]; }
101template<
char... X,
char... Y>
105template<
char A,
char... X,
char... Y>
113template<
char...
A,
char...
B,
typename... X>
128template<
typename... T>
130 =
decltype(
tycat_(T()...));
153#define TYPESTRING1(n,x) irqus::tygrab<0x##n##0>(x)
156#define TYPESTRING2(n,x) irqus::tygrab<0x##n##0>(x), irqus::tygrab<0x##n##1>(x)
159#define TYPESTRING4(n,x) \
160 irqus::tygrab<0x##n##0>(x), irqus::tygrab<0x##n##1>(x) \
161 , irqus::tygrab<0x##n##2>(x), irqus::tygrab<0x##n##3>(x)
164#define TYPESTRING8(n,x) \
165 irqus::tygrab<0x##n##0>(x), irqus::tygrab<0x##n##1>(x) \
166 , irqus::tygrab<0x##n##2>(x), irqus::tygrab<0x##n##3>(x) \
167 , irqus::tygrab<0x##n##4>(x), irqus::tygrab<0x##n##5>(x) \
168 , irqus::tygrab<0x##n##6>(x), irqus::tygrab<0x##n##7>(x)
171#define TYPESTRING16(n,x) \
172 irqus::tygrab<0x##n##0>(x), irqus::tygrab<0x##n##1>(x) \
173 , irqus::tygrab<0x##n##2>(x), irqus::tygrab<0x##n##3>(x) \
174 , irqus::tygrab<0x##n##4>(x), irqus::tygrab<0x##n##5>(x) \
175 , irqus::tygrab<0x##n##6>(x), irqus::tygrab<0x##n##7>(x) \
176 , irqus::tygrab<0x##n##8>(x), irqus::tygrab<0x##n##9>(x) \
177 , irqus::tygrab<0x##n##A>(x), irqus::tygrab<0x##n##B>(x) \
178 , irqus::tygrab<0x##n##C>(x), irqus::tygrab<0x##n##D>(x) \
179 , irqus::tygrab<0x##n##E>(x), irqus::tygrab<0x##n##F>(x)
182#define TYPESTRING32(n,x) \
183 TYPESTRING16(n##0,x),TYPESTRING16(n##1,x)
186#define TYPESTRING64(n,x) \
187 TYPESTRING16(n##0,x), TYPESTRING16(n##1,x), TYPESTRING16(n##2,x) \
188 , TYPESTRING16(n##3,x)
191#define TYPESTRING128(n,x) \
192 TYPESTRING16(n##0,x), TYPESTRING16(n##1,x), TYPESTRING16(n##2,x) \
193 , TYPESTRING16(n##3,x), TYPESTRING16(n##4,x), TYPESTRING16(n##5,x) \
194 , TYPESTRING16(n##6,x), TYPESTRING16(n##7,x)
197#define TYPESTRING256(n,x) \
198 TYPESTRING16(n##0,x), TYPESTRING16(n##1,x), TYPESTRING16(n##2,x) \
199 , TYPESTRING16(n##3,x), TYPESTRING16(n##4,x), TYPESTRING16(n##5,x) \
200 , TYPESTRING16(n##6,x), TYPESTRING16(n##7,x), TYPESTRING16(n##8,x) \
201 , TYPESTRING16(n##9,x), TYPESTRING16(n##A,x), TYPESTRING16(n##B,x) \
202 , TYPESTRING16(n##C,x), TYPESTRING16(n##D,x), TYPESTRING16(n##E,x) \
203 , TYPESTRING16(n##F,x)
206#define TYPESTRING512(n,x) \
207 TYPESTRING256(n##0,x), TYPESTRING256(n##1,x)
210#define TYPESTRING1024(n,x) \
211 TYPESTRING256(n##0,x), TYPESTRING256(n##1,x), TYPESTRING256(n##2,x) \
212 , TYPESTRING128(n##3,x), TYPESTRING16(n##38,x), TYPESTRING16(n##39,x) \
213 , TYPESTRING16(n##3A,x), TYPESTRING16(n##3B,x), TYPESTRING16(n##3C,x) \
214 , TYPESTRING16(n##3D,x), TYPESTRING16(n##3E,x), TYPESTRING16(n##3F,x)
219#if USE_TYPESTRING == 0
220#define typestring_is(x) \
221 decltype(irqus::typeek(irqus::typestring<TYPESTRING1(,x)>()))
222#elif USE_TYPESTRING == 1
223#define typestring_is(x) \
224 decltype(irqus::typeek(irqus::typestring<TYPESTRING2(,x)>()))
225#elif USE_TYPESTRING == 2
226#define typestring_is(x) \
227 decltype(irqus::typeek(irqus::typestring<TYPESTRING4(,x)>()))
228#elif USE_TYPESTRING == 3
229#define typestring_is(x) \
230 decltype(irqus::typeek(irqus::typestring<TYPESTRING8(,x)>()))
231#elif USE_TYPESTRING == 4
232#define typestring_is(x) \
233 decltype(irqus::typeek(irqus::typestring<TYPESTRING16(,x)>()))
234#elif USE_TYPESTRING == 5
235#define typestring_is(x) \
236 decltype(irqus::typeek(irqus::typestring<TYPESTRING32(,x)>()))
237#elif USE_TYPESTRING == 6
238#define typestring_is(x) \
239 decltype(irqus::typeek(irqus::typestring<TYPESTRING64(,x)>()))
240#elif USE_TYPESTRING == 7
241#define typestring_is(x) \
242 decltype(irqus::typeek(irqus::typestring<TYPESTRING128(,x)>()))
243#elif USE_TYPESTRING == 8
244#define typestring_is(x) \
245 decltype(irqus::typeek(irqus::typestring<TYPESTRING256(,x)>()))
246#elif USE_TYPESTRING == 9
247#define typestring_is(x) \
248 decltype(irqus::typeek(irqus::typestring<TYPESTRING512(,x)>()))
249#elif USE_TYPESTRING == 10
250#define typestring_is(x) \
251 decltype(irqus::typeek(irqus::typestring<TYPESTRING1024(,x)>()))
252#elif USE_TYPESTRING > 10
254#warning !!!: custom typestring length exceeded allowed (1024) !!!
255#warning !!!: all typestrings to default maximum typestring length of 64 !!!
256#warning !!!: you can use -DUSE_TYPESTRING=<power of two> to set length !!!
258#define typestring_is(x) \
259 decltype(irqus::typeek(irqus::typestring<TYPESTRING64(,x)>()))
261#elif USE_TYPESTRING < 0
263#warning !!!: You used USE_TYPESTRING with a negative size specified !!!
264#warning !!!: all typestrings to default maximum typestring length of 64 !!!
265#warning !!!: you can use -DUSE_TYPESTRING=<power of two> to set length !!!
267#define typestring_is(x) \
268 decltype(irqus::typeek(irqus::typestring<TYPESTRING64(,x)>()))
272#define typestring_is(x) \
273 decltype(irqus::typeek(irqus::typestring<TYPESTRING64(,x)>()))
Definition typestring.hh:18
auto tycat_(typestring< A... >, typestring< B... >, X... x) -> decltype(tycat_(typestring< A..., B... >(), x...))
decltype(tycat_(T()...)) tycat
Definition typestring.hh:130
auto typeek(typestring< C... >) -> decltype(typoke(typestring< C >()...))
auto typoke(typestring< X... >) -> typestring< X... >
constexpr char tygrab(char const(&c)[M]) noexcept
Definition typestring.hh:89
Definition typestring.hh:32
static constexpr unsigned int size() noexcept
Definition typestring.hh:41
static constexpr char const * cbegin() noexcept
Definition typestring.hh:44
static constexpr char const * data() noexcept
Definition typestring.hh:38
static constexpr char const * cend() noexcept
Definition typestring.hh:47