Boost coroutine module.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
#include <boost/coroutine/coroutine.hpp>
Generate Fibonacci numbers using coroutines
#include <boost/coroutine/coroutine.hpp>
#include <iostream>
typedef boost::coroutines::coroutine<int()> coro_t;
void fibonacci(coro_t::push_type &sink) {
int first = 1, second = 1;
sink(first);
sink(second);
for (int i = 0; i < 8; ++i) {
int third = first + second;
first = second;
second = third;
sink(third);
}
}
int main() {
coro_t::pull_type source(fibonacci);
for (int i : source) {
std::cout << i << ' ';
}
return 0;
}
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Resources
No resource links recorded.