From ee276a3a35ae1ba4181efc6d73ea27dd5f629658 Mon Sep 17 00:00:00 2001 From: apio Date: Wed, 7 Dec 2022 11:01:45 +0100 Subject: [PATCH] Add the nodiscard attribute to make and make_array --- luna/include/luna/Alloc.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/luna/include/luna/Alloc.h b/luna/include/luna/Alloc.h index fc89132f..ba8a0151 100644 --- a/luna/include/luna/Alloc.h +++ b/luna/include/luna/Alloc.h @@ -1,16 +1,14 @@ #pragma once -#include #include -#include -template Result make(Args... args) +template [[nodiscard]] Result make(Args... args) { T* const result = new T(args...); if (!result) return err(ENOMEM); return result; } -template Result make_array(usize count) +template [[nodiscard]] Result make_array(usize count) { T* const result = new T[count]; if (!result) return err(ENOMEM);