Bitcoin full node and query server

Jun 30, 2018

View in context in the libbitcoin Slack #general mirror.

N
narodnik14:45
[x tmp]$ cat main.cpp 
#include <iostream>
#include <boost/coroutine2/all.hpp>

typedef boost::coroutines2::coroutine<int> coro_t;

int main()
{

    coro_t::pull_type source(
        [&](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);
            }
        });

    for (auto i: source)
        std::cout << i << " ";
    std::cout << std::endl;

    return 0;
}

[x tmp]$ g++ main.cpp -lboost_system -lboost_context -std=c++11
[x tmp]$ ./a.out 
1 1 2 3 5 8 13 21 34 55