From 3a30fc8909e14feaa3f03119b24fa44cb02e0004 Mon Sep 17 00:00:00 2001 From: "Jayesh Badwaik (FZ Juelich)" <j.badwaik@fz-juelich.de> Date: Sun, 4 Jun 2023 15:31:29 +0200 Subject: [PATCH] - nola::static_array : define the comparison operator --- src/cpp/include/nola/static_array.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/cpp/include/nola/static_array.hpp b/src/cpp/include/nola/static_array.hpp index a771f4b..80eddbd 100644 --- a/src/cpp/include/nola/static_array.hpp +++ b/src/cpp/include/nola/static_array.hpp @@ -77,6 +77,18 @@ constexpr auto to_static_array(Args&&... args) -> nola::static_array<T, sizeof.. return {{std::forward<Args>(args)...}}; } +template <typename T, std::size_t N> +NOLA_HOST_DEVICE +constexpr auto operator==(static_array<T, N> const& a, static_array<T, N> const& b) -> bool +{ + for (std::size_t i = 0; i < N; ++i) { + if (a[i] != b[i]) { + return false; + } + } + return true; +} + // ------------------------------------------------------------------------------------------------- // Implementation // ------------------------------------------------------------------------------------------------- -- GitLab