feat add make_unique
All checks were successful
linux-x64-gcc / linux-gcc (Release) (push) Successful in 1m25s
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 55s

This commit is contained in:
tqcq 2024-03-24 08:48:22 +08:00
parent c4b8cb9649
commit c43def9ae8
2 changed files with 16 additions and 0 deletions

View 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

View File

@ -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"