helper.hpp
Go to the documentation of this file.
1
2#pragma once
3
4// helpers:
5#define BY_VOID()
6#define BY_SPACE BY_VOID() BY_VOID()
7#define BY_CONSUME_ARGS(...)
8#define BY_UNWRAP(...) __VA_ARGS__
9
10#define BY_UNCONST_0() BY_UNCONST_1(unconst)
11#define BY_UNCONST_1(value) BY_UNCONST_2(me, value)
12#define BY_UNCONST_2(type, value) BY_UNWRAP(type)& value = *(const_cast<BY_UNWRAP(type)*>(this));
13#define BY_UNCONST(...) BY_OVERLOAD(BY_UNCONST, __VA_ARGS__)
14
15#define BY_DELAY(x) x BY_VOID()
16
17#define _STR(x) #x
18#define BY_STR(x) _STR(x)
19
20#define _CONCAT(x, y) x##y
21#define BY_CONCAT(x, y) _CONCAT(x, y)
22
23// why delaying comma expression?:
24// it can causes delimiter issue on expanding macros for template parameters.
25#define _COMMA() ,
26#define BY_COMMA() BY_DELAY(_COMMA)()
27#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)