Opened 9 years ago

Closed 9 years ago

#9760 closed Bugs (fixed)

coroutine's iterators don't have == operator with const qualifier

Reported by: Masahiro Nawata <kamo.tanabota@…> Owned by: olli
Milestone: To Be Determined Component: coroutine
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

coroutine's iterators don't have operator== with const qualifier. Therefore, the following code fails to compile:

#include <boost/coroutine/v2/coroutine.hpp>
#include <boost/range/adaptor/filtered.hpp>
#include <boost/range/iterator_range.hpp>
#include <iostream>

int main()
{
	using namespace boost;
	coroutines::coroutine<int>::pull_type c([](coroutines::coroutine<int>::push_type& yield) {
		for (int i = 0; i < 5; ++i) {
			yield(i);
		}
	});
	auto crange = make_iterator_range(begin(c), end(c));
	for (auto n : crange
            | adaptors::filtered([](int n){return n % 2 == 0;})) // the filtered adaptor needs const operator==.
        {
		std::cout << n << std::endl;
	}
}

In addition, the iterators don't also have const operator!=.

Change History (1)

comment:1 by olli, 9 years ago

Resolution: fixed
Status: newclosed

fixed, thx

Note: See TracTickets for help on using tickets.