[Boost-bugs] [Boost C++ Libraries] #8101: coroutine's iterator doesn't have postfix ++ operator

Subject: [Boost-bugs] [Boost C++ Libraries] #8101: coroutine's iterator doesn't have postfix ++ operator
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-02-18 22:59:01


#8101: coroutine's iterator doesn't have postfix ++ operator
-------------------------------------+--------------------------------------
 Reporter: nathanridge | Owner: olli
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: coroutine
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
-------------------------------------+--------------------------------------
 The following code fails to compile:

 {{{
 #include <iostream>
 #include <iterator>
 #include <boost/coroutine/coroutine.hpp>
 #include <boost/range/algorithm/copy.hpp>

 typedef boost::coroutines::coroutine<int()> coro_t;

 void foo(coro_t::caller_type& caller)
 {
     caller(0);
     caller(1);
     caller(2);
 }

 coro_t f()
 {
     return coro_t(&foo);
 }

 int main()
 {
     boost::copy(f(), std::ostream_iterator<int>(std::cout, "\n"));
 }
 }}}

 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.

 One way to write an iterator class that satisfies all the iterator
 interface requirements with minimal work is to use iterator_facade
 (http://www.boost.org/doc/libs/1_53_0/libs/iterator/doc/iterator_facade.html).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8101>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC