Skip to content

Commit

Permalink
[MeL] Reuse non-const impl. for const case
Browse files Browse the repository at this point in the history
  • Loading branch information
endJunction committed Jun 25, 2024
1 parent e0fcde4 commit 95253a0
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions MeshLib/Properties-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,8 @@ template <typename T>
PropertyVector<T> const* Properties::getPropertyVector(
std::string_view name) const
{
auto it(_properties.find(std::string(name)));
if (it == _properties.end())
{
OGS_FATAL("The PropertyVector '{:s}' is not available in the mesh.",
name);
}
if (!dynamic_cast<PropertyVector<T> const*>(it->second))
{
OGS_FATAL(
"The PropertyVector '{:s}' has a different type than the requested "
"PropertyVector.",
name);
}
return dynamic_cast<PropertyVector<T> const*>(it->second);
return const_cast<PropertyVector<T> const*>(
const_cast<Properties*>(this)->getPropertyVector<T>(name));
}

template <typename T>
Expand Down

0 comments on commit 95253a0

Please sign in to comment.