(in branch) Fixed some compile errors

release/4.3a0
Richard Roberts 2012-01-26 06:04:55 +00:00
parent f76c7be5b2
commit a7a845a803
2 changed files with 10 additions and 9 deletions

View File

@ -96,7 +96,7 @@ namespace gtsam {
/* ************************************************************************* */ /* ************************************************************************* */
template<class ValueType> template<class ValueType>
void DynamicValues::insert(const Symbol& j, const ValueType& val) { void DynamicValues::insert(const Symbol& j, const ValueType& val) {
std::pair<iterator,bool> insertResult = values_.insert(make_pair(j, ValuePtr(new ValueType(val)))); std::pair<iterator,bool> insertResult = values_.insert(make_pair(j, new ValueType(val)));
if(!insertResult.second) if(!insertResult.second)
throw DynamicValuesKeyAlreadyExists(j); throw DynamicValuesKeyAlreadyExists(j);
} }

View File

@ -27,6 +27,7 @@
#include <list> #include <list>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/bind.hpp>
#include <boost/iterator/transform_iterator.hpp> #include <boost/iterator/transform_iterator.hpp>
using namespace std; using namespace std;
@ -79,7 +80,7 @@ namespace gtsam {
BOOST_FOREACH(const KeyValuePair& key_value, values_) { BOOST_FOREACH(const KeyValuePair& key_value, values_) {
const SubVector& singleDelta = delta[ordering[key_value.first]]; // Delta for this value const SubVector& singleDelta = delta[ordering[key_value.first]]; // Delta for this value
ValuePtr retractedValue(key_value.second->retract_(singleDelta)); // Retract ValuePtr retractedValue(key_value.second->retract_(singleDelta)); // Retract
result.values_.insert(make_pair(key_value.first, retractedValue)); // Add retracted result directly to result values result.values_[key_value.first] = retractedValue; // Add retracted result directly to result values
} }
return result; return result;
@ -105,8 +106,8 @@ namespace gtsam {
/* ************************************************************************* */ /* ************************************************************************* */
void DynamicValues::insert(const DynamicValues& values) { void DynamicValues::insert(const DynamicValues& values) {
BOOST_FOREACH(const KeyValuePair& key_value, values) { BOOST_FOREACH(const KeyValuePair& key_value, values.values_) {
insert(key_value.first, key_value.second); values_.insert(make_pair(key_value.first, key_value.second->clone_()));
} }
} }
@ -128,8 +129,8 @@ namespace gtsam {
/* ************************************************************************* */ /* ************************************************************************* */
FastList<Symbol> DynamicValues::keys() const { FastList<Symbol> DynamicValues::keys() const {
return FastList<Symbol>( return FastList<Symbol>(
boost::make_transform_iterator(values_.begin(), &KeyValuePair::first), boost::make_transform_iterator(values_.begin(), boost::bind(&KeyValuePair::first, _1)),
boost::make_transform_iterator(values_.end(), &KeyValuePair::first)); boost::make_transform_iterator(values_.end(), boost::bind(&KeyValuePair::first, _1)));
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -145,14 +146,14 @@ namespace gtsam {
// Transform with Value::dim(auto_ptr::get(KeyValuePair::second)) // Transform with Value::dim(auto_ptr::get(KeyValuePair::second))
result.assign( result.assign(
boost::make_transform_iterator(values_.begin(), boost::make_transform_iterator(values_.begin(),
boost::bind(&Value::dim, boost::bind(&ValuePtr::get, boost::bind(&KeyValuePair::second)))), boost::bind(&Value::dim, boost::bind(&ValuePtr::get, boost::bind(&KeyValuePair::second, _1)))),
boost::make_transform_iterator(values_.begin(), boost::make_transform_iterator(values_.begin(),
boost::bind(&Value::dim, boost::bind(&ValuePtr::get, boost::bind(&KeyValuePair::second))))); boost::bind(&Value::dim, boost::bind(&ValuePtr::get, boost::bind(&KeyValuePair::second, _1)))));
return result; return result;
} }
/* ************************************************************************* */ /* ************************************************************************* */
Ordering::shared_ptr DynamicValues::orderingArbitrary(Index firstVar = 0) const { Ordering::shared_ptr DynamicValues::orderingArbitrary(Index firstVar) const {
Ordering::shared_ptr ordering(new Ordering); Ordering::shared_ptr ordering(new Ordering);
BOOST_FOREACH(const KeyValuePair& key_value, values_) { BOOST_FOREACH(const KeyValuePair& key_value, values_) {
ordering->insert(key_value.first, firstVar++); ordering->insert(key_value.first, firstVar++);