// Copyright David Abrahams 2008. Distributed under the Boost // Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "boost/detail/has_swap_overload.hpp" #include "boost/mpl/assert.hpp" #include #include namespace my { struct X { friend void swap(X&, X&) {} }; struct Y {}; struct Z : std::complex { friend void swap(Z&, Z&) {} }; }; int main() { BOOST_MPL_ASSERT((boost::detail::has_swap_overload)); BOOST_MPL_ASSERT_NOT((boost::detail::has_swap_overload)); // Wrong answer expected here; std is an associated namespace so // we have to be conservative BOOST_MPL_ASSERT_NOT((boost::detail::has_swap_overload)); BOOST_MPL_ASSERT_NOT((boost::detail::has_swap_overload >)); // The library has a specialization for this one. BOOST_MPL_ASSERT((boost::detail::has_swap_overload >)); }