feat: added new() and new_as() macros

main
Sara 2024-09-10 09:47:14 +02:00
parent ff87fa96e1
commit 85dd8e5fec
1 changed files with 3 additions and 0 deletions

View File

@ -7,4 +7,7 @@ __Return (*const __Name##_)(__VA_ARGS__) = __Name; (void)__Name##_
#define decl_typeclass_impl(__Typeclass, __Type)\ #define decl_typeclass_impl(__Typeclass, __Type)\
extern __Typeclass __Type##_as_##__Typeclass(__Type*); extern __Typeclass __Type##_as_##__Typeclass(__Type*);
#define new(T) malloc(sizeof(T))
#define new_as(T, TC) T##_as_##TC(new(T))
#endif // !CUTES_TYPECLASS_HELPERS_H #endif // !CUTES_TYPECLASS_HELPERS_H