From 95253a06808bd3b7f052be7668930a8ccff4b364 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Tue, 25 Jun 2024 15:46:56 +0200
Subject: [PATCH] [MeL] Reuse non-const impl. for const case

---
 MeshLib/Properties-impl.h | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/MeshLib/Properties-impl.h b/MeshLib/Properties-impl.h
index ae5f7351a0c..2746730ca64 100644
--- a/MeshLib/Properties-impl.h
+++ b/MeshLib/Properties-impl.h
@@ -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>
-- 
GitLab