40 template<
typename T,
class T
int,
bool thread_safe = true>
52 static constexpr Tint
invalid_uuid = std::numeric_limits<Tint>::max();
73 if constexpr (thread_safe) {
75 static std::atomic<Tint> _uuid = 0;
77 uuid = _uuid.fetch_add(1, std::memory_order_relaxed);
81 static Tint _uuid = 0;
WithUUID & operator=(const WithUUID &)=delete
would duplicate the uuid
WithUUID()
Constructor of the class.
void invalidate()
Marks this instance's uuid as invalid, e.g. to give up identity outside of a move.
WithUUID(WithUUID &&other) noexcept
Move constructor: transfers the uuid to this and invalidates other.
static constexpr Tint invalid_uuid
WithUUID & operator=(WithUUID &&other) noexcept
Move assignment: transfers the uuid to this and invalidates other.
bool is_alive() const
Whether this instance still holds a valid uuid (false once moved from).
WithUUID(const WithUUID &)=delete
would duplicate the uuid
Tint get_uuid() const
Get the uuid of the class.
Tint uuid
The unique identifier of the class.
namespace for basic c++ utilities