Immutable separator to join() doesn't work

so so at so.so
Mon Jul 11 15:03:17 PDT 2011


On Tue, 12 Jul 2011 00:58:04 +0300, Timon Gehr <timon.gehr at gmx.ch> wrote:

> so wrote:
>> There is a simple workaround for this type of ranges that are like
>> iterators, which we know the beginning and the end.
>> We can improve isForwardRange!R by adding a line hasForwardRange!R. If  
>> it
>> does have, we return an adaptor which gives us a mutable range.
>> Good thing is because the original range is mutable we don't need to  
>> worry
>> about anything else.
>
> Wouldn't that be quite invasive? I imagine every function that would  
> want to work
> on ranges would then have to provide two versions, one that does the  
> work and one
> that calls the other version after having applied the adaptor(s)?
>
> Cheers,
> -Timon

In this case, not necessarily.
hasForwardRange could just be a global function that checks if its  
argument is an array and this i think would solve all our current problems.


More information about the Digitalmars-d mailing list