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,326 of 33,346    |
|    Seungbeom Kim to James K. Lowden    |
|    Re: Class to behave like ints    |
|    10 May 14 06:06:21    |
   
   From: musiphil@bawi.org   
      
   On 2014-05-09 06:11, James K. Lowden wrote:   
   >   
   > struct AppleID { int id; AppleID( int id=0 ) : id(id) {} };   
   > struct PearID { int id; PearID( int id=0 ) : id(id) {} };   
      
   And with C++11 you don't even need the constructors:   
      
   struct AppleID { int id; };   
   struct PearID { int id; };   
      
   void foo(AppleID, PearID);   
   foo(AppleID{2}, PearID{3});   
      
   --   
   Seungbeom Kim   
      
      
    [ 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