STL-based efficient transformation

release/4.3a0
Varun Agrawal 2023-01-15 00:59:34 -05:00
parent abe9b281af
commit b010a240f3
2 changed files with 5 additions and 4 deletions

View File

@ -45,9 +45,10 @@ DiscreteKeys HybridFactorGraph::discreteKeys() const {
/* ************************************************************************* */ /* ************************************************************************* */
KeySet HybridFactorGraph::discreteKeySet() const { KeySet HybridFactorGraph::discreteKeySet() const {
KeySet keys; KeySet keys;
for (const DiscreteKey& k : discreteKeys()) { DiscreteKeys key_vector = discreteKeys();
keys.insert(k.first); std::transform(key_vector.begin(), key_vector.end(),
} std::inserter(keys, keys.begin()),
[](const DiscreteKey& k) { return k.first; });
return keys; return keys;
} }

View File

@ -65,7 +65,7 @@ class HybridFactorGraph : public FactorGraph<Factor> {
/// @{ /// @{
/// Get all the discrete keys in the factor graph. /// Get all the discrete keys in the factor graph.
std::set<DiscreteKey> discreteKeys() const; DiscreteKeys discreteKeys() const;
/// Get all the discrete keys in the factor graph, as a set. /// Get all the discrete keys in the factor graph, as a set.
KeySet discreteKeySet() const; KeySet discreteKeySet() const;