From 00065930877126c4cc8e2c902a4e206d02843b5f Mon Sep 17 00:00:00 2001 From: hashlag <90853356+hashlag@users.noreply.github.com> Date: Sun, 10 Aug 2025 22:45:03 +0300 Subject: [PATCH] Add a helper Impl() function for CRTP base 'Hasher' --- Chaos/Hashing/Hasher.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Chaos/Hashing/Hasher.hpp b/Chaos/Hashing/Hasher.hpp index cd86db6..2783fa4 100644 --- a/Chaos/Hashing/Hasher.hpp +++ b/Chaos/Hashing/Hasher.hpp @@ -11,12 +11,23 @@ public: template void Update(InputIt begin, InputIt end) { - static_cast(*this).Update(begin, end); + Impl().Update(begin, end); } auto Finish() { - return static_cast(*this).Finish(); + return Impl().Finish(); + } + +private: + const T & Impl() const + { + return static_cast(*this); + } + + T & Impl() + { + return static_cast(*this); } };