Multiple alias this is coming.

via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Sep 19 07:23:53 PDT 2014


On Friday, 19 September 2014 at 13:24:53 UTC, IgorStepanov wrote:
> On Friday, 19 September 2014 at 11:25:03 UTC, Nordlöw wrote:
>> On Thursday, 18 September 2014 at 22:13:14 UTC, IgorStepanov 
>> wrote:
>>> Is Nullable!(T) with polymorphic type disallowed now?
>>
>> Sorry, I meant
>>
>>    NotNull(T)
>>
>> Here's a module
>>
>> https://github.com/nordlow/justd/blob/master/notnull.d
>>
>> a bit tweak from the original design by Adam D Ruppe.
>
> What does a troubles with your NotNull implementation you have 
> with old alias this?
> Do you want to implicit cast from NotNull!(T) to all other 
> NotNull!(B) where B is basetype of T?

That makes me think of a question:

Will the compiler instantiate a template member function, if it 
is specified as alias this?

     struct MyStruct {
         T convertTo(T)()
             if(...)
         {
             // implementation
         }

         alias convertTo this;
     }

     MyStruct s;
     int a = s;
     float b = s;
     string c = s;

Will this work?


More information about the Digitalmars-d-announce mailing list