D's templates now seem weak to me...

Stewart Gordon smjg_1998 at yahoo.com
Mon Feb 20 08:35:28 PST 2006


Ben Phillips wrote:
> According to the docs, "Templates cannot be used to add non-static members or
> functions to classes. For example: [...]". Why? This is just plain stupid in my
> opinion

Because at the time of compiling the module, one cannot be sure what 
types it will be called on, and so it wouldn't be able to generate the vtbl.

However, it ought to be possible to do it on private and final member 
functions, since such things will never be overridden and so don't need 
to be included in the vtbl.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:- C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.



More information about the Digitalmars-d mailing list