1 // boost lockfree: copy_payload helper
3 // Copyright (C) 2011 Tim Blechmann
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED
10 #define BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED
12 #include <boost/mpl/if.hpp>
13 #include <boost/type_traits/is_convertible.hpp>
19 struct copy_convertible
21 template <typename T
, typename U
>
22 static void copy(T
& t
, U
& u
)
28 struct copy_constructible_and_copyable
30 template <typename T
, typename U
>
31 static void copy(T
& t
, U
& u
)
37 template <typename T
, typename U
>
38 void copy_payload(T
& t
, U
& u
)
40 typedef typename
boost::mpl::if_
<typename
boost::is_convertible
<T
, U
>::type
,
42 copy_constructible_and_copyable
44 copy_type::copy(t
, u
);
49 #endif /* BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED */