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 31,868 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to Frank Birbacher   
   Re: Template argument deduction   
   30 Jan 12 01:45:36   
   
   From: daniel.kruegler@googlemail.com   
      
   On 2012-01-29 23:44, Frank Birbacher wrote:   
   > Am 28.01.12 00:17, schrieb Ulrich Eckhardt:   
   >> A big danger here is that no function is called if the result of   
   >> x() is not used anywhere. However, I don't think this is used in   
   >> places where you rely on the side effects of calling a function.   
   >   
   > Is there an operator void?   
      
   Yes, but it is useless, see 12.3.2 [class.conv.fct] p1:   
      
   "A conversion function is never used to convert a (possibly   
   cv-qualified) object to the (possibly cv-qualified) same object type (or   
   a reference to it), to a (possibly cv-qualified) base class of that type   
   (or a reference to it), or to (possibly cv-qualified) void."   
      
   > Deleting (=delete) such an operator could trigger a compilation error.   
   > This is definately a use case for such an operator. Any thoughts?   
      
   Since void will never be deduced by a conversion function, how would   
   declaring it as deleted help? I consider constrained conversion   
   functions as a more general strategy for examples like these, see my   
   reply to Ulrich.   
      
   Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
         [ 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