Boost C++ Libraries: Ticket #8101: coroutine's iterator doesn't have postfix ++ operator https://svn.boost.org/trac10/ticket/8101 <p> The following code fails to compile: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;iterator&gt; #include &lt;boost/coroutine/coroutine.hpp&gt; #include &lt;boost/range/algorithm/copy.hpp&gt; typedef boost::coroutines::coroutine&lt;int()&gt; coro_t; void foo(coro_t::caller_type&amp; caller) { caller(0); caller(1); caller(2); } coro_t f() { return coro_t(&amp;foo); } int main() { boost::copy(f(), std::ostream_iterator&lt;int&gt;(std::cout, "\n")); } </pre><p> The reason is that std::copy (which is called by boost::copy) uses the postfix version of the iterator's increment operator, but the coroutine's iterator only provides the prefix version. </p> <p> One way to write an iterator class that satisfies all the iterator interface requirements with minimal work is to use iterator_facade (<a href="http://www.boost.org/doc/libs/1_53_0/libs/iterator/doc/iterator_facade.html">http://www.boost.org/doc/libs/1_53_0/libs/iterator/doc/iterator_facade.html</a>). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8101 Trac 1.4.3 olli Wed, 20 Feb 2013 15:54:46 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8101#comment:1 https://svn.boost.org/trac10/ticket/8101#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> fixed for input-iterators only </p> Ticket