#pragma once #include template class idIndex { public: idIndex() : value(static_cast(-1)) { } explicit idIndex(const valueType index) : value(index) { } bool IsValid() const { return value != static_cast(-1); } void Invalidate() { value = static_cast(-1); } valueType Get() const { return value; } operator valueType() const { return value; } bool operator==(const idIndex& other) const { return value == other.value; } bool operator!=(const idIndex& other) const { return value != other.value; } bool operator<(const idIndex& other) const { return value < other.value; } private: valueType value; }; enum class idRecoveredInvalidIndex : int { invalid = -1 }; static_assert(sizeof(idIndex) == sizeof(short), "Recovered idIndex ABI changed");