This template simplifies generation of simple classes that wrap an id in a typesafe way. More...
#include <IdWrapper.h>
Public Types | |
using | underlying_type = UnderlyingType |
using | concrete_type = ConcreteType |
This template simplifies generation of simple classes that wrap an id in a typesafe way.
Namely, you can use it to create a very lightweight type that only offers equality comparators and hashing. Example:
struct MyIdType final : IdWrapper<MyIdType, uint32_t> { constexpr explicit MyIdType(uint32_t id): IdWrapper(id) {} };
Then in the global top level namespace:
C10_DEFINE_HASH_FOR_IDWRAPPER(MyIdType);
That's it - equality operators and hash functions are automatically defined for you, given the underlying type supports it.
Definition at line 26 of file IdWrapper.h.