1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Hadrons: lattice dynamic cast fix

This commit is contained in:
Antonin Portelli 2016-05-10 10:41:20 +01:00
parent 9e986654e6
commit 7dfdc9baa0

View File

@ -149,11 +149,11 @@ T * Environment::get(const std::string name) const
{ {
if (hasLattice(name)) if (hasLattice(name))
{ {
try if (auto pt = dynamic_cast<T *>(lattice_.at(name).get()))
{ {
return dynamic_cast<T *>(lattice_.at(name).get()); return pt;
} }
catch (std::bad_cast &) else
{ {
HADRON_ERROR("object '" + name + "' does not have type " HADRON_ERROR("object '" + name + "' does not have type "
+ typeid(T *).name() + "(object type: " + typeid(T *).name() + "(object type: "