future.h
Go to the documentation of this file.
1 //
2 // Created by Eduard Valeyev on 7/10/18.
3 //
4 
5 #ifndef TTG_FUTURE_H
6 #define TTG_FUTURE_H
7 
8 #include <future>
9 
10 namespace ttg {
11 
12 template<typename T>
13 bool has_value(std::future<T> const& f)
14 { return f.wait_for(std::chrono::seconds(0)) == std::future_status::ready; }
15 
16 template<typename T>
17 bool has_value(std::shared_future<T> const& f)
18 { return f.wait_for(std::chrono::seconds(0)) == std::future_status::ready; }
19 
20 }
21 
22 #endif //TTG_FUTURE_H
top-level TTG namespace contains runtime-neutral functionality
Definition: keymap.h:8
bool has_value(std::future< T > const &f)
Definition: future.h:13