Add contains

release/4.3a0
Frank Dellaert 2025-01-29 23:50:43 -05:00
parent e6662b8206
commit 57bcb9f4e6
1 changed files with 8 additions and 0 deletions

View File

@ -101,6 +101,14 @@ class GTSAM_EXPORT DiscreteValues : public Assignment<Key> {
*/
DiscreteValues& update(const DiscreteValues& values);
/**
* @brief Check if the DiscreteValues contains the given key.
*
* @param key The key to check for.
* @return True if the key is present, false otherwise.
*/
bool contains(Key key) const { return this->find(key) != this->end(); }
/**
* @brief Filter values by keys.
*