Derive-C
Loading...
Searching...
No Matches
struct.h
Go to the documentation of this file.
1#include <derive-c/core.h>
2
3#define DERIVE_STRUCT_MEMBER(t, n) t n;
4
5// Given you have define a reflect for an ID, the struct can be defined.
6// ```c
7// #define Foo_REFLECT(F) \
8// F(int, x) \
9// F(int, y)
10//
11// DERIVE_STRUCT(Foo)
12// ```
13#define DERIVE_STRUCT(ID) \
14 typedef struct { \
15 NAME(ID, REFLECT)(DERIVE_STRUCT_MEMBER) \
16 } ID;