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;