Idiomatic way to process const/immutable arrays as ranges

Steven Schveighoffer schveiguy at yahoo.com
Mon Feb 11 12:09:12 PST 2013


On Mon, 11 Feb 2013 14:56:29 -0500, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On Mon, 11 Feb 2013 14:52:51 -0500, Steven Schveighoffer  
> <schveiguy at yahoo.com> wrote:
>
>
>> With that change, then you can compile my original suggestion, or my  
>> later suggestion.
>
> Actually, it seems that even args.join(" ") works, without changing to  
> the tail-const type...
>
> That is technically correct, but I'm not sure why.  I would have  
> expected isInputRange!(const string[]) to be false.

Ah, it is false.  But IFTI is removing the head-constness of it (that was  
the feature I was thinking of).

But it doesn't remove the head-constness of the element type!  I don't  
know if there is a correct way to do this.  We probably need to add a new  
template constraint that examines the most permissive legal copy of a  
range is.

-Steve


More information about the Digitalmars-d-learn mailing list