Subject: [Boost-bugs] [Boost C++ Libraries] #4820: any swaps inefficiently
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-11-07 02:26:46
#4820: any swaps inefficiently
------------------------------------+---------------------------------------
Reporter: jonathandodd@⦠| Owner: nasonov
Type: Bugs | Status: new
Milestone: To Be Determined | Component: any
Version: Boost 1.44.0 | Severity: Optimization
Keywords: |
------------------------------------+---------------------------------------
Apologies if this isn't a bug - I am quite new to boost, however I checked
in the IRC channel and it doesn't seem like this is a total non-starter.
It seems that if you simply call swap, std::swap is called, resulting in
an inefficient swapping operation. For example:
Big b1, b2;
any a1=b1, a2=b2;
swap(a1,a2); //Calls std::swap, invokes three copy constructors
I've attached a demonstration file, which I compiled with gcc.
Seems like can be easily solved with an overloaded std::swap, but I know
little about boost, so I'll leave that for the experts :)
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4820> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:04 UTC