id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 8023,Error using iterator traits with coroutine iterator,Nathan Ridge,olli,"I am getting compiler errors when using std::iterator_traits with a coroutine's iterator type: {{{ #include #include typedef boost::coroutines::coroutine coroutine_type; typedef std::iterator_traits::pointer pointer; }}} The errors are (with gcc 4.7.2): {{{ In file included from boost/boost/coroutine/coroutine.hpp:31:0, from test.cpp:1: boost/boost/coroutine/detail/coroutine_op.hpp: In instantiation of 'class boost::coroutines::detail::coroutine_op, int, 0>::iterator': c++/bits/stl_iterator_base_types.h:143:1: recursively required from 'constexpr const bool std::__has_iterator_category_helper, int, 0>::iterator>::value' c++/bits/stl_iterator_base_types.h:143:1: required from 'struct std::__has_iterator_category, int, 0>::iterator>' c++/bits/stl_iterator_base_types.h:160:12: required from 'struct std::iterator_traits, int, 0>::iterator>' test.cpp:5:55: required from here boost/boost/coroutine/detail/coroutine_op.hpp:84:73: error: no type named 'pointer' in 'struct std::iterator_traits, int, 0>::iterator>' boost/boost/coroutine/detail/coroutine_op.hpp:85:73: error: no type named 'reference' in 'struct std::iterator_traits, int, 0>::iterator>' }}} The problem is the following typedefs in the iterator class: {{{ typedef typename std::iterator_traits< iterator >::pointer pointer_t; typedef typename std::iterator_traits< iterator >::reference reference_t; }}} If the iterator class is instantiated in the context of instantiating iterator_traits, as is the case in my example code, these typedefs cause a recursive instantiation of iterator_traits. In the recursive instantiation, 'iterator' is incomplete, and thus does not have the required members. A solution is to express the underlying type of these typedefs more directly, for example: {{{ typedef typename iterator::pointer pointer_t; typedef typename iterator::reference reference_t; }}} The coroutine's const_iterator has a similar problem. Attached is a patch with the above fix. ",Bugs,closed,To Be Determined,coroutine,Boost Development Trunk,Problem,fixed,,