operator[]

release/4.3a0
Frank Dellaert 2010-01-10 17:01:48 +00:00
parent 710bce5cc4
commit 120f1301c2
1 changed files with 5 additions and 0 deletions

View File

@ -63,6 +63,11 @@ namespace gtsam {
else return it->second; else return it->second;
} }
/** operator[] syntax for get */
inline const T& operator[](const std::string& name) const {
return get(name);
}
/** Retrieve a variable by key, returns nothing if not found */ /** Retrieve a variable by key, returns nothing if not found */
boost::optional<const T&> gettry(const std::string& key) const { boost::optional<const T&> gettry(const std::string& key) const {
const_iterator it = values_.find(key); const_iterator it = values_.find(key);