
So can't this std::_Move_operation_category be specialized based on some template meta programming (e.g., has_swap_member<T>::value)?
David Abrahams wrote:
I don't know what member functions have to do with it; the real criterion is whether or not there's a swap available for it via ADL.
Thanks, Dave! I knew how to write has_swap_member<T> already, but I didn't yet know about has_swap_overload<T>. Now I see, it's also at http://svn.boost.org/svn/boost/sandbox/move/boost/move/detail/has_swap_overl... I just added another comment to the MSDN blog, mentioned your metafunction: http://blogs.msdn.com/vcblog/archive/2008/08/11/tr1-fixes-in-vc9-sp1.aspx It's a pity that has_swap_overload<T> yields false negatives, when T has std as associated namespace. Maybe, as a workaround, VC9 SP1 could be tweaked to apply their "Swaptimization", when has_swap_overload<T> /or/ has_swap_member<T> (using mpl::or_). Because I still think that if T has a swap member function, it's /very/ likely that it has a custom swap overload as well. Assuming that developers follow the "coding standard" to provide a non-member swap, whenever they provide a swap member function. What do you think? Kind regards, Niels