Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11234: boost::asymmetric_coroutine doesn't compile when used with boost::range::algorithms
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-04-27 09:37:12
#11234: boost::asymmetric_coroutine doesn't compile when used with
boost::range::algorithms
-------------------------------+-----------------------
Reporter: kozlov.taras@⦠| Owner: olli
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: coroutine
Version: Boost 1.58.0 | Severity: Problem
Resolution: wontfix | Keywords:
-------------------------------+-----------------------
Comment (by kozlov.taras@â¦):
First of all boost coroutines and ranges can't be used together at the
moment. This is definitly a bug. And ok, probably it should be fixed in
Boost.Range
I want to clearify problem again. Using generator together with ANY non
mutating Boost.Range algorithm yields compiler error
Example
{{{
asymmetric_coroutine<int>::pull_type make_dummy_range()
{
return
asymmetric_coroutine<int>::pull_type([](asymmetric_coroutine<int>::push_type&
yield)
{
yield(1);
});
}
int _tmain(int argc, _TCHAR* argv[])
{
boost::for_each(make_dummy_range(), ...); //error
boost::max_element(make_dummy_range()); //error
boost::distance(make_dummy_range()); //error
boost::find(make_dummy_range(), 1); //error
}
}}}
I put this bug to boost.coroutines for two reasons.
1. It is known problem that SinglePassRange can't define perfect
const_iterator, but it is also common and convinient workaround to
override range_const_iterator to return mutable iterator. So any algorithm
which accept const Range& can work with it.
2. Coroutines in Boost 1.55 already provided const_iterator, so Boost 1.58
just broken some existing code.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11234#comment:2> 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:18 UTC