/
redgpu
/
tech5
Обзор
Документация
Войти
/
redgpu
/
tech5
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
source/shared/idlib/index.h
42 строки
989 B
Justin Marshall
First pass idLib conversion from hex rays4.
08 авг 2026, 23:54
08 авг 2026, 23:54
09a4cb9
Код
Авторство
О чём код?
#pragma once #include <type_traits> template<typename valueType, typename invalidType> class idIndex { public: idIndex() : value(static_cast<valueType>(-1)) { } explicit idIndex(const valueType index) : value(index) { } bool IsValid() const { return value != static_cast<valueType>(-1); } void Invalidate() { value = static_cast<valueType>(-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<short, idRecoveredInvalidIndex>) == sizeof(short), "Recovered idIndex ABI changed");