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 33,259 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to Martin Bonner   
   Re: std::pair and operator<()   
   21 Nov 13 09:46:30   
   
   From: daniel.kruegler@googlemail.com   
      
   On 2013-11-21 01:47, Martin Bonner wrote:   
   > I think it is legal to add overloads to the std namespace provided your   
   > overloads involve your types.  Technically, overloading in std for builtin   
   > types is not permitted (but it might work).   
      
   No, the library specification is pretty clear not to allow adding   
   overloads to namespace std. You are allowed to add template   
   *specializations* to namespace std, if at least one template argument is   
   a user-defined type, but this also binds you to the contract, that your   
   implementation satisfies the requirements of the standard library: This   
   is essentially 17.6.4.2.1 [namespace.std] p1:   
      
   "The behavior of a C++ program is undefined if it adds declarations or   
   definitions to namespace std or to a namespace within namespace std   
   unless otherwise specified. A program may add a template specialization   
   for any standard library template to namespace std only if the   
   declaration depends on a user-defined type and the specialization meets   
   the standard library requirements for the original template and is not   
   explicitly prohibited."   
      
   HTH & 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