36 template<
typename Tag, std::
integral InternalType = u
int32_t,
bool Atomic = false>
40 using CounterType = std::conditional_t<Atomic, std::atomic<InternalType>, InternalType>;
44 [[nodiscard]]
static constexpr IDType New() noexcept {
return IDType(++sLastValue); }
46 [[nodiscard]]
constexpr bool IsValid() const noexcept {
return mValue != std::numeric_limits<InternalType>::max(); }
47 [[nodiscard]]
constexpr operator bool() const noexcept {
return IsValid(); }
49 [[nodiscard]]
constexpr bool operator==(
const IDType other)
const noexcept {
return mValue == other.mValue; }
50 [[nodiscard]]
constexpr bool operator!=(
const IDType other)
const noexcept {
return mValue != other.mValue; }
53 constexpr explicit IDType(InternalType value) : mValue(value) {}
55 friend struct std::hash<
JPL::
IDType<Tag, InternalType>>;
57 InternalType mValue = std::numeric_limits<InternalType>::max();
58 inline static CounterType sLastValue{ InternalType(0) };
66 template<
typename Tag, std::
integral InternalType>
67 struct [[nodiscard]] hash<
JPL::IDType<Tag, InternalType>>
Definition AcousticMaterial.h:36
Definition ChannelMap.h:272
constexpr bool operator!=(const IDType other) const noexcept
Definition IDType.h:50
constexpr bool operator==(const IDType other) const noexcept
Definition IDType.h:49
Tag TagType
Definition IDType.h:39
static constexpr IDType New() noexcept
Definition IDType.h:44
constexpr bool IsValid() const noexcept
Definition IDType.h:46
std::conditional_t< Atomic, std::atomic< InternalType >, InternalType > CounterType
Definition IDType.h:40
constexpr IDType()=default
constexpr std::size_t operator()(const JPL::IDType< Tag, InternalType > &id) const
Definition IDType.h:69