From e2363e90bd8cdec9d2ef052a23594040502069b1 Mon Sep 17 00:00:00 2001 From: dellaert Date: Sat, 22 Dec 2018 18:07:00 -0500 Subject: [PATCH] Fixed issue with 'count' --- gtsam/nonlinear/Values.h | 2 +- gtsam/nonlinear/tests/testValues.cpp | 1 + gtsam/slam/dataset.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gtsam/nonlinear/Values.h b/gtsam/nonlinear/Values.h index 676d30787..16f8eba16 100644 --- a/gtsam/nonlinear/Values.h +++ b/gtsam/nonlinear/Values.h @@ -387,7 +387,7 @@ namespace gtsam { // Count values of given type \c ValueType template - bool count() const { + size_t count() const { size_t i = 0; for (const auto& key_value : *this) { if (dynamic_cast*>(&key_value.value)) diff --git a/gtsam/nonlinear/tests/testValues.cpp b/gtsam/nonlinear/tests/testValues.cpp index 0dee52570..b3c557b32 100644 --- a/gtsam/nonlinear/tests/testValues.cpp +++ b/gtsam/nonlinear/tests/testValues.cpp @@ -384,6 +384,7 @@ TEST(Values, filter) { } EXPECT_LONGS_EQUAL(2, (long)i); EXPECT_LONGS_EQUAL(2, (long)values.count()); + EXPECT_LONGS_EQUAL(2, (long)values.count()); // construct a values with the view Values actualSubValues2(pose_filtered); diff --git a/gtsam/slam/dataset.cpp b/gtsam/slam/dataset.cpp index 4f52f3c40..fbb198265 100644 --- a/gtsam/slam/dataset.cpp +++ b/gtsam/slam/dataset.cpp @@ -880,7 +880,7 @@ bool writeBALfromValues(const string& filename, const SfM_data &data, } } else { cout - << "writeBALfromValues: different number of cameras in SfM_dataValues (#cameras= " + << "writeBALfromValues: different number of cameras in SfM_dataValues (#cameras " << dataValues.number_cameras() << ") and values (#cameras " << nrPoses << ", #poses " << nrCameras << ")!!" << endl;