diff --git a/llama.cpp b/llama.cpp index 70f763fd5..dbda0f390 100644 --- a/llama.cpp +++ b/llama.cpp @@ -15,6 +15,17 @@ // TODO: move somewhere else #define QK 32 +// Define std::make_unique if it's not available +// (e.g. on C++11) +#ifndef __cpp_lib_make_unique +template +std::unique_ptr make_unique(Args&&... args) { + return std::unique_ptr(new T(std::forward(args)...)); +} +#else +using std::make_unique; +#endif + // determine number of model parts based on the dimension static const std::map LLAMA_N_PARTS = { { 4096, 1 }, @@ -106,7 +117,7 @@ struct llama_context model(std::move(model)), vocab(std::move(vocab)), params(params), - state(std::make_unique()) + state(make_unique()) { } ~llama_context(){