From f4c3131ee209ccaaf15f73c1195fcc40b91906b7 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Wed, 11 Jan 2023 23:50:17 -0800 Subject: [PATCH] Return a set of DiscreteKey, Fixes issue #1384 --- gtsam/hybrid/HybridFactorGraph.cpp | 8 ++++---- gtsam/hybrid/HybridFactorGraph.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gtsam/hybrid/HybridFactorGraph.cpp b/gtsam/hybrid/HybridFactorGraph.cpp index 4238925d6..098942f10 100644 --- a/gtsam/hybrid/HybridFactorGraph.cpp +++ b/gtsam/hybrid/HybridFactorGraph.cpp @@ -25,17 +25,17 @@ namespace gtsam { /* ************************************************************************* */ -DiscreteKeys HybridFactorGraph::discreteKeys() const { - DiscreteKeys keys; +std::set HybridFactorGraph::discreteKeys() const { + std::set keys; for (auto& factor : factors_) { if (auto p = boost::dynamic_pointer_cast(factor)) { for (const DiscreteKey& key : p->discreteKeys()) { - keys.push_back(key); + keys.insert(key); } } if (auto p = boost::dynamic_pointer_cast(factor)) { for (const DiscreteKey& key : p->discreteKeys()) { - keys.push_back(key); + keys.insert(key); } } } diff --git a/gtsam/hybrid/HybridFactorGraph.h b/gtsam/hybrid/HybridFactorGraph.h index 7d30663a3..a02d4a212 100644 --- a/gtsam/hybrid/HybridFactorGraph.h +++ b/gtsam/hybrid/HybridFactorGraph.h @@ -65,7 +65,7 @@ class HybridFactorGraph : public FactorGraph { /// @{ /// Get all the discrete keys in the factor graph. - DiscreteKeys discreteKeys() const; + std::set discreteKeys() const; /// Get all the discrete keys in the factor graph, as a set. KeySet discreteKeySet() const;