From 94d50ddfb9228ee91c63e6f0da30ef9d0a0ef843 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Wed, 3 Feb 2010 13:57:34 +0000 Subject: [PATCH] Added a liberal sprinkling of 'typename' to make TupleConfig work better --- cpp/TupleConfig.h | 8 ++++---- cpp/testTupleConfig.cpp | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cpp/TupleConfig.h b/cpp/TupleConfig.h index 6f026f1f6..80a361aa7 100644 --- a/cpp/TupleConfig.h +++ b/cpp/TupleConfig.h @@ -193,12 +193,12 @@ namespace gtsam { bool exists(const Key1& j) const { return first_.exists(j); } // access operator - currently configs after the first one will not be found - template - const Value& operator[](const Key& j) const { return second_[j]; } + template + const typename Key::Value_t & operator[](const Key& j) const { return second_[j]; } const Value1& operator[](const Key1& j) const { return first_[j]; } - template - const Value& at(const Key& j) const { return second_.at(j); } + template + const typename Key::Value_t & at(const Key& j) const { return second_.at(j); } const Value1& at(const Key1& j) const { return first_.at(j); } }; diff --git a/cpp/testTupleConfig.cpp b/cpp/testTupleConfig.cpp index 67d5e5a0a..44e167552 100644 --- a/cpp/testTupleConfig.cpp +++ b/cpp/testTupleConfig.cpp @@ -203,12 +203,12 @@ TEST(TupleConfig, create_insert) { configB.insert(l1, point1); configB.insert(L1, lam1); - // bracket operator - FAILS on config types after first one + // bracket operator CHECK(assert_equal(configA[x1], pose1)); -// CHECK(assert_equal(configA[l1], point1)); + CHECK(assert_equal(configA[l1], point1)); CHECK(assert_equal(configB[x1], pose1)); -// CHECK(assert_equal(configB[l1], point1)); -// CHECK(assert_equal(configB[L1], lam1)); + CHECK(assert_equal(configB[l1], point1)); + CHECK(assert_equal(configB[L1], lam1)); // exists CHECK(configA.exists(x1)); @@ -217,12 +217,12 @@ TEST(TupleConfig, create_insert) { CHECK(configB.exists(l1)); CHECK(configB.exists(L1)); - // at - access function - FAILS as with bracket operator + // at CHECK(assert_equal(configA.at(x1), pose1)); -// CHECK(assert_equal(configA.at(l1), point1)); + CHECK(assert_equal(configA.at(l1), point1)); CHECK(assert_equal(configB.at(x1), pose1)); -// CHECK(assert_equal(configB.at(l1), point1)); -// CHECK(assert_equal(configB.at(L1), lam1)); + CHECK(assert_equal(configB.at(l1), point1)); + CHECK(assert_equal(configB.at(L1), lam1)); }