restored use of internal::handle that was accidentally removed

release/4.3a0
dellaert 2016-04-10 19:01:42 -07:00
parent a3b66a94ea
commit b738171652
1 changed files with 2 additions and 8 deletions

View File

@ -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));
}
} }
/* ************************************************************************* */ /* ************************************************************************* */