mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Common: Use the std make_unique instead of a custom one
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user