Named template constraints
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Apr 22 08:30:35 PDT 2014
On Tue, 22 Apr 2014 11:15:14 -0400, monarch_dodra <monarchdodra at gmail.com>
wrote:
> On Tuesday, 22 April 2014 at 15:06:34 UTC, Steven Schveighoffer wrote:
>> Note, is the r2 = R.init needed? Not sure.
>
> Yes: It R2 has no default init, or is an immutable, then that line will
> fail to compile.
I don't believe it's possible to have no 'init'.
I think the reason it says '= R.init' is for ranges that have @disable
this().
Also, an immutable can be initialized that way:
immutable int[] = int[].init;
Of course, it wouldn't pass the rest of isInputRange.
-Steve
More information about the Digitalmars-d-learn
mailing list