aboutsummaryrefslogtreecommitdiff
path: root/src/trie.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/trie.h')
-rw-r--r--src/trie.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/trie.h b/src/trie.h
index 6262ab3..b31900f 100644
--- a/src/trie.h
+++ b/src/trie.h
@@ -39,15 +39,17 @@ class Trie {
return this->resolve(path);
}
+ inline detail::optional_ptr<Value> get() {
+ if ( this->value_.first ) {
+ return detail::optional_ptr<Value>(&this->value_.second);
+ } else {
+ return detail::optional_ptr<Value>();
+ }
+ }
+
inline detail::optional_ptr<Value> get(key_list path) {
if ( auto tmp = this->resolve(path) ) {
- if ( tmp.get()->value_.first ) {
- return detail::optional_ptr<Value>(
- &tmp.get()->value_.second
- );
- } else {
- return detail::optional_ptr<Value>();
- }
+ return tmp.get()->get();
} else {
return detail::optional_ptr<Value>();
}