local_gen.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #if !BOOST_PHOENIX_IS_ITERATING
  2. /*==============================================================================
  3. Copyright (c) 2005-2010 Joel de Guzman
  4. Copyright (c) 2010 Thomas Heller
  5. Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. ==============================================================================*/
  8. #include <boost/phoenix/support/iterate.hpp>
  9. #define BOOST_PHOENIX_EXTRACT_LOCAL_TYPE(Z, N, D) \
  10. typename proto::detail::uncvref< \
  11. typename proto::result_of::child_c< \
  12. BOOST_PP_CAT(A, N) \
  13. , 1 \
  14. >::type \
  15. >::type
  16. /**/
  17. #define BOOST_PHOENIX_EXTRACT_LOCAL(Z, N, D) \
  18. proto::child_c<1>(BOOST_PP_CAT(a, N)) \
  19. /**/
  20. #define BOOST_PHOENIX_EXTRACT_LOCAL_KEY(Z, N, D) \
  21. typename proto::detail::uncvref< \
  22. typename proto::result_of::value< \
  23. typename proto::result_of::child_c< \
  24. BOOST_PP_CAT(A, N) \
  25. , 0 \
  26. >::type \
  27. >::type \
  28. >::type
  29. /**/
  30. #define BOOST_PHOENIX_ITERATION_PARAMS \
  31. (3, (1, BOOST_PHOENIX_LOCAL_LIMIT, \
  32. <boost/phoenix/scope/detail/cpp03/local_gen.hpp>))
  33. #include BOOST_PHOENIX_ITERATE()
  34. #else
  35. template <BOOST_PHOENIX_typename_A>
  36. BOOST_PHOENIX_SCOPE_ACTOR_GEN_NAME<
  37. BOOST_PP_CAT(vector, BOOST_PHOENIX_ITERATION)<BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL_TYPE, _)>
  38. , detail::map_local_index_to_tuple<BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL_KEY, _)>
  39. >
  40. BOOST_PHOENIX_SCOPE_ACTOR_GEN_FUNCTION (BOOST_PHOENIX_A_const_ref_a) BOOST_PHOENIX_SCOPE_ACTOR_GEN_CONST
  41. {
  42. typedef
  43. BOOST_PP_CAT(vector, BOOST_PHOENIX_ITERATION)<BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL_TYPE, _)>
  44. locals_type;
  45. locals_type locals = {BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL, _)};
  46. return
  47. BOOST_PHOENIX_SCOPE_ACTOR_GEN_NAME<
  48. locals_type
  49. , detail::map_local_index_to_tuple<
  50. BOOST_PP_ENUM(BOOST_PHOENIX_ITERATION, BOOST_PHOENIX_EXTRACT_LOCAL_KEY, _)
  51. >
  52. >(locals);
  53. }
  54. #endif