From 5a9e2a42ecba549b05785a96e3d9516250148994 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Sun, 27 Jan 2013 20:12:20 +0000 Subject: [PATCH] Changed checkExists() to show invalid key value in error message. Commented out copyStructureFrom(), as it doesn't appear to be implemented --- gtsam/linear/VectorValues.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gtsam/linear/VectorValues.h b/gtsam/linear/VectorValues.h index ef112ba2b..e73ad3f95 100644 --- a/gtsam/linear/VectorValues.h +++ b/gtsam/linear/VectorValues.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -314,14 +315,17 @@ namespace gtsam { void chk() const; // Throw an exception if j does not exist - void checkExists(Index j) const { + inline void checkExists(Index j) const { chk(); - if(!exists(j)) - throw std::out_of_range("VectorValues: requested variable index is not in this VectorValues."); + if(!exists(j)) { + const std::string msg = + (boost::format("VectorValues: requested variable index j=%1% is not in this VectorValues.") % j).str(); + throw std::out_of_range(msg); + } } // Resize - void copyStructureFrom(const VectorValues& other); +// void copyStructureFrom(const VectorValues& other) // FIXME: not implemented? public: