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 32,927 of 33,346   
   =?ISO-8859-1?Q?=D6=F6_Tiib?= to DeMarcus   
   Re: Can I overload with unused arguments   
   13 Mar 13 09:35:32   
   
   From: ootiib@hot.ee   
      
   On Wednesday, 13 March 2013 00:50:06 UTC+2, DeMarcus  wrote:   
   > Consider this situation.   
      
   The example is ground on dynamic polymorphism situation (nothing can be   
   more dynamic than entertainers) but you work with static polymorphism   
   tools (like overloads) here. May be you should retry?   
      
   > I understand what you tried here, been there done that.   
   > What we want to achieve here is to be able to say that there is no   
   > entertainer today. We could allow nullptr as an argument to runShow()   
   > but when reading the code, NULL or nullptr ain't that clear all the   
   > times, especially when a function takes several arguments.   
      
   If it is dynamic polymorphism or dynamic dispatch then get out of   
   immersion of nullptr. Make a polymorphic smart pointer that instead of   
   nullptr uses pointer to static "MissingEntertainer" object that   
   *implements* the interface of Entertainer (just does nothing). Such   
   pointer can then never be nullptr, can be always dereferenced etc.   
   I'd call it as robust_pointer. :-)   
      
      
   --   
         [ 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