On Sun, 11 Mar 2012 00:18:31 -0500, Daniel Murphy <yebbl...@nospamgmail.com> wrote:

"Nick Sabalausky" <a@a.a> wrote in message
news:jjh9uh$1vto$1...@digitalmars.com...

My understanding is that the *only* thing preventing vitrual template
functions is the possibility of pre-compiled closed-source static libs.
Which is why I've long been in favor of allowing vitrual template
functions *as long as* there's no closed-source static libs preventing it.
Why should OSS have to pay costs that only apply to closed source?


That's not really it...

The problem is that vtables contain every virtual function of a class - and if you instantiate a template function with a new type, it would require a new vtable entry. Therefore you need to know how every template function in
every derived class is instantiated before you can build the base class
vtable.  This doesn't work with D's compilation model.

You could do it if the vtable was a hash instead of an array (or at least the template portion was). But that's just asking for horrible performance, and I don't think it's worth it.

But I think it is possible...

-Steve

Reply via email to