diff --git a/gtsam/nonlinear/Values-inl.h b/gtsam/nonlinear/Values-inl.h index 474394f7b..a354e0139 100644 --- a/gtsam/nonlinear/Values-inl.h +++ b/gtsam/nonlinear/Values-inl.h @@ -24,9 +24,9 @@ #pragma once -#include - #include +#include +#include namespace gtsam { diff --git a/gtsam/nonlinear/Values.cpp b/gtsam/nonlinear/Values.cpp index e3adcc1bf..c7321c904 100644 --- a/gtsam/nonlinear/Values.cpp +++ b/gtsam/nonlinear/Values.cpp @@ -103,16 +103,16 @@ namespace gtsam { /* ************************************************************************* */ void Values::retractMasked(const VectorValues& delta, const KeySet& mask) { gttic(retractMasked); - assert(theta->size() == delta.size()); + assert(this->size() == delta.size()); auto key_value = values_.begin(); VectorValues::const_iterator key_delta; #ifdef GTSAM_USE_TBB for (; key_value != values_.end(); ++key_value) { - key_delta = delta.find(key_value.first); + key_delta = delta.find(key_value->first); #else for (key_delta = delta.begin(); key_value != values_.end(); ++key_value, ++key_delta) { - assert(key_value.first == key_delta->first); + assert(key_value->first == key_delta->first); #endif Key var = key_value->first; assert(static_cast(delta[var].size()) == key_value->second->dim()); diff --git a/gtsam/nonlinear/Values.h b/gtsam/nonlinear/Values.h index 299435677..161df2cba 100644 --- a/gtsam/nonlinear/Values.h +++ b/gtsam/nonlinear/Values.h @@ -306,12 +306,6 @@ namespace gtsam { typedef KeyValueMap::const_iterator::value_type ConstKeyValuePtrPair; typedef KeyValueMap::iterator::value_type KeyValuePtrPair; - /** insert that mimics the STL map insert - if the value already exists, the map is not modified - * and an iterator to the existing value is returned, along with 'false'. If the value did not - * exist, it is inserted and an iterator pointing to the new element, along with 'true', is - * returned. */ - std::pair tryInsert(Key j, const Value& value); - /// Mutable forward iterator, with value type KeyValuePair typedef boost::transform_iterator< std::function, KeyValueMap::iterator> iterator; @@ -328,6 +322,12 @@ namespace gtsam { typedef boost::transform_iterator< std::function, KeyValueMap::const_reverse_iterator> const_reverse_iterator; + /** insert that mimics the STL map insert - if the value already exists, the map is not modified + * and an iterator to the existing value is returned, along with 'false'. If the value did not + * exist, it is inserted and an iterator pointing to the new element, along with 'true', is + * returned. */ + std::pair tryInsert(Key j, const Value& value); + static ConstKeyValuePair make_const_deref_pair(const KeyValueMap::const_iterator::value_type& key_value) { return ConstKeyValuePair(key_value.first, *key_value.second); }