diff options
author | tender-bum <tender-bum@yandex-team.ru> | 2022-02-10 16:50:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:01 +0300 |
commit | c78b06a63de7beec995c1007bc5332bdf3d75b69 (patch) | |
tree | 729de992758f40b85278d4abaad655be5dd68dbc /library/cpp/containers/flat_hash/lib/probings.h | |
parent | 95ab23a39b5482a434361566cabdd5b0a433cb43 (diff) | |
download | ydb-c78b06a63de7beec995c1007bc5332bdf3d75b69.tar.gz |
Restoring authorship annotation for <tender-bum@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/containers/flat_hash/lib/probings.h')
-rw-r--r-- | library/cpp/containers/flat_hash/lib/probings.h | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/containers/flat_hash/lib/probings.h b/library/cpp/containers/flat_hash/lib/probings.h index 886be59cff..5760ff58c3 100644 --- a/library/cpp/containers/flat_hash/lib/probings.h +++ b/library/cpp/containers/flat_hash/lib/probings.h @@ -1,45 +1,45 @@ -#pragma once - -#include <type_traits> - -namespace NFlatHash { - -class TLinearProbing { -public: - template <class SizeFitter, class F> - static auto FindBucket(SizeFitter sf, size_t idx, size_t sz, F f) { - idx = sf.EvalIndex(idx, sz); - while (!f(idx)) { - idx = sf.EvalIndex(++idx, sz); - } - return idx; - } -}; - -class TQuadraticProbing { -public: - template <class SizeFitter, class F> - static auto FindBucket(SizeFitter sf, size_t idx, size_t sz, F f) { - idx = sf.EvalIndex(idx, sz); - size_t k = 0; - while (!f(idx)) { - idx = sf.EvalIndex(idx + 2 * ++k - 1, sz); - } - return idx; - } -}; - -class TDenseProbing { -public: - template <class SizeFitter, class F> - static auto FindBucket(SizeFitter sf, size_t idx, size_t sz, F f) { - idx = sf.EvalIndex(idx, sz); - size_t k = 0; - while (!f(idx)) { - idx = sf.EvalIndex(idx + ++k, sz); - } - return idx; - } -}; - -} // NFlatHash +#pragma once + +#include <type_traits> + +namespace NFlatHash { + +class TLinearProbing { +public: + template <class SizeFitter, class F> + static auto FindBucket(SizeFitter sf, size_t idx, size_t sz, F f) { + idx = sf.EvalIndex(idx, sz); + while (!f(idx)) { + idx = sf.EvalIndex(++idx, sz); + } + return idx; + } +}; + +class TQuadraticProbing { +public: + template <class SizeFitter, class F> + static auto FindBucket(SizeFitter sf, size_t idx, size_t sz, F f) { + idx = sf.EvalIndex(idx, sz); + size_t k = 0; + while (!f(idx)) { + idx = sf.EvalIndex(idx + 2 * ++k - 1, sz); + } + return idx; + } +}; + +class TDenseProbing { +public: + template <class SizeFitter, class F> + static auto FindBucket(SizeFitter sf, size_t idx, size_t sz, F f) { + idx = sf.EvalIndex(idx, sz); + size_t k = 0; + while (!f(idx)) { + idx = sf.EvalIndex(idx + ++k, sz); + } + return idx; + } +}; + +} // NFlatHash |