February 11, 2013
On Mon, 11 Feb 2013 14:52:51 -0500, Steven Schveighoffer <schveiguy@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.

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

> On Mon, 11 Feb 2013 14:52:51 -0500, Steven Schveighoffer <schveiguy@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
February 11, 2013
On Monday, February 11, 2013 14:56:29 Steven Schveighoffer wrote:
> On Mon, 11 Feb 2013 14:52:51 -0500, Steven Schveighoffer
> 
> <schveiguy@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.

It _is_ false.

--------
import std.range;

void main()
{
 assert(!isInputRange!(const string[]));
}
--------

But remember that templated functions which are given array always instantiate with the tail-const type of an array (assuming that you use IFTI rather than explicit instantiaton), so that may be where the confusion is coming from.

- Jonathan M Davis
1 2 3
Next ›   Last »