feat add make_unique
This commit is contained in:
parent
c4b8cb9649
commit
c43def9ae8
15
include/sled/make_unique.h
Normal file
15
include/sled/make_unique.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#ifndef SLED_MAKE_UNIQUE_H
|
||||||
|
#define SLED_MAKE_UNIQUE_H
|
||||||
|
#pragma once
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace sled {
|
||||||
|
template<typename T, typename... Args>
|
||||||
|
inline auto
|
||||||
|
MakeUnique(Args &&...args) -> std::unique_ptr<T>
|
||||||
|
{
|
||||||
|
return std::move(std::unique_ptr<T>(new T(std::forward<Args>(args)...)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}// namespace sled
|
||||||
|
#endif// SLED_MAKE_UNIQUE_H
|
@ -66,6 +66,7 @@
|
|||||||
#include "sled/byte_order.h"
|
#include "sled/byte_order.h"
|
||||||
#include "sled/cleanup.h"
|
#include "sled/cleanup.h"
|
||||||
#include "sled/make_ref_counted.h"
|
#include "sled/make_ref_counted.h"
|
||||||
|
#include "sled/make_unique.h"
|
||||||
#include "sled/operations_chain.h"
|
#include "sled/operations_chain.h"
|
||||||
#include "sled/optional.h"
|
#include "sled/optional.h"
|
||||||
#include "sled/random.h"
|
#include "sled/random.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user