diff --git a/gtsam/nonlinear/Values-inl.h b/gtsam/nonlinear/Values-inl.h index 4cab86714..c38f14177 100644 --- a/gtsam/nonlinear/Values-inl.h +++ b/gtsam/nonlinear/Values-inl.h @@ -169,6 +169,16 @@ namespace gtsam { } }; + /* ************************************************************************* */ + /** Constructor from a Filtered view copies out all values */ + template + Values::Values(const Values::Filtered& view) { + BOOST_FOREACH(const typename Filtered::KeyValuePair& key_value, view) { + Key key = key_value.key; + insert(key, key_value.value); + } + } + /* ************************************************************************* */ template Values::Values(const Values::ConstFiltered& view) { diff --git a/gtsam/nonlinear/Values.h b/gtsam/nonlinear/Values.h index d9778bb0f..4bc5f0f7e 100644 --- a/gtsam/nonlinear/Values.h +++ b/gtsam/nonlinear/Values.h @@ -138,6 +138,10 @@ namespace gtsam { /** Copy constructor duplicates all keys and values */ Values(const Values& other); + /** Constructor from a Filtered view copies out all values */ + template + Values(const Filtered& view); + /** Constructor from a Filtered or ConstFiltered view */ template Values(const ConstFiltered& view);