Files
dynamic-array/type_info.h
2026-02-22 16:50:46 +03:00

23 lines
657 B
C

#ifndef TYPE_INFO_H
#define TYPE_INFO_H
#include <stdbool.h>
#include <stddef.h>
typedef struct TypeInfo {
size_t element_size;
void (*copy)(void *dest, const void *src);
void (*destroy)(void *elem);
int (*compare)(const void *a, const void *b); // <0, 0, >0
void (*print)(const void *elem);
bool (*parse)(void *dest, const char *str); // для ввода
const char *type_name;
} TypeInfo;
// static inline используется для создания копии функции в каждом файле
static inline bool types_equal(const TypeInfo *a, const TypeInfo *b) {
return a == b;
}
#endif // TYPE_INFO_H