feat(util/trie): add value() method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
ab5f570924
commit
5a5d66edc8
2 changed files with 7 additions and 0 deletions
|
@ -29,8 +29,11 @@ static void tst1() {
|
|||
lean_assert(!find(t, "abd"));
|
||||
t2.display(std::cout);
|
||||
ctrie<int> t3 = *t2.find('a');
|
||||
lean_assert(!t3.value());
|
||||
lean_assert(*find(t3, "bc") == 10);
|
||||
lean_assert(*find(t3, "bd") == 11);
|
||||
ctrie<int> t4 = *(t3.find('b')->find('c'));
|
||||
lean_assert(*t4.value() == 10);
|
||||
}
|
||||
|
||||
static void tst2() {
|
||||
|
|
|
@ -130,6 +130,10 @@ public:
|
|||
return optional<trie>();
|
||||
}
|
||||
|
||||
optional<Val> value() const {
|
||||
return m_root->m_value;
|
||||
}
|
||||
|
||||
void merge(trie const & t) {
|
||||
m_root = merge(m_root.steal(), t.m_root);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue