Empirical
struct.h
Go to the documentation of this file.
1 #ifndef EMP_STRUCT_H
2 #define EMP_STRUCT_H
3 
5 //
6 // A re-engineering of tuple_struct.h, intended to be usable throughout Empirical.
7 //
8 // The EMP_STRUCT macro builds an inexpensive struct that
9 // * Can fully reflect on its contents. (todo)
10 // * Is easily serializable (todo)
11 // * Can be effortlessly moved between C++ and Javascript (todo)
12 //
13 // EMP_STRUCT( NAME,
14 // TYPE1, ID1, DEFAULT1,
15 // TYPE2, ID2, DEFAULT2,
16 // etc... )
17 //
18 
19 #define EMP_STRUCT( NAME, ...) \
20  struct NAME { \
21  EMP_ASSEMBLE_MACRO(EMP_STRUCT_MEM_, __VA_ARGS__) \
22  };
23 
24 EMP_STRUCT_MEM_3(TYPE, ID, DEFAULT, ...) TYPE ID;
25 EMP_STRUCT_MEM_6(TYPE, ID, DEFAULT, ...) TYPE ID; EMP_STRUCT_MEM_3(__VA_ARGS__)
26 EMP_STRUCT_MEM_30(TYPE, ID, DEFAULT, ...) TYPE ID; EMP_STRUCT_MEM_27(__VA_ARGS__)
27 
28 #endif
DEFAULT
Definition: struct.h:26
ID
Definition: struct.h:26