1 #ifndef GENESIS_UTILS_THREADING_MULTI_FUTURE_H_
2 #define GENESIS_UTILS_THREADING_MULTI_FUTURE_H_
68 #include <type_traits>
116 futures_.push_back( std::move(future) );
124 for(
auto const& fut : futures_ ) {
125 if( ! fut.valid() ) {
138 template <typename U = T, typename std::enable_if<std::is_same<U, void>::value>::type* =
nullptr>
143 std::is_same<T, void>::value,
"Function is meant for T == void"
147 for(
size_t i = 0; i < futures_.size(); ++i ) {
160 template <typename U = T, typename std::enable_if< !std::is_same<U, void>::value>::type* =
nullptr>
165 ! std::is_same<T, void>::value,
"Function is meant for T != void"
169 std::vector<T> result( futures_.size() );
170 for(
size_t i = 0; i < futures_.size(); ++i ) {
171 result[i] = std::move( futures_[i].
get() );
181 for(
size_t i = 0; i < futures_.size(); ++i ) {
207 return futures_.size();
216 std::vector<ProactiveFuture<T>> futures_;
222 #endif // include guard