home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 33,089 of 33,346   
   =?ISO-8859-1?Q?=D6=F6_Tiib?= to Norman J. Goldstein   
   Re: template virtual methods   
   26 May 13 00:05:29   
   
   From: ootiib@hot.ee   
      
   On Sunday, 26 May 2013 01:40:02 UTC+3, Norman J. Goldstein  wrote:   
   > I did not see this covered in the FAQ, and I looked at many web   
   > postings on this topic, I find that the common understanding is that   
   > templates (compile-time) and the virtual mechanism (run-time) are   
   > incompatible, and so template virtual methods are not supported.   
      
   They are not incompatible. There are several techniques how to use   
   both with same class. However both things are considered major source   
   of complexities by many. Merging the features in a function is hyper   
   complex (complexity in square).   
      
   > However, if the construction of the virtual tables were delayed   
   > until link time, the compiler/linker/loader would have the   
   > information it needs to build the vtables.  Certainly, this has been   
   > considered, so what is wrong with the idea?  Is it a matter of too   
   > much complexity for too little gain?  I think it is worth it, but, I   
   > am not writing the compilers :-)   
      
   My bet goes to complexity and no gain. Can you provide example for   
   what to use such a thing? I can't (so "no gain" part is just maybe my   
   bad imagination).   
      
   Lot of C++ programmers never write templates (they use, but do not   
   write), base class with template virtual forces them to write   
   one. They also frequently complain about complex compiler errors that   
   are related to templates. I have no difficulty to imagine the pile of   
   horrific linker errors about such virtual template in library   
   somewhere.   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca