Fixed TBB detection and make emplace great again
parent
23617fd430
commit
0675b82c1f
|
@ -42,6 +42,9 @@
|
|||
// Whether we are using TBB (if TBB was found and GTSAM_WITH_TBB is enabled in CMake)
|
||||
#cmakedefine GTSAM_USE_TBB
|
||||
|
||||
// Whether we are using a TBB version higher than 2020
|
||||
#cmakedefine TBB_GREATER_EQUAL_2020
|
||||
|
||||
// Whether we are using system-Eigen or our own patched version
|
||||
#cmakedefine GTSAM_USE_SYSTEM_EIGEN
|
||||
|
||||
|
|
|
@ -179,11 +179,12 @@ 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) {
|
||||
template<class... Args>
|
||||
inline std::pair<VectorValues::iterator, bool> emplace(Key j, Args&&... args) {
|
||||
#if ! defined(GTSAM_USE_TBB) || defined (TBB_GREATER_EQUAL_2020)
|
||||
return values_.emplace(j, value);
|
||||
return values_.emplace(j, std::forward<Args>(args)...);
|
||||
#else
|
||||
return values_.insert(std::make_pair(j, value));
|
||||
return values_.insert(std::make_pair(j, Vector(std::forward<Args>(args)...)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue