------- Comment #1 from chris at bubblescope dot net  2009-09-14 07:24 -------
In C++0x, this problem will go away, because move constructors will be used,
which leads to the most efficient implementation for both large and small types
(assuming they implement a move constructor at least as efficient as swap).
However, the wording is misleading and I might see if it can be changed.

In C++03, being pedantic, I'm not sure if we have to call std::swap, although
as you say it would make things go faster for certain types. This wording is
used in some other places, for example stable_partition, which cannot be
implemented just with std::swap.

While you have bought up a obvious case of inefficiency, I would advise leaving
it as is, and compiling your code with -std=g++0x on a recent compiler. If you
are using standard containers, this should give you faster code, without any
changes at all. With your own code, it would require you defining the move
constructor and move assignment operators.


-- 

chris at bubblescope dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chris at bubblescope dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41351

Reply via email to