tf::Future
std::future< T >
taskflow/core/taskflow.hpp
typename T
class friend class Executor Executor Executor
class friend class Subflow Subflow Subflow
class friend class Runtime Runtime Runtime
std::weak_ptr< Topology > std::weak_ptr<Topology> tf::Future< T >::_topology _topology
tf::Future< T >::Future
()=default
Future

default constructor

tf::Future< T >::Future
(const Future &)=delete
Future
const Future &

disabled copy constructor

tf::Future< T >::Future
(Future &&)=default
Future
Future &&

default move constructor

Future & Future& tf::Future< T >::operator= (const Future &)=delete operator= const Future &

disabled copy assignment

Future & Future& tf::Future< T >::operator= (Future &&)=default operator= Future &&

default move assignment

bool bool tf::Future< T >::cancel () cancel

cancels the execution of the running taskflow associated with this future object

`true` if the execution can be cancelled or `false` if the execution has already completed

When you request a cancellation, the executor will stop scheduling any tasks onwards. Tasks that are already running will continue to finish (non-preemptive). You can call tf::Future::wait to wait for the cancellation to complete.
tf::Future< T >::Future
(std::future< T > &&, std::weak_ptr< Topology >=std::weak_ptr< Topology >())
Future
std::future< T > && f
std::weak_ptr< Topology > p std::weak_ptr< Topology >()

class to access the result of an execution

tf::Future is a derived class from std::future that will eventually hold the execution result of a submitted taskflow (tf::Executor::run) In addition to the base methods inherited from std::future, you can call tf::Future::cancel to cancel the execution of the running taskflow associated with this future object. The following example cancels a submission of a taskflow that contains 1000 tasks each running one second.

    tf::Executorexecutor;
    tf::Taskflowtaskflow;

    for(inti=0;i<1000;i++){
    taskflow.emplace([](){
    std::this_thread::sleep_for(std::chrono::seconds(1));
    });
    }

    //submitthetaskflow
    tf::Futurefu=executor.run(taskflow);

    //requesttocancelthesubmittedexecutionabove
    fu.cancel();

    //waituntilthecancellationfinishes
    fu.get();

std::future< T >
tf::Future< T >
std::future< T >
tf::Future< T >
- tf::Future
  _topology
- tf::Future
  cancel
- tf::Future
  Executor
- tf::Future
  Future
- tf::Future
  Future
- tf::Future
  Future
- tf::Future
  Future
- tf::Future
  operator=
- tf::Future
  operator=
- tf::Future
  Runtime
- tf::Future
  Subflow