1 // Copyright (C) 2013 Vicente J. Botet Escriba
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 // 2013/09 Vicente J. Botet Escriba
7 // Adapt to boost from CCIA C++11 implementation
8 // Make use of Boost.Move
10 #ifndef BOOST_THREAD_DETAIL_FUNCTION_WRAPPER_HPP
11 #define BOOST_THREAD_DETAIL_FUNCTION_WRAPPER_HPP
13 #include <boost/config.hpp>
14 #include <boost/thread/detail/memory.hpp>
15 #include <boost/thread/detail/move.hpp>
17 #include <boost/thread/csbl/memory/unique_ptr.hpp>
26 class function_wrapper
30 virtual void call()=0;
35 typedef boost::csbl::unique_ptr<impl_base> impl_base_type;
38 struct impl_type: impl_base
41 impl_type(F const &f_)
44 impl_type(BOOST_THREAD_RV_REF(F) f_)
54 BOOST_THREAD_MOVABLE_ONLY(function_wrapper)
56 //#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
58 function_wrapper(F const& f):
59 impl(new impl_type<F>(f))
63 function_wrapper(BOOST_THREAD_RV_REF(F) f):
64 impl(new impl_type<F>(boost::forward<F>(f)))
66 function_wrapper(BOOST_THREAD_RV_REF(function_wrapper) other) BOOST_NOEXCEPT :
79 function_wrapper& operator=(BOOST_THREAD_RV_REF(function_wrapper) other) BOOST_NOEXCEPT