]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/proto/include/boost/proto/transform/detail/default_function_impl.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / proto / include / boost / proto / transform / detail / default_function_impl.hpp
1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
2
3 #include <boost/proto/transform/detail/preprocessed/default_function_impl.hpp>
4
5 #elif !defined(BOOST_PP_IS_ITERATING)
6
7 #define BOOST_PROTO_DEF_FUN_INVOKE_ARG(Z, M, DATA) \
8 BOOST_PROTO_DEFAULT_EVAL(Z, BOOST_PP_ADD(M, 2), DATA)
9
10 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
11 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/default_function_impl.hpp")
12 #endif
13
14 ///////////////////////////////////////////////////////////////////////////////
15 /// \file default_function_impl.hpp
16 /// Contains definition of the default_function_impl, the implementation of the
17 /// _default transform for function-like nodes.
18 //
19 // Copyright 2008 Eric Niebler. Distributed under the Boost
20 // Software License, Version 1.0. (See accompanying file
21 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
22
23 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
24 #pragma wave option(preserve: 1)
25 #endif
26
27 #define BOOST_PP_ITERATION_PARAMS_1 \
28 (3, (3, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/default_function_impl.hpp>))
29 #include BOOST_PP_ITERATE()
30
31 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
32 #pragma wave option(output: null)
33 #endif
34
35 #undef BOOST_PROTO_DEF_FUN_INVOKE_ARG
36
37 #else
38
39 #define N BOOST_PP_ITERATION()
40
41 template<typename Grammar, typename Expr, typename State, typename Data>
42 struct default_function_impl<Grammar, Expr, State, Data, N>
43 : transform_impl<Expr, State, Data>
44 {
45 BOOST_PP_REPEAT(N, BOOST_PROTO_DEFAULT_EVAL_TYPE, Expr)
46
47 typedef
48 typename proto::detail::result_of_fixup<r0>::type
49 function_type;
50
51 typedef
52 typename BOOST_PROTO_RESULT_OF<
53 function_type(BOOST_PP_ENUM_SHIFTED_PARAMS(N, r))
54 >::type
55 result_type;
56
57 result_type operator ()(
58 typename default_function_impl::expr_param e
59 , typename default_function_impl::state_param s
60 , typename default_function_impl::data_param d
61 ) const
62 {
63 return this->invoke(e, s, d, is_member_function_pointer<function_type>());
64 }
65
66 private:
67 result_type invoke(
68 typename default_function_impl::expr_param e
69 , typename default_function_impl::state_param s
70 , typename default_function_impl::data_param d
71 , mpl::false_
72 ) const
73 {
74 return BOOST_PROTO_DEFAULT_EVAL(~, 0, e)(
75 BOOST_PP_ENUM_SHIFTED(N, BOOST_PROTO_DEFAULT_EVAL, e)
76 );
77 }
78
79 result_type invoke(
80 typename default_function_impl::expr_param e
81 , typename default_function_impl::state_param s
82 , typename default_function_impl::data_param d
83 , mpl::true_
84 ) const
85 {
86 BOOST_PROTO_USE_GET_POINTER();
87 typedef typename detail::class_member_traits<function_type>::class_type class_type;
88 return (
89 BOOST_PROTO_GET_POINTER(class_type, (BOOST_PROTO_DEFAULT_EVAL(~, 1, e))) ->*
90 BOOST_PROTO_DEFAULT_EVAL(~, 0, e)
91 )(BOOST_PP_ENUM(BOOST_PP_SUB(N, 2), BOOST_PROTO_DEF_FUN_INVOKE_ARG, e));
92 }
93 };
94
95 #undef N
96
97 #endif