template<typename T>
Future class
class to access the result of task execution
Contents
tf::
tf::Executor executor; tf::Taskflow taskflow; for(int i=0; i<1000; i++) { taskflow.emplace([](){ std::this_thread::sleep_for(std::chrono::seconds(1)); }); } // submit the taskflow tf::Future fu = executor.run(taskflow); // request to cancel the submitted execution above fu.cancel(); // wait until the cancellation finishes fu.get();
Constructors, destructors, conversion operators
Public functions
Function documentation
#include <src/taskflow/core/taskflow.hpp>
template<typename T>
tf:: Future<T>:: Future() defaulted
default constructor
#include <src/taskflow/core/taskflow.hpp>
template<typename T>
tf:: Future<T>:: Future(const Future&) deleted
disabled copy constructor
#include <src/taskflow/core/taskflow.hpp>
template<typename T>
tf:: Future<T>:: Future(Future&&) defaulted
default move constructor
#include <src/taskflow/core/taskflow.hpp>
template<typename T>
Future& tf:: Future<T>:: operator=(const Future&) deleted
disabled copy assignment
#include <src/taskflow/core/taskflow.hpp>
template<typename T>
Future& tf:: Future<T>:: operator=(Future&&) defaulted
default move assignment
#include <src/taskflow/core/taskflow.hpp>
template<typename T>
bool tf:: Future<T>:: cancel()
cancels the execution of the running taskflow associated with this future object
Returns | true if the execution can be cancelled or false if the execution has already completed |
---|