Derive-C
Loading...
Searching...
No Matches
clone.h
Go to the documentation of this file.
1#include <derive-c/core.h>
2
3#define DERIVE_CLONE_MEMBER(t, n) .n = NAME(t, clone)(&self->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_CLONE(ID) \
14 ID NAME(ID, clone)(ID const* self) { return (ID){NAME(ID, REFLECT)(DERIVE_CLONE_MEMBER)}; }