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,097 of 33,346    |
|    Norman J. Goldstein to Bo Persson    |
|    Re: template virtual methods    |
|    28 May 13 22:02:37    |
   
   From: normvcr@telus.net   
      
   On 05/26/2013 06:22 PM, Bo Persson wrote:   
   > Norman J. Goldstein skrev 2013-05-26 01:39:   
   >>   
   >> 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.   
   >>   
   >> 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 :-)   
   >>   
   >   
   > This would require a C++ specific linker/loader which is not possible on   
   > some systems. Perhaps because the OS manufacturer doesn't support 3rd   
   > party tools at this level.   
   >   
   > The current rules allow for the use of the available system tools, which   
   > makes it possible to implement C++ on a few additional systems.   
      
   { quoted sig removed -mod }   
      
   Thanks to everyone for the responses and discussion. To summarize, there   
   is functionality to be gained from templatized virtual methods, but not   
   all platforms would be able to implement this feature. Moreover, the   
   already complex template error diagnostics would become even more   
   complex. There are various techniques for work-arounds and alternatives   
   in special situations, but no general alternatives with comparable   
   programming and run-time efficiency.   
      
   I wonder if C++14/17 discussions will raise this topic.   
      
      
   --   
    [ 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