getNext

jerro a at a.com
Mon Jul 9 11:33:25 PDT 2012


On Monday, 9 July 2012 at 16:22:05 UTC, Mehrdad wrote:
> Perhaps if you could show an actual example of what you expect 
> to be able to do, that would make things clearer?

It is useful to be able to write an algorithm that both reads
and writes range elements. There are plenty of use cases for
that, but if you really need an example, here's a simple one:

void transform(alias f, R)(R r)
     if(isInputRange!R && hasAssignableElements!R)
{
     for(; !r.empty; r.popFront())
         r.front = unaryFun!f(r.front);
}



More information about the Digitalmars-d mailing list