`ref T` should be a type!!

Victor Porton porton at narod.ru
Fri Mar 29 20:49:20 UTC 2019


On Friday, 29 March 2019 at 16:18:59 UTC, Alex wrote:
> On Friday, 29 March 2019 at 16:06:09 UTC, Victor Porton wrote:
>> That `ref T` (where T is a type) is not a type is a serious 
>> design error, because so `ref T` cannot be used as a template 
>> argument.
>>
>> It is a very serious problem.
>>
>> Even in C++ despite of all its silliness, T& is a type and can 
>> be used as a template argument.
>>
>> Can the language be changed to resolve this problem?
>
> Could you show an example, where an alias parameter is not 
> enough?

The following does not work:

class C(alias T) { }
C(ref int) a;


More information about the Digitalmars-d mailing list