From 24917370eab71a408cbbeda9000de0b9d9b5cefa Mon Sep 17 00:00:00 2001 From: lisyarus Date: Thu, 27 Oct 2022 17:50:41 +0300 Subject: [PATCH] Add util::hash_sequence --- libs/util/include/psemek/util/hash.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/util/include/psemek/util/hash.hpp b/libs/util/include/psemek/util/hash.hpp index 349a7b0b..701d93a4 100644 --- a/libs/util/include/psemek/util/hash.hpp +++ b/libs/util/include/psemek/util/hash.hpp @@ -16,6 +16,15 @@ namespace psemek::util seed = b * k; } + template ())>>> + void hash_sequence(std::size_t & seed, Iterator begin, Iterator end, Hash hash = Hash{}) + { + for (; begin != end; ++begin) + { + hash_combine(seed, hash(*begin)); + } + } + struct any_hash { struct is_transparent{};