Add the nodiscard attribute to make and make_array
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
dad95a8160
commit
ee276a3a35
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user