scide: implement selectionLength for openDocument
[supercollider.git] / external_libraries / boost-lockfree / boost / lockfree / detail / copy_payload.hpp
blob1e83eb295d4a088339f918662760891b95cccc27
1 // boost lockfree: copy_payload helper
2 //
3 // Copyright (C) 2011 Tim Blechmann
4 //
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>
15 namespace boost {
16 namespace lockfree {
17 namespace detail {
19 struct copy_convertible
21 template <typename T, typename U>
22 static void copy(T & t, U & u)
24 u = t;
28 struct copy_constructible_and_copyable
30 template <typename T, typename U>
31 static void copy(T & t, U & u)
33 u = U(t);
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,
41 copy_convertible,
42 copy_constructible_and_copyable
43 >::type copy_type;
44 copy_type::copy(t, u);
47 }}}
49 #endif /* BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED */