From f2e1761a4d4fd99b29bf66cb0c9a3942e17ec347 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Sun, 8 Jan 2017 09:38:37 +0100 Subject: [PATCH] fix example fibonacci --- doc/callcc.qbk | 4 ++-- example/callcc/fibonacci.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/callcc.qbk b/doc/callcc.qbk index 106144a..7f24924 100644 --- a/doc/callcc.qbk +++ b/doc/callcc.qbk @@ -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(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()`). diff --git a/example/callcc/fibonacci.cpp b/example/callcc/fibonacci.cpp index 752c268..388676c 100644 --- a/example/callcc/fibonacci.cpp +++ b/example/callcc/fibonacci.cpp @@ -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(c) << " "; + c=ctx::resume(std::move(c)); } std::cout << std::endl; std::cout << "main: done" << std::endl;