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