Hi,
I am (again) having issues with the Boost.Coroutines library. Aside from yet another new API, the coroutines no longer work with range based for. Even though the examples include range based for! With the following code
(taken directly from the documentation and added the includes and main):
#include <boost/coroutine/asymmetric_coroutine.hpp>
#include <iostream>
int main()
{
boost::coroutines::asymmetric_coroutine<int>::pull_type source(
[&](boost::coroutines::asymmetric_coroutine<int>::push_type& sink){
int first=1, second=1;
sink(first);
sink(second);
for(int i=0;i<8;++i){
int third=first+second;
first=second;
second=third;
sink(third);
}
}
);
for(auto i : source)
std::cout << i << " ";
}
I get this error:
D:\projects\combinators\coro_test.cpp: In function 'int main()':
D:\projects\combinators\coro_test.cpp:20:15: error: 'begin' was not declared in this scope
for(auto i : source)
^
D:\projects\combinators\coro_test.cpp:20:15: note: suggested alternatives:
In file included from D:\projects\combinators\coro_test.cpp:1:0:
D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/coroutine/asymmetric_coroutine.hpp:2255:1: note: 'std::begin'
begin( boost::coroutines::push_coroutine< R > & c)
^
In file included from D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/range/functions.hpp:18:0,
from D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/range.hpp:18,
from D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/coroutine/asymmetric_coroutine.hpp:17,
from D:\projects\combinators\coro_test.cpp:1:
D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/range/begin.hpp:106:61: note: 'boost::range_adl_barrier::begin'
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type begin( const T& r )
^
D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/range/begin.hpp:106:61: note: 'boost::range_adl_barrier::begin'
D:\projects\combinators\coro_test.cpp:20:15: error: 'end' was not declared in this scope
for(auto i : source)
^
D:\projects\combinators\coro_test.cpp:20:15: note: suggested alternatives:
In file included from D:\projects\combinators\coro_test.cpp:1:0:
D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/coroutine/asymmetric_coroutine.hpp:2260:1: note: 'std::end'
end( boost::coroutines::push_coroutine< R > & c)
^
In file included from D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/range/functions.hpp:19:0,
from D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/range.hpp:18,
from D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/coroutine/asymmetric_coroutine.hpp:17,
from D:\projects\combinators\coro_test.cpp:1:
D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/range/end.hpp:100:61: note: 'boost::range_adl_barrier::end'
inline BOOST_DEDUCED_TYPENAME range_iterator<const T>::type end( const T& r )
^
D:/libs/mingw-amd64/boost_1_56_0/include/boost-1_56/boost/range/end.hpp:100:61: note: 'boost::range_adl_barrier::end'
mingw32-make[2]: *** [CMakeFiles/coro-test.dir/coro_test.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles/coro-test.dir/all] Error 2
mingw32-make: *** [all] Error 2
For completeness sake: I am using MinGW-w64 with GCC 4.9.1 and the -std=c++11 flag
Regards,
Johannes S. Mueller-Roemer
--
Johannes S. Mueller-Roemer, MSc
Wiss. Mitarbeiter - Interactive Engineering Technologies (IET)
Fraunhofer-Institut für Graphische Datenverarbeitung IGD
Fraunhoferstr. 5 | 64283 Darmstadt | Germany
Tel +49 6151 155-606 | Fax +49 6151 155-139
johannes.mueller-roemer@igd.fraunhofer.de | www.igd.fraunhofer.de