From b5d1f9a6fc25f9090ca16680bf2846ecefb5b844 Mon Sep 17 00:00:00 2001 From: hashlag Date: Fri, 30 Jan 2026 00:44:24 +0300 Subject: [PATCH] Make CRTP base classes ctors protected This forbids to create base class instances which direct usage could lead to UB. --- Chaos/Hash/Hash.hpp | 3 +++ Chaos/Hash/Hasher.hpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Chaos/Hash/Hash.hpp b/Chaos/Hash/Hash.hpp index 402e572..fe252e1 100644 --- a/Chaos/Hash/Hash.hpp +++ b/Chaos/Hash/Hash.hpp @@ -20,6 +20,9 @@ public: return Impl().ToHexString(); } +protected: + Hash() = default; + private: const T & Impl() const { diff --git a/Chaos/Hash/Hasher.hpp b/Chaos/Hash/Hasher.hpp index 02e97ac..796c02f 100644 --- a/Chaos/Hash/Hasher.hpp +++ b/Chaos/Hash/Hasher.hpp @@ -24,6 +24,9 @@ public: return Impl().Finish(); } +protected: + Hasher() = default; + private: const T & Impl() const {