diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/containers/comptrie/chunked_helpers_trie.h | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/containers/comptrie/chunked_helpers_trie.h')
-rw-r--r-- | library/cpp/containers/comptrie/chunked_helpers_trie.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/library/cpp/containers/comptrie/chunked_helpers_trie.h b/library/cpp/containers/comptrie/chunked_helpers_trie.h index 6efe55b5f0..cfa35f5ba2 100644 --- a/library/cpp/containers/comptrie/chunked_helpers_trie.h +++ b/library/cpp/containers/comptrie/chunked_helpers_trie.h @@ -13,7 +13,7 @@ public: : Trie(blob) { } - + bool Has(const char* key) const { return Trie.Find(key, strlen(key)); } @@ -23,7 +23,7 @@ public: } }; -template <bool sorted = false> +template <bool sorted = false> class TTrieSetWriter { private: TCompactTrieBuilder<char> Builder; @@ -57,24 +57,24 @@ public: } }; -template <bool isWriter, bool sorted = false> +template <bool isWriter, bool sorted = false> struct TTrieSetG; -template <bool sorted> +template <bool sorted> struct TTrieSetG<false, sorted> { typedef TTrieSet T; }; -template <bool sorted> +template <bool sorted> struct TTrieSetG<true, sorted> { typedef TTrieSetWriter<sorted> T; }; -template <typename T> +template <typename T> class TTrieMap { private: TCompactTrie<char> Trie; - static_assert(sizeof(T) <= sizeof(ui64), "expect sizeof(T) <= sizeof(ui64)"); + static_assert(sizeof(T) <= sizeof(ui64), "expect sizeof(T) <= sizeof(ui64)"); public: TTrieMap(const TBlob& blob) @@ -101,17 +101,17 @@ public: } } - const TCompactTrie<char>& GetTrie() const { + const TCompactTrie<char>& GetTrie() const { return Trie; } }; -template <typename T, bool sorted = false> +template <typename T, bool sorted = false> class TTrieMapWriter { private: typedef TCompactTrieBuilder<char> TBuilder; TBuilder Builder; - static_assert(sizeof(T) <= sizeof(ui64), "expect sizeof(T) <= sizeof(ui64)"); + static_assert(sizeof(T) <= sizeof(ui64), "expect sizeof(T) <= sizeof(ui64)"); #ifndef NDEBUG bool IsSorted; #endif @@ -130,12 +130,12 @@ public: memcpy(&intValue, &value, sizeof(T)); Builder.Add(key, strlen(key), intValue); #ifndef NDEBUG - /* + /* if (!IsSorted) { T test; assert(Get(key, &test) && value == test); } - */ + */ #endif } @@ -177,7 +177,7 @@ public: } }; -template <typename T> +template <typename T> class TTrieSortedMapWriter { private: typedef std::pair<TString, T> TValue; @@ -204,15 +204,15 @@ public: } }; -template <typename X, bool isWriter, bool sorted = false> +template <typename X, bool isWriter, bool sorted = false> struct TTrieMapG; -template <typename X, bool sorted> +template <typename X, bool sorted> struct TTrieMapG<X, false, sorted> { typedef TTrieMap<X> T; }; -template <typename X, bool sorted> +template <typename X, bool sorted> struct TTrieMapG<X, true, sorted> { typedef TTrieMapWriter<X, sorted> T; }; |