diff --git a/listings/listing_9.2.cpp b/listings/listing_9.2.cpp index bb32073..801e672 100644 --- a/listings/listing_9.2.cpp +++ b/listings/listing_9.2.cpp @@ -21,17 +21,17 @@ class function_wrapper }; public: template - function_wrapper(F&& f): - impl(new impl_type(std::move(f))) + function_wrapper(F&& f) noexcept: + impl(std::make_unique>(std::move(f))) {} void call() { impl->call(); } - function_wrapper(function_wrapper&& other): + function_wrapper(function_wrapper&& other) noexcept: impl(std::move(other.impl)) {} - function_wrapper& operator=(function_wrapper&& other) + function_wrapper& operator=(function_wrapper&& other) noexcept { impl=std::move(other.impl); return *this; @@ -48,10 +48,10 @@ class thread_pool std::deque work_queue; template - std::future::type> + std::future> submit(FunctionType f) { - typedef typename std::result_of::type result_type; + typedef std::invoke_result_t result_type; std::packaged_task task(std::move(f)); std::future res(task.get_future());