
David Abrahams wrote:
on Wed Aug 27 2008, "Niels Dekker - mail address until 2008-12-31" <nd_mail_address_valid_until_2008-12-31-AT-xs4all.nl> wrote:
David Abrahams wrote:
What was wrong with my proposal?
You can't guarantee it will be right every time, but it's easy to correct when wrong, and that would only take a very few specializations. Please note: The question is /not/ whether T has a custom swap. The question is whether default-construction + swap outperforms copy-construction for type T. Only in that case, it makes sense to activate "Swaptimization".
Of course. But can you come up with a type where it makes sense to have written a custom swap but default-construction + swap won't outperform copy construction? Maybe my imagination is failing me, but I can't.
Isn't this the case for the current boost::function? Also a type could be Swappable and Assignable but not Default Constructible. Thanks, Michael Marcin