blob: acd43338f0a8e929a61cea2cdd7b28b667ce09e1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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);
}
};
|