// Copyright Nat Goodspeed 2013. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include struct FinalEOL{ ~FinalEOL(){ std::cout << std::endl; } }; int main(int argc,char* argv[]){ using std::begin; using std::end; std::vector words{ "peas", "porridge", "hot", "peas", "porridge", "cold", "peas", "porridge", "in", "the", "pot", "nine", "days", "old" }; int num=5,width=15; boost::coroutines2::coroutine::push_type writer( [&](boost::coroutines2::coroutine::pull_type& in){ // finish the last line when we leave by whatever means FinalEOL eol; // pull values from upstream, lay them out 'num' to a line for (;;){ for(int i=0;i