File indexing completed on 2025-09-18 08:47:54
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED
0010 #define BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED
0011
0012 #include <type_traits>
0013
0014 #if defined( _MSC_VER )
0015 # pragma warning( push )
0016 # pragma warning( disable : 4512 )
0017 #endif
0018
0019 namespace boost { namespace lockfree { namespace detail {
0020
0021 struct copy_convertible
0022 {
0023 template < typename T, typename U >
0024 static void copy( T& t, U& u )
0025 {
0026 u = t;
0027 }
0028 };
0029
0030 struct copy_constructible_and_copyable
0031 {
0032 template < typename T, typename U >
0033 static void copy( T& t, U& u )
0034 {
0035 u = U( t );
0036 }
0037 };
0038
0039 template < typename T, typename U >
0040 void copy_payload( T& t, U& u )
0041 {
0042 static constexpr bool is_convertible = std::is_convertible< T, U >::value;
0043 typedef std::conditional_t< is_convertible, copy_convertible, copy_constructible_and_copyable > copy_type;
0044 copy_type::copy( t, u );
0045 }
0046
0047 }}}
0048
0049 #if defined( _MSC_VER )
0050 # pragma warning( pop )
0051 #endif
0052
0053 #endif