[phobos] is*Range + Qualified Types
Brad Roberts
braddr at puremagic.com
Wed Aug 11 22:50:43 PDT 2010
On Thu, 12 Aug 2010, Shin Fujishiro wrote:
> David Simcha <dsimcha at gmail.com> wrote:
> > I'm looking to go on a major debugging spree and make std.range work
> > with const ranges. For example, the following should work:
> >
> > import std.range, std.algorithm;
> >
> > void main() {
> > const foo = map!"a ^^ 2"([1,2,3,4,5]);
> > auto myRetro = retro(foo);
> > }
>
> Could you elaborate why?
>
> Ranges with const elements must be common; but what's the point of
> const ranges? Const random access ranges are usable, but other const
> ranges seem to be useless since popFront and popBack can't be const.
>
>
> Shin
> _______________________________________________
The case I ran into that I think is a useful one is being able to use
const ranges as input to various algorithms, map and filter being the most
obvious choices. In my case I was filtering out a few specific records of
a range of records.
Later,
Brad
More information about the phobos
mailing list