Loading...
Searching...
No Matches
Go to the documentation of this file.
13#define DC_TRAIT_REFERENCABLE(SELF) \
14 DC_REQUIRE_TYPE(SELF, ref); \
15 DC_STATIC_ASSERT(sizeof(NS(SELF, ref)) <= sizeof(SELF*), \
16 "Reference type must be at most pointer sized"); \
17 DC_REQUIRE_METHOD(SELF*, NS(SELF, ref), deref, (NS(SELF, ref)))
19#define DC_TRAIT_REFERENCABLE_BY_PTR(SELF) \
20 typedef SELF* NS(SELF, ref); \
21 DC_PUBLIC static SELF* NS(NS(SELF, ref), deref)(NS(SELF, ref) ref) { return ref; } \
22 DC_TRAIT_REFERENCABLE(SELF)
24#define DC_TRAIT_REFERENCABLE_SINGLETON(SELF, INSTANCE) \
25 DC_ZERO_SIZED(NS(SELF, ref)); \
26 DC_PUBLIC static NS(SELF, ref) NS(SELF, get_ref)() { return (NS(SELF, ref)){}; } \
27 DC_PUBLIC static SELF* NS(NS(SELF, ref), deref)(NS(SELF, ref) ) { return &INSTANCE; } \
28 DC_TRAIT_REFERENCABLE(SELF)