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,724 of 33,346   
   Nevin ":-]" Liber to Seungbeom Kim   
   Re: Specializing std::less without an op   
   08 Dec 11 09:21:50   
   
   From: nevin@eviloverlord.com   
      
   In article ,   
    Seungbeom Kim  wrote:   
      
   > Even if you use define operator< for T, which is a member of class S,   
   > op< for S doesn't automatically get composed out of op< for T,   
      
   Well, not yet.  One is hopeful for C++1y... :-)   
      
   > but you   
   > have to manually write op< for S using op< for T, just as with   
   >   
   >     struct complex { int re, im; };   
   >   
   > op< for complex doesn't automatically get composed but you have to write   
   >   
   >     bool operator<(complex a, complex b) { /* ... */ }   
      
   Sure, but I can use other facilities to minimize the pain, as in:   
      
       bool operator<(complex const& a, complex const& b)   
       { return std::tie(a.re, a.im) < std::tie(b.re, b.im); }   
      
   --   
   Nevin ":-)" Liber     
      
      
         [ 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