From 35f814706c4ff244bc15c4285804fc0656824c41 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Thu, 6 Feb 2014 18:37:43 +0100 Subject: Added support for changing values * member method set changes the value of a given path to the provided value ** returns false if the specified path doesn't exist --- src/trie.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/trie.h b/src/trie.h index 46fcb4b..d4763ef 100644 --- a/src/trie.h +++ b/src/trie.h @@ -51,6 +51,19 @@ class Trie { } } + inline bool set(key_list path, Value value) { + std::pair tmp(this->resolve(path)); + + if ( tmp.first ) { + tmp.second->value_.first = true; + tmp.second->value_.second = value; + + return true; + } else { + return false; + } + } + private: std::pair value_; std::map children_; -- cgit v1.2.3