$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
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.