diff --git a/gtsam.h b/gtsam.h index 05cf7ffb5..261a962d0 100644 --- a/gtsam.h +++ b/gtsam.h @@ -1725,6 +1725,7 @@ class KeySet { // structure specific methods void insert(size_t key); + void merge(gtsam::KeySet& other); bool erase(size_t key); // returns true if value was removed bool count(size_t key) const; // returns true if value exists diff --git a/gtsam/base/FastSet.h b/gtsam/base/FastSet.h index 7ed6c7cd7..69e841e57 100644 --- a/gtsam/base/FastSet.h +++ b/gtsam/base/FastSet.h @@ -103,6 +103,11 @@ public: /** Check for equality within tolerance to implement Testable */ bool equals(const FastSet& other, double tol = 1e-9) const { return FastSetTestableHelper::equals(*this, other, tol); } + /** insert another set: handy for MATLAB access */ + void merge(const FastSet& other) { + Base::insert(other.begin(),other.end()); + } + private: /** Serialization function */ friend class boost::serialization::access;