Named template constraints

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 22 11:50:44 PDT 2014


On Tuesday, 22 April 2014 at 18:35:58 UTC, Steven Schveighoffer 
wrote:
> On Tue, 22 Apr 2014 11:36:07 -0400, monarch_dodra 
> <monarchdodra at gmail.com> wrote:
>
>> On Tuesday, 22 April 2014 at 15:30:36 UTC, Steven 
>> Schveighoffer wrote:
>>> Also, an immutable can be initialized that way:
>>>
>>> immutable int[] = int[].init;
>>
>> Isn't that exactly "R.init" ?
>
> Yes, you said if it's an immutable it would fail to compile. I 
> think this is not true.
>
> -Steve


Ah... you said:

> Note, is the r2 = R.init needed? Not sure.

To whitch I replied:

> Yes: It R2 has no default init, or is an immutable,
> then that line will fail to compile.

I meant that if you *don't* add the R.init, then the code will 
*not* compile. EG => R.init is necessary.

Sorry for the mixup :/


More information about the Digitalmars-d-learn mailing list