Add the nodiscard attribute to make and make_array
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2022-12-07 11:01:45 +01:00
parent dad95a8160
commit ee276a3a35
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -1,16 +1,14 @@
#pragma once
#include <luna/PlacementNew.h>
#include <luna/Result.h>
#include <luna/SafeArithmetic.h>
template <typename T, class... Args> Result<T*> make(Args... args)
template <typename T, class... Args> [[nodiscard]] Result<T*> make(Args... args)
{
T* const result = new T(args...);
if (!result) return err(ENOMEM);
return result;
}
template <typename T> Result<T*> make_array(usize count)
template <typename T> [[nodiscard]] Result<T*> make_array(usize count)
{
T* const result = new T[count];
if (!result) return err(ENOMEM);