Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Ranges 2.0 algorithms accepting a const reference
From: Stefano (pelux_at_[hidden])
Date: 2010-07-11 12:37:35


 
> You are entirely correct. The reverse function is missing the const overload,
and this will cause a problem when returning a temporary to a constant range
that has mutable elements. A workaround, which I expect you have already thought
of, would be to hold a const reference to the range in a variable and pass this
into reverse.I shall put a correction into the trunk as soon as possible. I
shall also review all of the algorithm functions for similar mistakes.I
apologize for my oversight and for any inconvenience this has caused. 

No need to apologize really, thank you for your work :)
I was just wondering whether I missed some fancy boost preprocessor programming
that would automatically add the const reference versions.
And in my case no inconvenience caused because, among other things, it is the
case that visual studio is usually happy to take references to temporaries...

> This is deliberately in contrast. The iterator_range class wraps an iterator
to model a Range Concept. The sub_range wraps a Range, or Container while
preserving const-ness of the underlying Range.

Yes that makes sense, I just did not get this immediately by reading the
documentation. It is easy to get confused because constness for containers and
iterators mean different things, and in a sense here we are mixing them a bit.

Thank you again for your kind reply.

Regards
 

>
>
> Regards,Neil Groves
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users <at> lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net