diff --git a/gtsam/linear/VectorValues.cpp b/gtsam/linear/VectorValues.cpp index 1d2ce3847..cd3ae815b 100644 --- a/gtsam/linear/VectorValues.cpp +++ b/gtsam/linear/VectorValues.cpp @@ -141,7 +141,7 @@ namespace gtsam { for (const auto& key_value : v) #endif { - os << " " << key_value.first << ": " << key_value.second.transpose() + os << " " << StreamedKey(key_value.first) << ": " << key_value.second.transpose() << "\n"; } return os; @@ -151,7 +151,7 @@ namespace gtsam { void VectorValues::print(const string& str, const KeyFormatter& formatter) const { cout << str << ": " << size() << " elements\n"; - cout << *this; + cout << key_formatter(formatter) << *this; cout.flush(); } diff --git a/gtsam/linear/tests/testVectorValues.cpp b/gtsam/linear/tests/testVectorValues.cpp index af6be8aa9..f97f96aaf 100644 --- a/gtsam/linear/tests/testVectorValues.cpp +++ b/gtsam/linear/tests/testVectorValues.cpp @@ -17,6 +17,7 @@ #include #include +#include #include @@ -239,7 +240,6 @@ TEST(VectorValues, print) vv.insert(2, Vector2(4, 5)); vv.insert(5, Vector2(6, 7)); vv.insert(7, Vector2(8, 9)); - vv.print(); string expected = " 0: 1\n 1: 2 3\n 2: 4 5\n 5: 6 7\n 7: 8 9\n";