最佳答案
I am trying to compile the following thread pool program posted on code review to test it.
https://codereview.stackexchange.com/questions/55100/platform-independant-thread-pool-v4
But I am getting the errors
threadpool.hpp: In member function ‘std::future<decltype (task((forward<Args>)(args)...))> threadpool::enqueue_task(Func&&, Args&& ...)’:
threadpool.hpp:94:28: error: ‘make_unique’ was not declared in this scope
auto package_ptr = make_unique<task_package_impl<R, decltype(bound_task)>> (std::move(bound_task), std::move(promise));
^
threadpool.hpp:94:81: error: expected primary-expression before ‘>’ token
auto package_ptr = make_unique<task_package_impl<R, decltype(bound_task)>>(std::move(bound_task), std::move(promise));
^
main.cpp: In function ‘int main()’:
main.cpp:9:17: error: ‘make_unique’ is not a member of ‘std’
auto ptr1 = std::make_unique<unsigned>();
^
main.cpp:9:34: error: expected primary-expression before ‘unsigned’
auto ptr1 = std::make_unique<unsigned>();
^
main.cpp:14:17: error: ‘make_unique’ is not a member of ‘std’
auto ptr2 = std::make_unique<unsigned>();
^
main.cpp:14:34: error: expected primary-expression before ‘unsigned’
auto ptr2 = std::make_unique<unsigned>();