diff --git a/alib2graph_data/src/grid/square/SquareGrid4.hpp b/alib2graph_data/src/grid/square/SquareGrid4.hpp
index 443e2483d36dec791837f13a7999164d85b8faff..a193f2a4a3c93fcad1485536e30fce34ff22c6b2 100644
--- a/alib2graph_data/src/grid/square/SquareGrid4.hpp
+++ b/alib2graph_data/src/grid/square/SquareGrid4.hpp
@@ -109,8 +109,8 @@ int SquareGrid4<TCoordinate, TEdge>::compare(const GridBase &other) const {
 template<typename TCoordinate, typename TEdge>
 int SquareGrid4<TCoordinate, TEdge>::compare(const SquareGrid4 &other) const {
   auto first = ext::tie(this->m_obstacles, this->m_height, this->m_width);
-  TCoordinate height = other.getHeight();
-  TCoordinate width = other.getWidth();
+  const TCoordinate height = other.getHeight();
+  const TCoordinate width = other.getWidth();
   auto second = ext::tie(other.getObstacleList(), height, width);
 
   static ext::compare<decltype(first)> comp;
diff --git a/alib2graph_data/src/grid/square/SquareGrid8.hpp b/alib2graph_data/src/grid/square/SquareGrid8.hpp
index 4f809c3547cb0001c0881bfc20ec719a4d18bd85..90bd0752f23656655a526b8a70c6de9384408773 100644
--- a/alib2graph_data/src/grid/square/SquareGrid8.hpp
+++ b/alib2graph_data/src/grid/square/SquareGrid8.hpp
@@ -101,8 +101,8 @@ int SquareGrid8<TCoordinate, TEdge>::compare(const GridBase &other) const {
 template<typename TCoordinate, typename TEdge>
 int SquareGrid8<TCoordinate, TEdge>::compare(const SquareGrid8 &other) const {
   auto first = ext::tie(this->m_obstacles, this->m_height, this->m_width);
-  TCoordinate height = other.getHeight();
-  TCoordinate width = other.getWidth();
+  const TCoordinate height = other.getHeight();
+  const TCoordinate width = other.getWidth();
   auto second = ext::tie(other.getObstacleList(), height, width);
 
   static ext::compare<decltype(first)> comp;
diff --git a/alib2graph_data/src/grid/square/WeightedSquareGrid4.hpp b/alib2graph_data/src/grid/square/WeightedSquareGrid4.hpp
index 7c9906e322d40ef5bdb99f15ff59017bfbd8cd23..22ea411da3983cced9cdb95ba1787947fc0b14f1 100644
--- a/alib2graph_data/src/grid/square/WeightedSquareGrid4.hpp
+++ b/alib2graph_data/src/grid/square/WeightedSquareGrid4.hpp
@@ -133,8 +133,8 @@ int WeightedSquareGrid4<TCoordinate, TEdge>::compare(const GridBase &other) cons
 template<typename TCoordinate, typename TEdge>
 int WeightedSquareGrid4<TCoordinate, TEdge>::compare(const WeightedSquareGrid4 &other) const {
   auto first = ext::tie(this->m_obstacles, this->m_height, this->m_width);
-  TCoordinate height = other.getHeight();
-  TCoordinate width = other.getWidth();
+  const TCoordinate height = other.getHeight();
+  const TCoordinate width = other.getWidth();
   auto second = ext::tie(other.getObstacleList(), height, width);
 
   static ext::compare<decltype(first)> comp;
diff --git a/alib2graph_data/src/grid/square/WeightedSquareGrid8.hpp b/alib2graph_data/src/grid/square/WeightedSquareGrid8.hpp
index 5a63aca7ec1a9e077d52d7b42041bd847cd4d557..a93bdb610daaa2fbfdd8218616d3ca540b1f3e93 100644
--- a/alib2graph_data/src/grid/square/WeightedSquareGrid8.hpp
+++ b/alib2graph_data/src/grid/square/WeightedSquareGrid8.hpp
@@ -133,8 +133,8 @@ int WeightedSquareGrid8<TCoordinate, TEdge>::compare(const GridBase &other) cons
 template<typename TCoordinate, typename TEdge>
 int WeightedSquareGrid8<TCoordinate, TEdge>::compare(const WeightedSquareGrid8 &other) const {
   auto first = ext::tie(this->m_obstacles, this->m_height, this->m_width);
-  TCoordinate height = other.getHeight();
-  TCoordinate width = other.getWidth();
+  const TCoordinate height = other.getHeight();
+  const TCoordinate width = other.getWidth();
   auto second = ext::tie(other.getObstacleList(), height, width);
 
   static ext::compare<decltype(first)> comp;