opAddAssign still works

Steven Schveighoffer schveiguy at yahoo.com
Tue May 11 06:20:23 PDT 2010


On Tue, 11 May 2010 09:14:37 -0400, Simen kjaeraas  
<simen.kjaras at gmail.com> wrote:

> Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>
>> But this function never gets called.  I found out recently that  
>> template functions are not allowed in interfaces, which makes it  
>> impossible to use the new operator overloads on interfaces.
>
> The problem is however, that template functions can't be virtual, and
> thus can't be stuffed into interfaces. Mayhaps however, specific
> instantiations could be.
>
> Of course, implementing some kind of dynamic vtable, that could be
> updated at link-time, would make many kinds of magic possible, and
> might be a solution. No idea how possible this is, though.

It is planned for interfaces to be able to contain template member  
functions, those functions would not be virtual or overridable, and would  
need to be expressed completely in terms of the interface.

They are like final interface functions.

I assumed this was already done, as it was a mitigating factor when  
fleshing out the new operator design that you could simulate previous  
behavior by creating a virtual function that then was called by your  
template operator function.

-Steve


More information about the Digitalmars-d-learn mailing list