diff options
Diffstat (limited to 'build2/variable.ixx')
-rw-r--r-- | build2/variable.ixx | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/build2/variable.ixx b/build2/variable.ixx index bb97750..816f4bf 100644 --- a/build2/variable.ixx +++ b/build2/variable.ixx @@ -622,33 +622,19 @@ namespace build2 // variable_pool // - inline const variable* variable_pool:: - find (const string& n) - { - auto i (map_.find (&n)); - return i != map_.end () ? &i->second : nullptr; - } - inline const variable& variable_pool:: - insert (string n) + operator[] (const string& n) const { - // We are not overriding anything so skip the custom insert() checks. - // - auto p ( - insert ( - variable {move (n), nullptr, nullptr, variable_visibility::normal})); - - return p.first->second; + const variable* r (find (n)); + assert (r != nullptr); + return *r; } - - inline const variable& variable_pool:: - operator[] (const string& n) + inline const variable* variable_pool:: + find (const string& n) const { - if (const variable* v = find (n)) - return *v; - else - return insert (n); + auto i (map_.find (&n)); + return i != map_.end () ? &i->second : nullptr; } // variable_map::iterator_adapter |