Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-08-22 05:02:50


Francois Barel skrev:
> Hi list,
>
> boost::iterator_range currently contains both 'iterator' and
> 'reference' typedefs, and yet only a 'const_iterator' one (no
> 'const_reference').
>
>
> This can be a problem with Spirit actions (compilation errors, see
> trac ticket #2234 - http://svn.boost.org/trac/boost/ticket/2234).
> After removing Spirit code, it boils down to:
>
> ////////////////////
> #include <boost/spirit/include/phoenix_stl.hpp>
> #include <boost/range/iterator_range.hpp>
>
> int main()
> {
> typedef const boost::iterator_range< const char* > cir;
> boost::phoenix::stl::front::result< cir > foo; // compilation error
> return 0;
> }
> ////////////////////
>
> The problem comes from the instantiation of
> boost::phoenix::stl::front::result< const iterator_range<...> >
> which, since its template argument is const, accesses its
> const_reference typedef -- which doesn't exist in iterator_range.
>
>
> Does it make sense / is it possible to add a const_reference typedef
> in iterator_range?

I guess it possible, and sub-range already has the const_reference
typedef. There might also be some minor tweaks to better support
iterators that return proxies or by value for operator*().

I'll look into it.

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk