Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/phoenix/bind/bind_function.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*=============================================================================
0002     Copyright (c) 2016 Kohei Takahashi
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 #ifndef PHOENIX_BIND_BIND_FUNCTION_HPP
0009 #define PHOENIX_BIND_BIND_FUNCTION_HPP
0010 
0011 #include <boost/phoenix/core/limits.hpp>
0012 
0013 #if defined(BOOST_PHOENIX_NO_VARIADIC_BIND)
0014 # include <boost/phoenix/bind/detail/cpp03/bind_function.hpp>
0015 #else
0016 
0017 #include <boost/phoenix/core/expression.hpp>
0018 #include <boost/phoenix/core/detail/function_eval.hpp>
0019 
0020 namespace boost { namespace phoenix
0021 {
0022     namespace detail
0023     {
0024         template <typename RT, typename FP>
0025         struct function_ptr
0026         {
0027             typedef RT result_type;
0028 
0029             function_ptr(FP fp_)
0030                 : fp(fp_) {}
0031 
0032             template <typename... A>
0033             result_type operator()(A&... a) const
0034             {
0035                 return fp(a...);
0036             }
0037 
0038             bool operator==(function_ptr const& rhs) const
0039             {
0040                 return fp == rhs.fp;
0041             }
0042 
0043             template <typename RhsRT, typename RhsFP>
0044             bool operator==(function_ptr<RhsRT, RhsFP> const& /*rhs*/) const
0045             {
0046                 return false;
0047             }
0048 
0049             FP fp;
0050         };
0051     } // namespace boost::phoenix::detail
0052 
0053     template <typename RT, typename... T, typename... A>
0054     inline typename detail::expression::function_eval<
0055         detail::function_ptr<RT, RT (*)(T...)>
0056       , A...
0057     >::type const
0058     bind(RT (*f)(T...), A const&... a)
0059     {
0060         typedef detail::function_ptr<RT, RT (*)(T...)> fp_type;
0061         return detail::expression::function_eval<fp_type, A...>::make(fp_type(f), a...);
0062     }
0063 }} // namespace boost::phoenix
0064 
0065 #endif
0066 #endif