Check type of CONTAINER constructor tparam
This is a byproduct of the overload resolution problem when N=1, then it can be hard to differentiate between: NoiseModelFactorN(noise, key) NoiseModelFactorN(noise, {key})release/4.3a0
parent
b24511fb18
commit
e8ddbbebff
|
@ -352,7 +352,12 @@ class NoiseModelFactorN : public NoiseModelFactor {
|
||||||
* @param noiseModel Shared pointer to noise model.
|
* @param noiseModel Shared pointer to noise model.
|
||||||
* @param keys A container of keys for the variables in this factor.
|
* @param keys A container of keys for the variables in this factor.
|
||||||
*/
|
*/
|
||||||
template <typename CONTAINER = std::initializer_list<Key>>
|
template <typename CONTAINER = std::initializer_list<Key>,
|
||||||
|
// check that CONTAINER is a container of Keys:
|
||||||
|
typename T = typename std::decay<
|
||||||
|
decltype(*std::declval<CONTAINER>().begin())>::type,
|
||||||
|
typename std::enable_if<std::is_convertible<T, Key>::value,
|
||||||
|
bool>::type = true>
|
||||||
NoiseModelFactorN(const SharedNoiseModel& noiseModel, CONTAINER keys)
|
NoiseModelFactorN(const SharedNoiseModel& noiseModel, CONTAINER keys)
|
||||||
: Base(noiseModel, keys) {
|
: Base(noiseModel, keys) {
|
||||||
assert(keys.size() == N);
|
assert(keys.size() == N);
|
||||||
|
|
|
@ -376,6 +376,7 @@ TEST(NonlinearFactor, NoiseModelFactor1) {
|
||||||
// Test constructors
|
// Test constructors
|
||||||
TestFactor1 tf2(noiseModel::Unit::Create(1), L(1));
|
TestFactor1 tf2(noiseModel::Unit::Create(1), L(1));
|
||||||
TestFactor1 tf3(noiseModel::Unit::Create(1), {L(1)});
|
TestFactor1 tf3(noiseModel::Unit::Create(1), {L(1)});
|
||||||
|
TestFactor1 tf4(noiseModel::Unit::Create(1), gtsam::Symbol('L', 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
Loading…
Reference in New Issue