diff options
author | breakneck <breakneck@yandex-team.ru> | 2022-02-10 16:47:58 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:58 +0300 |
commit | e2021f9a0e54d13b7c48796318b13b66dc625e74 (patch) | |
tree | 5aed1691033eaf399ab80a10a137238922035fa8 /util/digest/sequence.h | |
parent | 83602b1b564b92a80a1526d113fa2846661dd10e (diff) | |
download | ydb-e2021f9a0e54d13b7c48796318b13b66dc625e74.tar.gz |
Restoring authorship annotation for <breakneck@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/digest/sequence.h')
-rw-r--r-- | util/digest/sequence.h | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/util/digest/sequence.h b/util/digest/sequence.h index 712331007b..a8a1bce688 100644 --- a/util/digest/sequence.h +++ b/util/digest/sequence.h @@ -1,48 +1,48 @@ -#pragma once - -#include "numeric.h" -#include <util/generic/hash.h> -#include <util/generic/array_ref.h> - -template <typename ElementHash = void> -class TRangeHash { -private: - template <typename ElementType> - using TBase = std::conditional_t< - !std::is_void<ElementHash>::value, - ElementHash, +#pragma once + +#include "numeric.h" +#include <util/generic/hash.h> +#include <util/generic/array_ref.h> + +template <typename ElementHash = void> +class TRangeHash { +private: + template <typename ElementType> + using TBase = std::conditional_t< + !std::is_void<ElementHash>::value, + ElementHash, THash<ElementType>>; - -public: - template <typename Range> - size_t operator()(const Range& range) const { - size_t accumulated = 0; - for (const auto& element : range) { - accumulated = CombineHashes(accumulated, TBase<typename Range::value_type>()(element)); - } - return accumulated; - } -}; - -using TSimpleRangeHash = TRangeHash<>; - -template <typename RegionHash = void> -class TContiguousHash { -private: - template <typename ElementType> - using TBase = std::conditional_t< - !std::is_void<RegionHash>::value, - RegionHash, + +public: + template <typename Range> + size_t operator()(const Range& range) const { + size_t accumulated = 0; + for (const auto& element : range) { + accumulated = CombineHashes(accumulated, TBase<typename Range::value_type>()(element)); + } + return accumulated; + } +}; + +using TSimpleRangeHash = TRangeHash<>; + +template <typename RegionHash = void> +class TContiguousHash { +private: + template <typename ElementType> + using TBase = std::conditional_t< + !std::is_void<RegionHash>::value, + RegionHash, TRangeHash<ElementType>>; - -public: - template <typename ContainerType> - auto operator()(const ContainerType& container) const { - return operator()(MakeArrayRef(container)); - } - - template <typename ElementType> + +public: + template <typename ContainerType> + auto operator()(const ContainerType& container) const { + return operator()(MakeArrayRef(container)); + } + + template <typename ElementType> auto operator()(const TArrayRef<ElementType>& data) const { - return TBase<ElementType>()(data); - } -}; + return TBase<ElementType>()(data); + } +}; |