1 #ifndef SILICIUM_FUNCTION_HPP
2 #define SILICIUM_FUNCTION_HPP
6 #include <boost/utility/enable_if.hpp>
12 template <
class Signature>
15 template <
class Result,
class ...Args>
18 function() BOOST_NOEXCEPT
22 function(
function &&other) BOOST_NOEXCEPT
27 function(
function const &other) BOOST_NOEXCEPT
28 : m_content(other.m_content)
32 function &operator = (
function &&other) BOOST_NOEXCEPT
38 function &operator = (
function const &other) BOOST_NOEXCEPT
40 m_content = other.m_content;
45 function(F &&content,
typename boost::enable_if_c<!std::is_same<function, typename std::decay<F>::type>::value,
void>::type * =
nullptr)
46 : m_content(std::make_shared<holder<
typename std::decay<F>::type>>(std::forward<F>(content)))
50 bool operator !() const BOOST_NOEXCEPT
57 Result operator()(Args ...arguments)
const
60 return m_content->operator ()(std::forward<Args>(arguments)...);
67 virtual ~holder_base()
70 virtual Result operator()(Args ...arguments) = 0;
74 struct holder : holder_base
77 explicit holder(G &&
function)
78 : m_function(
std::forward<G>(function))
84 return m_function(std::forward<Args>(arguments)...);
92 std::shared_ptr<holder_base> m_content;
std::remove_reference< T >::type && move(T &&ref)
Definition: move.hpp:10
BOOST_STATIC_ASSERT(Si::is_handle< absolute_path >::value)
Definition: absolute_path.hpp:352
#define SILICIUM_EXPLICIT_OPERATOR_BOOL()
Definition: explicit_operator_bool.hpp:17
Definition: absolute_path.hpp:19
#define SILICIUM_OVERRIDE
Definition: config.hpp:140
Definition: function.hpp:13