// boost lockfree: copy_payload helper // // Copyright (C) 2011 Tim Blechmann // // 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) #ifndef BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED #define BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED #include #include namespace boost { namespace lockfree { namespace detail { struct copy_convertible { template static void copy(T & t, U & u) { u = t; } }; struct copy_constructible_and_copyable { template static void copy(T & t, U & u) { u = U(t); } }; template void copy_payload(T & t, U & u) { typedef typename boost::mpl::if_::type, copy_convertible, copy_constructible_and_copyable >::type copy_type; copy_type::copy(t, u); } }}} #endif /* BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED */