Alloc: make() now takes variadic arguments, to forward to the constructor
This commit is contained in:
parent
eef74e2897
commit
dd29156c85
@ -3,9 +3,9 @@
|
|||||||
#include <luna/Result.h>
|
#include <luna/Result.h>
|
||||||
#include <luna/SafeArithmetic.h>
|
#include <luna/SafeArithmetic.h>
|
||||||
|
|
||||||
template <typename T> Result<T*> make()
|
template <typename T, class... Args> Result<T*> make(Args... args)
|
||||||
{
|
{
|
||||||
T* const result = new T;
|
T* const result = new T(args...);
|
||||||
if (!result) return err(ENOMEM);
|
if (!result) return err(ENOMEM);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user