Use the STL's make_unique if available

Fixes a build error with g++ 6.1

Fixes #3759
This commit is contained in:
ridiculousfish 2017-01-22 00:32:08 -08:00
parent 2e47817adf
commit 009a677e0d

View file

@ -644,11 +644,15 @@ wcstring vformat_string(const wchar_t *format, va_list va_orig);
void append_format(wcstring &str, const wchar_t *format, ...); void append_format(wcstring &str, const wchar_t *format, ...);
void append_formatv(wcstring &str, const wchar_t *format, va_list ap); void append_formatv(wcstring &str, const wchar_t *format, va_list ap);
#ifdef __cpp_lib_make_unique
using std::make_unique;
#else
/// make_unique implementation /// make_unique implementation
template<typename T, typename... Args> template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args) { std::unique_ptr<T> make_unique(Args&&... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
} }
#endif
/// This functions returns the end of the quoted substring beginning at \c in. The type of quoting /// This functions returns the end of the quoted substring beginning at \c in. The type of quoting
/// character is detemrined by examining \c in. Returns 0 on error. /// character is detemrined by examining \c in. Returns 0 on error.