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,849 of 33,346    |
|    Ulrich Eckhardt to All    |
|    Re: Add an explicit specialization of st    |
|    25 Jan 12 11:26:00    |
   
   f4e6ea45   
   From: ulrich.eckhardt@dominolaser.com   
      
   Am 24.01.2012 23:04, schrieb vlad.moscow@mail.ru:   
   > For example if someone wants to add to std namespace a specialization   
   > of std::swap for a user type.   
   >   
   > So 1) Does the Standard allow to do so? 2) If evven it allows to do so   
   > it is a good practise or it shall be escaped?   
      
   Concerning swap, which I consider an important complementary to ctor,   
   cctor, dtor and operator=, I usually take this approach:   
      
   namespace N {   
    class X {};   
    void swap(X&, X&);   
   }   
      
   When using it, I typically take this approach:   
      
    void foo() {   
    N::X x1, x2;   
    swap(x1, x2);   
    }   
      
   In generic code, I rather do this:   
      
    template
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca