Moved spdlog::make_unique to spdlog::details::make_unique and prevent T to be array

This commit is contained in:
gabime
2018-09-26 23:48:36 +03:00
parent e3a66473b2
commit e8dae26176
5 changed files with 47 additions and 43 deletions

View File

@@ -15,6 +15,7 @@
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <type_traits>
#if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
#include <codecvt>
@@ -168,16 +169,19 @@ using filename_t = std::string;
err_handler_("Unknown exeption in logger"); \
}
//
// make_unique support
//
namespace details {
// make_unique support for pre c++14
#if __cplusplus >= 201402L // C++14 and beyond
using std::make_unique;
#else
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args &&... args)
{
static_assert(!std::is_array<T>::value, "arrays to not supported" );
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif
} // namespace details
} // namespace spdlog