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,735 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All   
   Re: Specializing std::less without an op   
   13 Dec 11 13:37:53   
   
   From: daniel.kruegler@googlemail.com   
      
   On 2011-12-09 18:24, Nevin ":-]" Liber wrote:   
   > In article,   
   >   Daniel Krügler  wrote:   
   >   
   >> This is true, but not much of a problem, because std::shared_ptr (as   
   >> std::unique_ptr) implement operator<  in terms of less<>  of the underlying   
   >> pointer:   
   >   
   >> And the less<>  specialization for pointers *does* induce a total order (see   
   >> 20.8.5 p8).   
   >   
   > But less<>  of the underlying pointer implements an *unspecified* strict   
   > weak ordering, which is just another way of saying that the actual order   
   > itself is meaningless.   
      
   I do not understand this part of your reply: As I quoted above the   
   less<> specialization for pointers does induce a total order, which is   
   also a strict weak order. It is unspecified, yes, but why should you   
   care? There does not exist a guaranteed way to order arbitrary pointer   
   values. I don't see the implication, that this ordering is   
   "meaning-less". It should be sufficient to hold your pointer values in a   
   std::map.   
      
   Unspecified ordering has still it's values, just look at operator< for   
   std::error_category, std::error_code, std::type_info (and therefore for   
   std::type_index) or for thread::id. This is not different from ordering   
   of (arbitrary) pointer values.   
      
   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