Cleaned up boost bind dependency

release/4.3a0
Richard Roberts 2012-06-07 16:12:55 +00:00
parent 288858d5f2
commit 97f52c5643
2 changed files with 13 additions and 11 deletions

View File

@ -27,14 +27,12 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/bind.hpp>
#include <boost/iterator/transform_iterator.hpp> #include <boost/iterator/transform_iterator.hpp>
#include <stdio.h> #include <stdio.h>
#include <list> #include <list>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
#include <functional>
using namespace std; using namespace std;
@ -104,10 +102,14 @@ namespace gtsam {
template<class DERIVED, class KEY> template<class DERIVED, class KEY>
typename DERIVED::shared_ptr Combine(const FactorGraph<DERIVED>& factors, typename DERIVED::shared_ptr Combine(const FactorGraph<DERIVED>& factors,
const FastMap<KEY, std::vector<KEY> >& variableSlots) { const FastMap<KEY, std::vector<KEY> >& variableSlots) {
typedef const pair<const KEY, std::vector<KEY> > KeySlotPair; typedef const pair<const KEY, std::vector<KEY> > 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( return typename DERIVED::shared_ptr(new DERIVED(
boost::make_transform_iterator(variableSlots.begin(), boost::bind(&KeySlotPair::first, _1)), boost::make_transform_iterator(variableSlots.begin(), &Local::FirstOf),
boost::make_transform_iterator(variableSlots.end(), boost::bind(&KeySlotPair::first, _1)))); boost::make_transform_iterator(variableSlots.end(), &Local::FirstOf)));
} }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -29,15 +29,16 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <boost/lambda/bind.hpp> #include <boost/bind.hpp>
#include <boost/lambda/lambda.hpp> //#include <boost/lambda/bind.hpp>
//#include <boost/lambda/lambda.hpp>
#include <cmath> #include <cmath>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
using namespace std; using namespace std;
using namespace boost::lambda; //using namespace boost::lambda;
namespace gtsam { namespace gtsam {
@ -163,7 +164,7 @@ namespace gtsam {
size_t maxrank; size_t maxrank;
try { try {
maxrank = choleskyCareful(matrix_).first; maxrank = choleskyCareful(matrix_).first;
} catch(const CarefulCholeskyNegativeMatrixException& e) { } catch(const CarefulCholeskyNegativeMatrixException&) {
cout << cout <<
"Attempting to convert a HessianFactor to a JacobianFactor, but for this\n" "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" "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) { size_t>& varDims, size_t m) {
keys_.resize(variableSlots.size()); keys_.resize(variableSlots.size());
std::transform(variableSlots.begin(), variableSlots.end(), begin(), std::transform(variableSlots.begin(), variableSlots.end(), begin(),
boost::bind(&VariableSlots::const_iterator::value_type::first, boost::bind(&VariableSlots::const_iterator::value_type::first, _1));
boost::lambda::_1));
varDims.push_back(1); varDims.push_back(1);
Ab_.copyStructureFrom(BlockAb(matrix_, varDims.begin(), varDims.end(), m)); Ab_.copyStructureFrom(BlockAb(matrix_, varDims.begin(), varDims.end(), m));
firstNonzeroBlocks_.resize(m); firstNonzeroBlocks_.resize(m);