diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/containers/comptrie/set.h | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/containers/comptrie/set.h')
-rw-r--r-- | library/cpp/containers/comptrie/set.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/library/cpp/containers/comptrie/set.h b/library/cpp/containers/comptrie/set.h new file mode 100644 index 00000000000..acd43338f0a --- /dev/null +++ b/library/cpp/containers/comptrie/set.h @@ -0,0 +1,40 @@ +#pragma once + +#include "comptrie_trie.h" + +template <typename T = char> +class TCompactTrieSet: public TCompactTrie<T, ui8, TNullPacker<ui8>> { +public: + typedef TCompactTrie<T, ui8, TNullPacker<ui8>> TBase; + + using typename TBase::TBuilder; + using typename TBase::TKey; + using typename TBase::TKeyBuf; + using typename TBase::TSymbol; + + TCompactTrieSet() = default; + + explicit TCompactTrieSet(const TBlob& data) + : TBase(data) + { + } + + template <typename D> + explicit TCompactTrieSet(const TCompactTrie<T, D, TNullPacker<D>>& trie) + : TBase(trie.Data()) // should be binary compatible for any D + { + } + + TCompactTrieSet(const char* data, size_t len) + : TBase(data, len) + { + } + + bool Has(const typename TBase::TKeyBuf& key) const { + return TBase::Find(key.data(), key.size()); + } + + bool FindTails(const typename TBase::TKeyBuf& key, TCompactTrieSet<T>& res) const { + return TBase::FindTails(key, res); + } +}; |