1 /*=============================================================================
2 Copyright (c) 2001-2007 Joel de Guzman
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 #if !defined(BOOST_PP_IS_ITERATING)
8 #if !defined(PHOENIX_BIND_DETAIL_MEMBER_FUNCTION_PTR_HPP)
9 #define PHOENIX_BIND_DETAIL_MEMBER_FUNCTION_PTR_HPP
11 #include <boost/preprocessor/iterate.hpp>
12 #include <boost/preprocessor/repetition/enum_params.hpp>
13 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
14 #include <boost/preprocessor/dec.hpp>
15 #include <boost/utility/addressof.hpp>
17 namespace boost { namespace phoenix { namespace detail
20 struct member_function_ptr_impl
22 template <typename RT, typename FP>
26 template <int N, typename RT, typename FP>
27 struct member_function_ptr
28 : member_function_ptr_impl<N>::template impl<RT, FP>
30 typedef typename member_function_ptr_impl<N>::
31 template impl<RT, FP> base;
32 member_function_ptr(FP fp)
37 struct member_function_ptr_impl<0>
39 template <typename RT, typename FP>
42 template <typename Class>
51 template <typename Class>
52 RT operator()(Class& obj) const
57 template <typename Class>
58 RT operator()(Class* obj) const
67 #define BOOST_PP_ITERATION_PARAMS_1 \
68 (3, (1, PHOENIX_COMPOSITE_LIMIT, \
69 "boost/spirit/home/phoenix/bind/detail/member_function_ptr.hpp"))
70 #include BOOST_PP_ITERATE()
72 }}} // namespace boost::phoenix::detail
76 ///////////////////////////////////////////////////////////////////////////////
78 // Preprocessor vertical repetition code
80 ///////////////////////////////////////////////////////////////////////////////
81 #else // defined(BOOST_PP_IS_ITERATING)
83 #define N BOOST_PP_ITERATION()
86 struct member_function_ptr_impl<N>
88 template <typename RT, typename FP>
91 template <typename Class, BOOST_PP_ENUM_PARAMS(N, typename T)>
100 template <typename Class, BOOST_PP_ENUM_PARAMS(N, typename A)>
101 RT operator()(Class& obj, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _)) const
103 return (obj.*fp)(BOOST_PP_ENUM_PARAMS(N, _));
106 template <typename Class, BOOST_PP_ENUM_PARAMS(N, typename A)>
107 RT operator()(Class* obj, BOOST_PP_ENUM_BINARY_PARAMS(N, A, & _)) const
109 return (obj->*fp)(BOOST_PP_ENUM_PARAMS(N, _));
117 #endif // defined(BOOST_PP_IS_ITERATING)