Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Function template adl_move_swap



// In header: <boost/move/adl_move_swap.hpp>

template<typename T> void adl_move_swap(T & x, T & y);


Exchanges the values of a and b, using Argument Dependent Lookup (ADL) to select a specialized swap function if available. If no specialized swap function is available, std::swap is used.

Exception: If T uses Boost.Move's move emulation and the compiler has no rvalue references then:

  • If T has a T::swap(T&) member, that member is called.

  • Otherwise a move-based swap is called, equivalent to: T t(::boost::move(x)); x = ::boost::move(y); y = ::boost::move(t);.