cutes/typeclass_helpers.h

14 lines
404 B
C
Raw Normal View History

#ifndef CUTES_TYPECLASS_HELPERS_H
#define CUTES_TYPECLASS_HELPERS_H
2024-01-25 13:08:23 +00:00
#define TC_FN_TYPECHECK(__Return, __Name, ...)\
__Return (*const __Name##_)(__VA_ARGS__) = __Name; (void)__Name##_
#define decl_typeclass_impl(__Typeclass, __Type)\
extern __Typeclass __Type##_as_##__Typeclass(__Type*);
2024-09-10 07:47:14 +00:00
#define new(T) malloc(sizeof(T))
#define new_as(T, TC) T##_as_##TC(new(T))
#endif // !CUTES_TYPECLASS_HELPERS_H