]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2007 Joel de Guzman | |
3 | ||
4 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
5 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
6 | ==============================================================================*/ | |
7 | ||
8 | #if !BOOST_PHOENIX_IS_ITERATING | |
9 | ||
10 | #include <boost/phoenix/core/expression.hpp> | |
11 | #include <boost/phoenix/core/detail/function_eval.hpp> | |
12 | #include <boost/phoenix/bind/detail/cpp03/function_ptr.hpp> | |
13 | ||
14 | namespace boost { namespace phoenix { | |
15 | ||
16 | template < | |
17 | typename RT | |
18 | > | |
19 | inline | |
20 | typename detail::expression::function_eval< | |
21 | detail::function_ptr<0, RT, RT(*)()> | |
22 | >::type const | |
23 | bind(RT(*f)()) | |
24 | { | |
25 | typedef detail::function_ptr<0, RT, RT(*)()> fp_type; | |
26 | return detail::expression::function_eval<fp_type>::make(fp_type(f)); | |
27 | } | |
28 | ||
29 | template < | |
30 | typename RT | |
31 | , typename T0 | |
32 | , typename A0 | |
33 | > | |
34 | inline | |
35 | typename detail::expression::function_eval< | |
36 | detail::function_ptr<1, RT, RT(*)(T0)> | |
37 | , A0 | |
38 | >::type const | |
39 | bind(RT(*f)(T0), A0 const & a0) | |
40 | { | |
41 | typedef detail::function_ptr<1, RT, RT(*)(T0)> fp_type; | |
42 | return detail::expression::function_eval<fp_type, A0>::make(fp_type(f), a0); | |
43 | } | |
44 | ||
45 | #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES) | |
46 | #include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function.hpp> | |
47 | #else | |
48 | ||
49 | #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) | |
50 | #pragma wave option(preserve: 2, line: 0, output: "preprocessed/bind_function_" BOOST_PHOENIX_LIMIT_STR ".hpp") | |
51 | #endif | |
52 | ||
53 | /*============================================================================= | |
54 | Copyright (c) 2001-2007 Joel de Guzman | |
55 | ||
56 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
57 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
58 | ==============================================================================*/ | |
59 | ||
60 | #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) | |
61 | #pragma wave option(preserve: 1) | |
62 | #endif | |
63 | ||
64 | #define BOOST_PHOENIX_ITERATION_PARAMS \ | |
65 | (3, (2, BOOST_PP_DEC(BOOST_PHOENIX_ACTOR_LIMIT), \ | |
66 | <boost/phoenix/bind/detail/cpp03/bind_function.hpp>)) | |
67 | #include BOOST_PHOENIX_ITERATE() | |
68 | ||
69 | #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES) | |
70 | #pragma wave option(output: null) | |
71 | #endif | |
72 | ||
73 | #endif | |
74 | ||
75 | }} | |
76 | ||
77 | #else | |
78 | ||
79 | template < | |
80 | typename RT | |
81 | , BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, typename T) | |
82 | , BOOST_PHOENIX_typename_A | |
83 | > | |
84 | inline | |
85 | typename detail::expression::function_eval< | |
86 | detail::function_ptr< | |
87 | BOOST_PHOENIX_ITERATION | |
88 | , RT | |
89 | , RT(*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T)) | |
90 | > | |
91 | , BOOST_PHOENIX_A | |
92 | >::type const | |
93 | bind( | |
94 | RT(*f)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T)) | |
95 | , BOOST_PHOENIX_A_const_ref_a | |
96 | ) | |
97 | { | |
98 | typedef detail::function_ptr< | |
99 | BOOST_PHOENIX_ITERATION | |
100 | , RT | |
101 | , RT(*)(BOOST_PP_ENUM_PARAMS(BOOST_PHOENIX_ITERATION, T)) | |
102 | > fp_type; | |
103 | return | |
104 | detail::expression::function_eval< | |
105 | fp_type | |
106 | , BOOST_PHOENIX_A | |
107 | >::make( | |
108 | fp_type(f) | |
109 | , BOOST_PHOENIX_a | |
110 | ); | |
111 | } | |
112 | ||
113 | #endif |