changed get and operator functions to const ( using find operator of a map instead of [] )
parent
b70f081ebc
commit
630bc9144f
|
@ -53,8 +53,16 @@ public:
|
||||||
void erase(const std::string& key);
|
void erase(const std::string& key);
|
||||||
|
|
||||||
/** return node with given key */
|
/** return node with given key */
|
||||||
inline ConditionalGaussian::shared_ptr get (const std::string& key) { return nodes[key];}
|
inline ConditionalGaussian::shared_ptr get (const std::string& key) const
|
||||||
inline ConditionalGaussian::shared_ptr operator[](const std::string& key) { return nodes[key];}
|
{
|
||||||
|
const_iterator cg = nodes.find(key); // get node
|
||||||
|
return cg->second;
|
||||||
|
}
|
||||||
|
inline ConditionalGaussian::shared_ptr operator[](const std::string& key) const
|
||||||
|
{
|
||||||
|
const_iterator cg = nodes.find(key); // get node
|
||||||
|
return cg->second;
|
||||||
|
}
|
||||||
|
|
||||||
/** return begin and end of the nodes. FD: breaks encapsulation? */
|
/** return begin and end of the nodes. FD: breaks encapsulation? */
|
||||||
typedef Nodes::const_iterator const_iterator;
|
typedef Nodes::const_iterator const_iterator;
|
||||||
|
|
Loading…
Reference in New Issue