Move to header

release/4.3a0
Fan Jiang 2020-06-02 19:44:44 -04:00
parent 5bf8dc4174
commit 23617fd430
3 changed files with 9 additions and 13 deletions

View File

@ -96,16 +96,6 @@ namespace gtsam {
return result.first;
}
/* ************************************************************************* */
std::pair<VectorValues::iterator, bool> VectorValues::emplace(Key j, const Vector& value) {
#ifdef TBB_GREATER_EQUAL_2020
std::pair<iterator, bool> result = values_.emplace(j, value);
#else
std::pair<iterator, bool> result = values_.insert(std::make_pair(j, value));
#endif
return result;
}
/* ************************************************************************* */
void VectorValues::update(const VectorValues& values)
{

View File

@ -179,7 +179,13 @@ namespace gtsam {
* j is already used.
* @param value The vector to be inserted.
* @param j The index with which the value will be associated. */
std::pair<VectorValues::iterator, bool> emplace(Key j, const Vector& value);
std::pair<VectorValues::iterator, bool> emplace(Key j, const Vector& value) {
#if ! defined(GTSAM_USE_TBB) || defined (TBB_GREATER_EQUAL_2020)
return values_.emplace(j, value);
#else
return values_.insert(std::make_pair(j, value));
#endif
}
/** Insert a vector \c value with key \c j. Throws an invalid_argument exception if the key \c
* j is already used.
@ -197,7 +203,7 @@ namespace gtsam {
* and an iterator to the existing value is returned, along with 'false'. If the value did not
* exist, it is inserted and an iterator pointing to the new element, along with 'true', is
* returned. */
std::pair<iterator, bool> tryInsert(Key j, const Vector& value) {
inline std::pair<iterator, bool> tryInsert(Key j, const Vector& value) {
#ifdef TBB_GREATER_EQUAL_2020
return values_.emplace(j, value);
#else

View File

@ -103,7 +103,7 @@ namespace gtsam
throw std::invalid_argument(
"Requested to emplace variable '" + DefaultKeyFormatter(*frontal)
+ "' already in this VectorValues.");
VectorValues::const_iterator r = result.first;
myData.cliqueResults.emplace(r->first, r);
vectorPosition += c.getDim(frontal);