Defining type coercion

Simen kjaeraas simen.kjaras at gmail.com
Mon Feb 28 12:49:19 PST 2011


Jonathan M Davis <jmdavisProg at gmx.com> wrote:

>> struct Ordinal {
>>      private int representation;
>>      char getChar( ) {
>>          return representation + 'a'-1;
>>      }
>>      alias representation this;
>>      alias getChar this;
>> }
>>
>> But like I said, it currently does not work.
>
> Would "alias getChar this" really be legal? I thought that this had to be
> aliased to a type.

Alias function this; works.


-- 
Simen


More information about the Digitalmars-d-learn mailing list