
Michael Marcin wrote:
I think the only real way to get it right in every case is to have the author of the type specify the proper traits.
Okay, I give up. A generic way to tweak MSVC's "Swaptimization" just doesn't seem feasable without adding a /lot/ of template specializations. See also the reply by Stephan T. Lavavej on my questions at http://blogs.msdn.com/vcblog/archive/2008/08/11/tr1-fixes-in-vc9-sp1.aspx So any type for which default-construction + swap outperforms copy-construction should preferably have "Swaptimization" enabled. Let's call such a type "Swaptimizable". So should we add a specialization of std::_Move_operation_category to each Boost HPP file that defines a "Swaptimizable" type? Or would it be preferable to have a single header file, containing std::_Move_operation_category specializations of for all "Swaptimizable" Boost types? Note that for some templates whether an instantiation is "Swaptimizable" depends upon its template argument. For example, "Swaptimization" should be applied to boost::array<std::string>, but not to boost::array<int>. Kind regards, Niels