From 1ce50a8258d879b4a7d80727845261f83c9b8114 Mon Sep 17 00:00:00 2001 From: Manohar Paluri Date: Fri, 28 Aug 2009 14:55:33 +0000 Subject: [PATCH] changed get_delta to const ( using find operator of a map instead of [] ) --- cpp/ConstrainedChordalBayesNet.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cpp/ConstrainedChordalBayesNet.h b/cpp/ConstrainedChordalBayesNet.h index 4deffe83a..39dcd6f35 100644 --- a/cpp/ConstrainedChordalBayesNet.h +++ b/cpp/ConstrainedChordalBayesNet.h @@ -51,7 +51,12 @@ public: ChordalBayesNet convert() const; /** get delta functions by key */ - DeltaFunction::shared_ptr get_delta(const std::string& key) {return delta_nodes[key];} + DeltaFunction::shared_ptr get_delta(const std::string& key) const + { + const_delta_iterator cg = delta_nodes.find(key); + assert( cg != delta_nodes.end() ); + return cg->second; + } /** check equality */ bool equals(const ConstrainedChordalBayesNet& cbn) const;