From 68f99d8c87e0466609331301ebe80b5c561479c5 Mon Sep 17 00:00:00 2001 From: Jakob Progsch Date: Thu, 25 Sep 2014 12:07:58 +0200 Subject: [PATCH] Use emplace_back() and for(a:b) loop. --- example.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/example.cpp b/example.cpp index 66d6ab7..837277b 100644 --- a/example.cpp +++ b/example.cpp @@ -11,7 +11,7 @@ int main() std::vector< std::future > results; for(int i = 0; i < 8; ++i) { - results.push_back( + results.emplace_back( pool.enqueue([i] { std::cout << "hello " << i << std::endl; std::this_thread::sleep_for(std::chrono::seconds(1)); @@ -19,10 +19,10 @@ int main() return i*i; }) ); - } - - for(size_t i = 0;i