/
BirdLeon
/
ROBLOX2016
Обзор
Документация
Войти
/
BirdLeon
/
ROBLOX2016
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
App/include/util/ProtectedGeneric.h
43 строки
691 B
PatoFlamejanteTV
full source code
19 дек 2024, 19:11
19 дек 2024, 19:11
05db15d
Код
Авторство
О чём код?
#pragma once #include <memory> #include <string> #include <boost/functional/hash/hash.hpp> namespace RBX { template<class Type> class ProtectedGeneric { private: Type value; std::size_t hash; public: const Type& peekValue() const { return value; } bool getValue(Type& _value) const { _value = this->value; boost::hash<Type> hasher; std::size_t newHash = hasher(_value); return (hash == newHash); } void setValue(Type _value) { this->value = _value; boost::hash<Type> hasher; hash = hasher(_value); } ProtectedGeneric(Type _value) { setValue(_value); } private: ProtectedGeneric(const ProtectedGeneric& other) {} }; }