restored use of internal::handle that was accidentally removed
parent
a3b66a94ea
commit
b738171652
|
@ -274,6 +274,7 @@ namespace gtsam {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
// Check the type and throw exception if incorrect
|
// Check the type and throw exception if incorrect
|
||||||
|
// Generic version, partially specialized below for various Eigen Matrix types
|
||||||
template<typename ValueType>
|
template<typename ValueType>
|
||||||
struct handle {
|
struct handle {
|
||||||
ValueType operator()(Key j, const gtsam::Value * const pointer) {
|
ValueType operator()(Key j, const gtsam::Value * const pointer) {
|
||||||
|
@ -375,14 +376,7 @@ namespace gtsam {
|
||||||
throw ValuesKeyDoesNotExist("at", j);
|
throw ValuesKeyDoesNotExist("at", j);
|
||||||
|
|
||||||
// Check the type and throw exception if incorrect
|
// Check the type and throw exception if incorrect
|
||||||
const Value& value = *item->second;
|
return internal::handle<ValueType>()(j,item->second);
|
||||||
try {
|
|
||||||
return dynamic_cast<const GenericValue<ValueType>&>(value).value();
|
|
||||||
} catch (std::bad_cast &) {
|
|
||||||
// NOTE(abe): clang warns about potential side effects if done in typeid
|
|
||||||
const Value* value = item->second;
|
|
||||||
throw ValuesIncorrectType(j, typeid(*value), typeid(ValueType));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
Loading…
Reference in New Issue