From 97f52c564311c6a933ec73341c3fe11f6791273d Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Thu, 7 Jun 2012 16:12:55 +0000 Subject: [PATCH] Cleaned up boost bind dependency --- gtsam/inference/FactorGraph-inl.h | 12 +++++++----- gtsam/linear/JacobianFactor.cpp | 12 ++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/gtsam/inference/FactorGraph-inl.h b/gtsam/inference/FactorGraph-inl.h index ea92cb791..3451b6ed4 100644 --- a/gtsam/inference/FactorGraph-inl.h +++ b/gtsam/inference/FactorGraph-inl.h @@ -27,14 +27,12 @@ #include #include #include -#include #include #include #include #include #include -#include using namespace std; @@ -103,11 +101,15 @@ namespace gtsam { /* ************************************************************************* */ template typename DERIVED::shared_ptr Combine(const FactorGraph& factors, - const FastMap >& variableSlots) { + const FastMap >& variableSlots) { + typedef const pair > KeySlotPair; + // Local functional for getting keys out of key-value pairs + struct Local { static KEY FirstOf(const KeySlotPair& pr) { return pr.first; } }; + return typename DERIVED::shared_ptr(new DERIVED( - boost::make_transform_iterator(variableSlots.begin(), boost::bind(&KeySlotPair::first, _1)), - boost::make_transform_iterator(variableSlots.end(), boost::bind(&KeySlotPair::first, _1)))); + boost::make_transform_iterator(variableSlots.begin(), &Local::FirstOf), + boost::make_transform_iterator(variableSlots.end(), &Local::FirstOf))); } /* ************************************************************************* */ diff --git a/gtsam/linear/JacobianFactor.cpp b/gtsam/linear/JacobianFactor.cpp index b4d7016aa..677900b01 100644 --- a/gtsam/linear/JacobianFactor.cpp +++ b/gtsam/linear/JacobianFactor.cpp @@ -29,15 +29,16 @@ #include #include #include -#include -#include +#include +//#include +//#include #include #include #include using namespace std; -using namespace boost::lambda; +//using namespace boost::lambda; namespace gtsam { @@ -163,7 +164,7 @@ namespace gtsam { size_t maxrank; try { maxrank = choleskyCareful(matrix_).first; - } catch(const CarefulCholeskyNegativeMatrixException& e) { + } catch(const CarefulCholeskyNegativeMatrixException&) { cout << "Attempting to convert a HessianFactor to a JacobianFactor, but for this\n" "HessianFactor it is not possible because either the Hessian is negative or\n" @@ -494,8 +495,7 @@ namespace gtsam { size_t>& varDims, size_t m) { keys_.resize(variableSlots.size()); std::transform(variableSlots.begin(), variableSlots.end(), begin(), - boost::bind(&VariableSlots::const_iterator::value_type::first, - boost::lambda::_1)); + boost::bind(&VariableSlots::const_iterator::value_type::first, _1)); varDims.push_back(1); Ab_.copyStructureFrom(BlockAb(matrix_, varDims.begin(), varDims.end(), m)); firstNonzeroBlocks_.resize(m);