1 // (C) Copyright 2008-10 Anthony Williams
2 // (C) Copyright 2011-2015 Vicente J. Botet Escriba
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_THREAD_FUTURES_WAIT_FOR_ALL_HPP
9 #define BOOST_THREAD_FUTURES_WAIT_FOR_ALL_HPP
11 #include <boost/thread/detail/config.hpp>
12 #include <boost/thread/futures/is_future_type.hpp>
14 #include <boost/core/enable_if.hpp>
18 template<typename Iterator>
19 typename boost::disable_if<is_future_type<Iterator>,void>::type wait_for_all(Iterator begin,Iterator end)
21 for(Iterator current=begin;current!=end;++current)
27 #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
28 template<typename F1,typename F2>
29 typename boost::enable_if<is_future_type<F1>,void>::type wait_for_all(F1& f1,F2& f2)
35 template<typename F1,typename F2,typename F3>
36 void wait_for_all(F1& f1,F2& f2,F3& f3)
43 template<typename F1,typename F2,typename F3,typename F4>
44 void wait_for_all(F1& f1,F2& f2,F3& f3,F4& f4)
52 template<typename F1,typename F2,typename F3,typename F4,typename F5>
53 void wait_for_all(F1& f1,F2& f2,F3& f3,F4& f4,F5& f5)
62 template<typename F1, typename... Fs>
63 typename boost::enable_if<is_future_type<F1>,void>::type wait_for_all(F1& f1, Fs&... fs)
65 bool dummy[] = { (f1.wait(), true), (fs.wait(), true)... };
67 // prevent unused parameter warning
70 #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)}