This action will force synchronization from Gitee 极速下载/cpp-taskflow, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
// The example creates the following cyclic graph of one iterative loop://// A// |// v// B<---|// | |// v |// C----|// |// v// D//// - A is a task that initializes a counter to zero// - B is a task that increments the counter// - C is a condition task that loops with B until the counter// reaches a breaking number// - D is a task that finalizes the result#include <taskflow/taskflow.hpp>int main() {tf::Executor executor;tf::Taskflow taskflow("Conditional Tasking Demo");int counter;auto A = taskflow.emplace([&](){std::cout << "initializes the counter to zero\n";counter = 0;}).name("A");auto B = taskflow.emplace([&](){std::cout << "loops to increment the counter\n";counter++;}).name("B");auto C = taskflow.emplace([&](){std::cout << "counter is " << counter << " -> ";if(counter != 5) {std::cout << "loops again (goes to B)\n";return 0;}std::cout << "breaks the loop (goes to D)\n";return 1;}).name("C");auto D = taskflow.emplace([&](){std::cout << "done with counter equal to " << counter << '\n';}).name("D");A.precede(B);B.precede(C);C.precede(B);C.precede(D);// visualizes the taskflowtaskflow.dump(std::cout);// executes the taskflowexecutor.run(taskflow).wait();assert(counter == 5);return 0;}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。