2
0
mirror of https://github.com/boostorg/context.git synced 2026-01-19 04:02:17 +00:00

fix example fibonacci

This commit is contained in:
Oliver Kowalke
2017-01-08 09:38:37 +01:00
parent e847c37d43
commit f2e1761a4d
2 changed files with 3 additions and 3 deletions

View File

@@ -86,12 +86,12 @@ A contiunation is continued by appling to function `resume()`.
return std::move(sink);
});
for (int j=0;j<10;++j) {
source=ctx::resume(std::move(source));
std::cout << ctx::transfer_data<int>(source) << " ";
source=ctx::resume(std::move(source));
}
output:
1 1 2 3 5 8 13 21 34 55
0 1 1 2 3 5 8 13 21 34 55
This simple example demonstrates the basic usage of __callcc__ as a generator.
The continuation `sink` represents the ['main]-continuation (function `main()`).

View File

@@ -26,8 +26,8 @@ int main() {
return std::move( c);
});
for ( int j = 0; j < 10; ++j) {
c=ctx::resume(std::move(c));
std::cout << ctx::transfer_data<int>(c) << " ";
c=ctx::resume(std::move(c));
}
std::cout << std::endl;
std::cout << "main: done" << std::endl;