diff --git a/cpp/Lie.h b/cpp/Lie.h index 28fb8cec9..593feabc9 100644 --- a/cpp/Lie.h +++ b/cpp/Lie.h @@ -62,7 +62,7 @@ namespace gtsam { /** Call print on the object */ template - inline void print_(const T& object, const char *s = "") { + inline void print_(const T& object, const std::string& s = "") { object.print(s); } diff --git a/cpp/LieConfig-inl.h b/cpp/LieConfig-inl.h index c4913c77a..dd5677c95 100644 --- a/cpp/LieConfig-inl.h +++ b/cpp/LieConfig-inl.h @@ -16,20 +16,20 @@ using namespace std; namespace gtsam { template - void LieConfig::print(const std::string &s) const { - std::cout << "LieConfig " << s << ", size " << values_.size() << "\n"; - std::pair v; + void LieConfig::print(const string &s) const { + cout << "LieConfig " << s << ", size " << values_.size() << "\n"; + pair v; BOOST_FOREACH(v, values_) - ::gtsam::print(v.second, v.first + ": "); + gtsam::print(v.second, v.first + ": "); } template bool LieConfig::equals(const LieConfig& expected, double tol) const { if (values_.size() != expected.values_.size()) return false; - std::pair v; + pair v; BOOST_FOREACH(v, values_) { boost::optional expval = expected.gettry(v.first); - if(!expval || !::gtsam::equal(v.second, *expval, tol)) + if(!expval || !gtsam::equal(v.second, *expval, tol)) return false; } return true; @@ -38,7 +38,7 @@ namespace gtsam { template LieConfig expmap(const LieConfig& c, const VectorConfig& delta) { LieConfig newConfig; - std::string j; T pj; + string j; T pj; FOREACH_PAIR(j, pj, c.values_) { if (delta.contains(j)) { const Vector& dj = delta[j]; @@ -53,7 +53,7 @@ namespace gtsam { template LieConfig expmap(const LieConfig& c, const Vector& delta) { LieConfig newConfig; - std::pair value; + pair value; int delta_offset = 0; BOOST_FOREACH(value, c) { int cur_dim = dim(value.second); diff --git a/cpp/LieConfig.h b/cpp/LieConfig.h index 3583a3135..4483c1a1f 100644 --- a/cpp/LieConfig.h +++ b/cpp/LieConfig.h @@ -57,14 +57,14 @@ namespace gtsam { virtual ~LieConfig() {} /** Retrieve a variable by key, throws std::invalid_argument if not found */ - const T& get(std::string& key) const { + const T& get(const std::string& key) const { iterator it = values_.find(key); if (it == values_.end()) throw std::invalid_argument("invalid key"); else return it->second; } /** Retrieve a variable by key, returns nothing if not found */ - boost::optional gettry(std::string& key) const { + boost::optional gettry(const std::string& key) const { const_iterator it = values_.find(key); if (it == values_.end()) return boost::optional(); else return it->second;