Core/Common: Use the std make_unique instead of a custom one

This commit is contained in:
Naios
2017-12-08 04:01:58 +01:00
parent b4a42d1d06
commit ca023fd60a

View File

@@ -122,24 +122,7 @@ TC_COMMON_API LocaleConstant GetLocaleByName(std::string const& name);
namespace Trinity
{
//! std::make_unique implementation (TODO: remove this once C++14 is supported)
template<typename T, typename ...Args>
inline auto make_unique(Args&& ...args) ->
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template<typename T>
inline auto make_unique(std::size_t size) ->
typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0, std::unique_ptr<T>>::type
{
return std::unique_ptr<T>(new typename std::remove_extent<T>::type[size]());
}
template<typename T, typename... Args>
inline auto make_unique(Args&&...) ->
typename std::enable_if<std::extent<T>::value != 0, void>::type = delete;
using std::make_unique;
}
#endif