From 3825e8cf2de8effb002d00f621480817b0fcab6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Traizet?= <cedric.traizet@c-s.fr>
Date: Fri, 16 Oct 2020 16:16:24 +0200
Subject: [PATCH] ENH: use std::equal in LUT operator == (code review)

---
 Modules/Core/Metadata/include/otbMetaDataKey.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/Modules/Core/Metadata/include/otbMetaDataKey.h b/Modules/Core/Metadata/include/otbMetaDataKey.h
index d4533fa777..df3ee36f57 100644
--- a/Modules/Core/Metadata/include/otbMetaDataKey.h
+++ b/Modules/Core/Metadata/include/otbMetaDataKey.h
@@ -276,12 +276,8 @@ public:
 template <unsigned int VDim>
 bool operator==(const LUT<VDim> & lhs, const LUT<VDim> & rhs)
 {
-  bool axisComparison = true;
-  for (unsigned int i = 0; i < VDim; i++)
-  {
-    axisComparison = axisComparison && lhs.Axis[i] == rhs.Axis[i];
-  }
-  return axisComparison && lhs.Array == rhs.Array;
+  return std::equal(std::begin(lhs.Array), std::end(lhs.Array), std::begin(rhs.Array) ) 
+          && lhs.Array == rhs.Array;
 }
 
 
-- 
GitLab