function.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*==============================================================================
  2. Copyright (c) 2001-2010 Joel de Guzman
  3. Copyright (c) 2010 Eric Niebler
  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. #ifndef BOOST_PHOENIX_FUNCTION_FUNCTION_HPP
  8. #define BOOST_PHOENIX_FUNCTION_FUNCTION_HPP
  9. #include <boost/config.hpp>
  10. //#include <boost/phoenix/function/function_handling.hpp>
  11. #include <boost/phoenix/core/detail/function_eval.hpp>
  12. #include <boost/preprocessor/facilities/expand.hpp>
  13. #include <boost/preprocessor/logical/or.hpp>
  14. #include <boost/utility/result_of.hpp>
  15. namespace boost { namespace phoenix
  16. {
  17. /////////////////////////////////////////////////////////////////////////////
  18. // Functions
  19. /////////////////////////////////////////////////////////////////////////////
  20. // functor which returns our lazy function call extension
  21. template<typename F>
  22. struct function
  23. {
  24. BOOST_CONSTEXPR function()
  25. : f()
  26. {}
  27. BOOST_CONSTEXPR function(F f)
  28. : f(f)
  29. {}
  30. template <typename Sig>
  31. struct result;
  32. typename detail::expression::function_eval<F>::type const
  33. operator()() const
  34. {
  35. return detail::expression::function_eval<F>::make(f);
  36. }
  37. // Bring in the rest
  38. #include <boost/phoenix/function/detail/function_operator.hpp>
  39. F f;
  40. };
  41. }
  42. template<typename F>
  43. struct result_of<phoenix::function<F>()>
  44. : phoenix::detail::expression::function_eval<F>
  45. {};
  46. }
  47. #endif