Templates do maybe not need to be that slow (no promises)

Iakh via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 9 09:00:27 PDT 2016


On Friday, 9 September 2016 at 15:28:55 UTC, Stefan Koch wrote:
> On Friday, 9 September 2016 at 15:08:26 UTC, Iakh wrote:
>> On Friday, 9 September 2016 at 07:56:04 UTC, Stefan Koch wrote:
>>
>> I was thinking on adding "opaque" attribute for template 
>> arguments
>> to force template to forget some information about type.
>> E.g if you use
>>
>> class A(opaque T) {...}
>>
>> you can use only pointers/references to T.
>>
>> Probably compiler could determine it by itself is type used
>> as opaque or not.
>
> you could use void* in this case and would not need a template 
> at all.

And if you wont type-safe code?
With opaque it would be more like Java generics


More information about the Digitalmars-d mailing list