![]() System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /usr/include/boost/lockfree/detail/ |
Upload File : |
// boost lockfree: copy_payload helper // // Copyright (C) 2011, 2016 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 <boost/mpl/if.hpp> #include <boost/type_traits/is_convertible.hpp> #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable: 4512) // assignment operator could not be generated #endif namespace boost { namespace lockfree { namespace detail { struct copy_convertible { template <typename T, typename U> static void copy(T & t, U & u) { u = t; } }; struct copy_constructible_and_copyable { template <typename T, typename U> static void copy(T & t, U & u) { u = U(t); } }; template <typename T, typename U> void copy_payload(T & t, U & u) { typedef typename boost::mpl::if_<typename boost::is_convertible<T, U>::type, copy_convertible, copy_constructible_and_copyable >::type copy_type; copy_type::copy(t, u); } template <typename T> struct consume_via_copy { consume_via_copy(T & out): out_(out) {} template <typename U> void operator()(U & element) { copy_payload(element, out_); } T & out_; }; struct consume_noop { template <typename U> void operator()(const U &) { } }; }}} #if defined(_MSC_VER) #pragma warning(pop) #endif #endif /* BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED */