Derive-C
Loading...
Searching...
No Matches
id.h File Reference

Go to the source code of this file.

Macros

#define ID(type, ...)

Macro Definition Documentation

◆ ID

#define ID ( type,
... )
Value:
DC_PUBLIC static size_t type##_hash_id(type const* key) { \
DC_STATIC_ASSERT(sizeof(type) <= sizeof(size_t), \
"ID hashing only supports up to size_t integers"); \
return (size_t)(*key); \
}
#define DC_PUBLIC
Definition namespace.h:25

No hashing, just returns the integer value. For most circumstances with a key as a single integer, this is a good option.

Definition at line 8 of file id.h.

8#define ID(type, ...) \
9 DC_PUBLIC static size_t type##_hash_id(type const* key) { \
10 DC_STATIC_ASSERT(sizeof(type) <= sizeof(size_t), \
11 "ID hashing only supports up to size_t integers"); \
12 return (size_t)(*key); \
13 }