1 #ifndef __TAN_COMMON_COMPILER_ACTION_H__
2 #define __TAN_COMMON_COMPILER_ACTION_H__
4 #include "common/ast_visitor.h"
8 template <
class T,
class U>
9 concept SameHelper = std::is_same_v<T, U>;
14 template <
class T,
class U>
15 concept same_as = SameHelper<T, U> && SameHelper<U, T>;
17 template <
typename C,
typename Input,
typename Output>
18 concept HasImpl = requires(C c, Input input) {
19 { c.run_impl(input) } -> same_as<Output>;
28 Output run(Input input) {
29 static_assert(HasImpl<Derived, Input, Output>);
32 return ((Derived *)
this)->run_impl(input);
36 virtual void init(Input){};