blob: fdb2fc543d2ba5d4f27766bff642216f474d1fab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*=============================================================================
Copyright (c) 2016 Kohei Takahashi
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 PHOENIX_BIND_BIND_FUNCTION_HPP
#define PHOENIX_BIND_BIND_FUNCTION_HPP
#include <boost/phoenix/core/limits.hpp>
#if defined(BOOST_PHOENIX_NO_VARIADIC_BIND)
# include <boost/phoenix/bind/detail/cpp03/bind_function.hpp>
#else
#include <boost/phoenix/core/expression.hpp>
#include <boost/phoenix/core/detail/function_eval.hpp>
namespace boost { namespace phoenix
{
namespace detail
{
template <typename RT, typename FP>
struct function_ptr
{
typedef RT result_type;
function_ptr(FP fp_)
: fp(fp_) {}
template <typename... A>
result_type operator()(A&... a) const
{
return fp(a...);
}
bool operator==(function_ptr const& rhs) const
{
return fp == rhs.fp;
}
template <typename RhsRT, typename RhsFP>
bool operator==(function_ptr<RhsRT, RhsFP> const& /*rhs*/) const
{
return false;
}
FP fp;
};
} // namespace boost::phoenix::detail
template <typename RT, typename... T, typename... A>
inline typename detail::expression::function_eval<
detail::function_ptr<RT, RT (*)(T...)>
, A...
>::type const
bind(RT (*f)(T...), A const&... a)
{
typedef detail::function_ptr<RT, RT (*)(T...)> fp_type;
return detail::expression::function_eval<fp_type, A...>::make(fp_type(f), a...);
}
}} // namespace boost::phoenix
#endif
#endif
|