From 5f2f6dde134c2743de5fa344389a20625fafca53 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Thu, 8 Dec 2022 17:50:16 +0100 Subject: [PATCH] array<>::size should return constexpr expression This allows to size buffers at compile time (matches c++11 behavior). --- Firmware/mmu2_protocol_logic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firmware/mmu2_protocol_logic.h b/Firmware/mmu2_protocol_logic.h index f80310800..184f6f866 100644 --- a/Firmware/mmu2_protocol_logic.h +++ b/Firmware/mmu2_protocol_logic.h @@ -9,7 +9,7 @@ public: array() = default; inline constexpr T* begin()const { return data; } inline constexpr T* end()const { return data + N; } - constexpr uint8_t size()const { return N; } + static constexpr uint8_t size() { return N; } inline T &operator[](uint8_t i){ return data[i]; }