Boost logo

Boost Users :

Subject: [Boost-users] shared_ptr and pass by value
From: Marat Abrarov (abrarov_at_[hidden])
Date: 2009-09-18 05:48:47


Dear Boost C++ Libraries Developers,

According to http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/
why Boost use this (not the only example):

~~~~~~~~~~~~~~~~~~~
shared_ptr & operator=( shared_ptr const & r )
{
  this_type(r).swap(*this);
  return *this;
}
~~~~~~~~~~~~~~~~~~~

and not such:
~~~~~~~~~~~~~~~~~~~
shared_ptr & operator=( shared_ptr r )
{
  r.swap(*this);
  return *this;
}
~~~~~~~~~~~~~~~~~~~

Regards, Marat.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net