From b849fbec1627e09a20565a52150e9d8657e99eb8 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Fri, 3 Feb 2012 22:23:41 +0000 Subject: [PATCH] Fixed compilation errors --- gtsam/nonlinear/ISAM2.h | 1 - gtsam/nonlinear/Values.h | 20 ++++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gtsam/nonlinear/ISAM2.h b/gtsam/nonlinear/ISAM2.h index 1bde623a8..00d07a040 100644 --- a/gtsam/nonlinear/ISAM2.h +++ b/gtsam/nonlinear/ISAM2.h @@ -315,7 +315,6 @@ public: typedef BayesTree > Base; ///< The BayesTree base class typedef ISAM2 This; ///< This class - typedef Values Values; typedef GRAPH Graph; /** Create an empty ISAM2 instance */ diff --git a/gtsam/nonlinear/Values.h b/gtsam/nonlinear/Values.h index a0dc33a74..0aa67c63d 100644 --- a/gtsam/nonlinear/Values.h +++ b/gtsam/nonlinear/Values.h @@ -82,10 +82,18 @@ namespace gtsam { typedef boost::shared_ptr shared_ptr; /// A pair of const references to the key and value, the dereferenced type of the const_iterator and const_reverse_iterator - typedef std::pair ConstKeyValuePair; + struct ConstKeyValuePair { + const Symbol& first; + const Value& second; + ConstKeyValuePair(const Symbol& key, const Value& value) : first(key), second(value) {} + }; /// A pair of references to the key and value, the dereferenced type of the iterator and reverse_iterator - typedef std::pair KeyValuePair; + struct KeyValuePair { + const Symbol& first; + Value& second; + KeyValuePair(const Symbol& key, Value& value) : first(key), second(value) {} + }; /// Mutable forward iterator, with value type KeyValuePair typedef boost::transform_iterator< @@ -178,10 +186,10 @@ namespace gtsam { VectorValues zeroVectors(const Ordering& ordering) const; private: - static std::pair make_const_deref_pair(const KeyValueMap::const_iterator::value_type& key_value) { - return std::make_pair(key_value.first, *key_value.second); } - static std::pair make_deref_pair(const KeyValueMap::iterator::value_type& key_value) { - return std::make_pair(key_value.first, *key_value.second); } + static ConstKeyValuePair make_const_deref_pair(const KeyValueMap::const_iterator::value_type& key_value) { + return ConstKeyValuePair(key_value.first, *key_value.second); } + static KeyValuePair make_deref_pair(const KeyValueMap::iterator::value_type& key_value) { + return KeyValuePair(key_value.first, *key_value.second); } public: const_iterator begin() const { return boost::make_transform_iterator(values_.begin(), &make_const_deref_pair); }