From 6dbe2ca8b8d65de3c8840d4dc96e94be227e89d4 Mon Sep 17 00:00:00 2001
From: cmoineau <cyril.moineau@cea.fr>
Date: Tue, 19 Sep 2023 06:18:40 +0000
Subject: [PATCH] Update fix #8 by removing the assumption that size_t is
 unsigned.

---
 include/aidge/utils/Parameter.hpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/aidge/utils/Parameter.hpp b/include/aidge/utils/Parameter.hpp
index 092194083..7066db635 100644
--- a/include/aidge/utils/Parameter.hpp
+++ b/include/aidge/utils/Parameter.hpp
@@ -140,10 +140,10 @@ public:
     }
 
     template <typename R, std::size_t SIZE = std::tuple_size<std::tuple<T...>>::value-1>
-    constexpr typename std::enable_if<(SIZE < std::numeric_limits<std::size_t>::max()), R&>::type get(std::size_t i) {
-        if (i == SIZE) {
-            if (std::is_same<R, typename std::tuple_element<SIZE,std::tuple<T...>>::type>::value) {
-                return reinterpret_cast<R&>(std::get<SIZE>(mParams));
+    constexpr typename std::enable_if<(SIZE > 0), R&>::type get(std::size_t i) {
+        if (i == SIZE-1) {
+            if (std::is_same<R, typename std::tuple_element<SIZE-1,std::tuple<T...>>::type>::value) {
+                return reinterpret_cast<R&>(std::get<SIZE-1>(mParams));
             }
             else {
                 assert(false && "wrong parameter type");
@@ -155,7 +155,7 @@ public:
     }
 
     template <typename R, std::size_t SIZE = std::tuple_size<std::tuple<T...>>::value-1>
-    constexpr typename std::enable_if<(SIZE == std::numeric_limits<std::size_t>::max()), R&>::type get(std::size_t /*i*/) {
+    constexpr typename std::enable_if<(SIZE == 0), R&>::type get(std::size_t /*i*/) {
         assert(false && "parameter not found");
     }
 
-- 
GitLab