Files
chaos/Chaos/Hash/Hash.hpp
hashlag b5d1f9a6fc
All checks were successful
Chaos Ci / test-and-benchmark (push) Successful in 1m39s
Make CRTP base classes ctors protected
This forbids to create base class instances which direct usage could lead to UB.
2026-01-30 00:44:24 +03:00

41 lines
568 B
C++

#ifndef CHAOS_HASH_HASH_HPP
#define CHAOS_HASH_HASH_HPP
#include <string>
namespace Chaos::Hash
{
template<typename T>
class Hash
{
public:
auto GetRawDigest() const
{
return Impl().GetRawDigest();
}
std::string ToHexString() const
{
return Impl().ToHexString();
}
protected:
Hash() = default;
private:
const T & Impl() const
{
return static_cast<const T &>(*this);
}
T & Impl()
{
return static_cast<T &>(*this);
}
};
} // namespace Chaos::Hash
#endif // CHAOS_HASH_HASH_HPP