-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.hpp
43 lines (34 loc) · 1020 Bytes
/
util.hpp
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef UTIL_HPP
#define UTIL_HPP
#include <type_traits>
#include "type_list.hpp"
namespace turing_machine::util
{
namespace tl = type_list;
inline namespace tape
{
template <char c>
struct CharLetter {
static constexpr auto value = c;
};
} // namespace tape
inline namespace state
{
template <char c>
struct CharState {
static constexpr auto letter = c;
};
template<auto t = []{}>
struct UniqueState {
};
} // namespace state
template <class Container, class... Args>
void unpurify(Container &c, tl::List<Args...>)
{
static_assert((std::is_constructible_v<typename Container::value_type,
decltype(Args::position),
decltype(Args::letter::value)> && ...));
(c.push_back({Args::position, Args::letter::value}), ...);
};
} // namespace turing_machine::util
#endif