-
Notifications
You must be signed in to change notification settings - Fork 0
/
racket.h
29 lines (23 loc) · 698 Bytes
/
racket.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include <cstdint>
#include "int.h"
template<template <class> class F, class TList>
struct static_map;
template<template <class> class F, class... T>
struct static_map<F, type_list<T...>> {
using type = type_list<typename F<T>::type...>;
};
template<class Car, class Cdr>
struct cons;
template<class Car, class... Cdr>
struct cons<Car, type_list<Cdr...>> {
using type = type_list<Car, Cdr...>;
};
template<template<int_t> class T, int_t Begin, int_t End>
struct static_range {
using type = typename cons<T<Begin>, typename static_range<T, Begin + 1, End>::type>::type;
};
template<template<int_t> class T, int_t N>
struct static_range<T, N, N> {
using type = type_list<>;
};