From d83c4c390cb91576983e62652aaeafb4cd0d558f Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Tue, 5 Jun 2012 21:31:27 +0000 Subject: [PATCH] Added non-const constructor from filtered --- gtsam/nonlinear/Values-inl.h | 10 ++++++++++ gtsam/nonlinear/Values.h | 4 ++++ 2 files changed, 14 insertions(+) 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);