Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:17:01

0001 /*=============================================================================
0002 Copyright (c) 2001-2007 Joel de Guzman
0003 
0004 Distributed under the Boost Software License, Version 1.0. (See accompanying 
0005 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 
0008 #if !BOOST_PHOENIX_IS_ITERATING
0009 
0010 #include <boost/phoenix/core/limits.hpp>
0011 #include <boost/phoenix/support/iterate.hpp>
0012 
0013 namespace boost { namespace phoenix { namespace detail
0014 {
0015     template <int N>
0016     struct member_function_ptr_impl
0017     {
0018         template <typename RT, typename FP>
0019         struct impl;
0020     };
0021 
0022     template <int N, typename RT, typename FP>
0023     struct member_function_ptr
0024         : member_function_ptr_impl<N>::template impl<RT, FP>
0025     {
0026         typedef typename member_function_ptr_impl<N>::
0027             template impl<RT, FP> base;
0028         member_function_ptr(FP fp_)
0029             : base(fp_) {}
0030         
0031         using base::fp;
0032 
0033         bool operator==(member_function_ptr const & rhs) const
0034         {
0035             return fp == rhs.fp;
0036         }
0037 
0038         template <int M, typename RhsRT, typename RhsFP>
0039         bool operator==(member_function_ptr<M, RhsRT, RhsFP> const &) const
0040         {
0041             return false;
0042         }
0043     };
0044 
0045     template <>
0046     struct member_function_ptr_impl<0>
0047     {
0048         template <typename RT, typename FP>
0049         struct impl
0050         {
0051             typedef RT result_type;
0052 
0053             impl(FP fp_)
0054                 : fp(fp_) {}
0055 
0056             template <typename Class>
0057             RT operator()(Class& obj) const
0058             {
0059                 BOOST_PROTO_USE_GET_POINTER();
0060 
0061                 typedef typename proto::detail::class_member_traits<FP>::class_type class_type;
0062                 return (BOOST_PROTO_GET_POINTER(class_type, obj) ->*fp)();
0063             }
0064 
0065             template <typename Class>
0066             RT operator()(Class* obj) const
0067             {
0068                 return (obj->*fp)();
0069             }
0070 
0071             FP fp;
0072         };
0073     };
0074 
0075 #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
0076     #include <boost/phoenix/bind/detail/cpp03/preprocessed/member_function_ptr.hpp>
0077 #else
0078 
0079 #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
0080     #pragma wave option(preserve: 2, line: 0, output: "preprocessed/member_function_ptr_" BOOST_PHOENIX_LIMIT_STR ".hpp")
0081 #endif
0082 
0083 /*=============================================================================
0084     Copyright (c) 2001-2007 Joel de Guzman
0085 
0086     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0087     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0088 ==============================================================================*/
0089 
0090 #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
0091     #pragma wave option(preserve: 1)
0092 #endif
0093 
0094 #define BOOST_PHOENIX_ITERATION_PARAMS                                          \
0095     (3, (1, BOOST_PHOENIX_COMPOSITE_LIMIT,                                      \
0096     <boost/phoenix/bind/detail/cpp03/member_function_ptr.hpp>))
0097 #include BOOST_PHOENIX_ITERATE()
0098 
0099 #if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
0100     #pragma wave option(output: null)
0101 #endif
0102 
0103 #endif
0104 
0105 }}} // namespace boost::phoenix::detail
0106 
0107 ///////////////////////////////////////////////////////////////////////////////
0108 //
0109 //  Preprocessor vertical repetition code
0110 //
0111 ///////////////////////////////////////////////////////////////////////////////
0112 #else
0113 
0114     template <>
0115     struct member_function_ptr_impl<BOOST_PHOENIX_ITERATION>
0116     {
0117         template <typename RT, typename FP>
0118         struct impl
0119         {
0120             typedef RT result_type;
0121 
0122             impl(FP fp_)
0123                 : fp(fp_) {}
0124 
0125             template <typename Class, BOOST_PHOENIX_typename_A>
0126             RT operator()(Class& obj, BOOST_PHOENIX_A_ref_a) const
0127             {
0128                 BOOST_PROTO_USE_GET_POINTER();
0129 
0130                 typedef typename proto::detail::class_member_traits<FP>::class_type class_type;
0131                 return (BOOST_PROTO_GET_POINTER(class_type, obj)->*fp)(BOOST_PHOENIX_a);
0132             }
0133 
0134             template <typename Class, BOOST_PHOENIX_typename_A>
0135             RT operator()(Class* obj, BOOST_PHOENIX_A_ref_a) const
0136             {
0137                 return (obj->*fp)(BOOST_PHOENIX_a);
0138             }
0139 
0140             FP fp;
0141         };
0142     };
0143 
0144 #endif // defined(BOOST_PP_IS_ITERATING)