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 32,583 of 33,346    |
|    =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?= to All    |
|    Re: using declaration - is it more than     |
|    09 Oct 12 15:06:39    |
   
   From: daniel.kruegler@googlemail.com   
      
   Am 09.10.2012 20:19, schrieb Helmut Jarausch:   
   > Hi,   
   >   
   > I have seen the following code in template functions   
   >   
   > { using std::sqrt; return sqrt(...)); }   
      
   I assume that ... stands for some valid C++ expression.   
      
   > Is this equivalent to   
   >   
   > { return std::sqrt(....); }   
      
   No.   
      
   > or are there any "side effects" on overload resolution, ADL or similar?.   
      
   If you write a qualified function call like std::sqrt, then no ADL will   
   take place, only functions from namespace std will be considered.   
      
   But if you write your second form you have "ADL-enabled" your code. It   
   will consider all overloads of sqrt from namespace std but it will -   
   depending on the function call arguments consider sqrt overloads in   
   associated namespaces of the argument type. This is often intended, e.g.   
   when using swap.   
      
   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