argument.hpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*==============================================================================
  2. Copyright (c) 2001-2010 Joel de Guzman
  3. Copyright (c) 2010 Eric Niebler
  4. Copyright (c) 2010-2011 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. #ifndef BOOST_PHOENIX_CORE_ARGUMENT_HPP
  9. #define BOOST_PHOENIX_CORE_ARGUMENT_HPP
  10. #include <boost/phoenix/core/limits.hpp>
  11. #include <boost/phoenix/core/actor.hpp>
  12. #include <boost/phoenix/core/expression.hpp>
  13. #include <boost/phoenix/core/terminal.hpp>
  14. #include <boost/mpl/int.hpp>
  15. namespace boost { namespace phoenix
  16. {
  17. ////////////////////////////////////////////////////////////////////////////
  18. //
  19. // argument
  20. //
  21. // function for evaluating argument placeholders like: _1
  22. //
  23. ////////////////////////////////////////////////////////////////////////////
  24. template <int I>
  25. struct argument
  26. //: mpl::int_<I>
  27. {
  28. typedef typename mpl::int_<I>::value_type value_type;
  29. static const value_type value = mpl::int_<I>::value;
  30. bool operator==(argument) const
  31. {
  32. return true;
  33. }
  34. template <int I2>
  35. bool operator==(argument<I2>) const
  36. {
  37. return false;
  38. }
  39. };
  40. }}
  41. namespace boost {
  42. template <int I>
  43. struct is_placeholder<phoenix::argument<I> >
  44. : mpl::int_<I>
  45. {};
  46. }
  47. namespace boost { namespace phoenix
  48. {
  49. namespace expression
  50. {
  51. template <int I>
  52. struct argument
  53. : expression::terminal<phoenix::argument<I> >
  54. {
  55. typedef typename expression::terminal<phoenix::argument<I> >::type type;
  56. static const type make()
  57. {
  58. type const e = {{{}}};
  59. return e;
  60. }
  61. };
  62. }
  63. #if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
  64. #include <boost/phoenix/core/detail/cpp03/preprocessed/argument.hpp>
  65. #else
  66. #if !defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  67. #include <boost/phoenix/core/detail/argument.hpp>
  68. #else
  69. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  70. #pragma wave option(preserve: 2, line: 0, output: "detail/cpp03/preprocessed/argument_predefined_" BOOST_PHOENIX_LIMIT_STR ".hpp")
  71. #endif
  72. /*==============================================================================
  73. Copyright (c) 2001-2010 Joel de Guzman
  74. Copyright (c) 2010-2011 Thomas Heller
  75. Distributed under the Boost Software License, Version 1.0. (See accompanying
  76. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  77. ==============================================================================*/
  78. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  79. #pragma wave option(preserve: 1)
  80. #endif
  81. #ifdef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
  82. #undef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
  83. #define BOOST_PHOENIX_NO_PREDEFINED_TERMINALS_RESTORE
  84. #endif
  85. #include <boost/phoenix/core/detail/argument.hpp>
  86. #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS_RESTORE
  87. #define BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
  88. #undef BOOST_PHOENIX_NO_PREDEFINED_TERIMINALS_RESTORE
  89. #endif
  90. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  91. #pragma wave option(output: null)
  92. #endif
  93. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  94. #pragma wave option(preserve: 2, line: 0, output: "detail/cpp03/preprocessed/argument_no_predefined_" BOOST_PHOENIX_LIMIT_STR ".hpp")
  95. #endif
  96. /*==============================================================================
  97. Copyright (c) 2001-2010 Joel de Guzman
  98. Copyright (c) 2010-2011 Thomas Heller
  99. Distributed under the Boost Software License, Version 1.0. (See accompanying
  100. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  101. ==============================================================================*/
  102. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  103. #pragma wave option(preserve: 1)
  104. #endif
  105. #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
  106. #define BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
  107. #define BOOST_PHOENIX_NO_PREDEFINED_TERMINALS_RESTORE
  108. #endif
  109. #include <boost/phoenix/core/detail/argument.hpp>
  110. #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS_RESTORE
  111. #undef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
  112. #undef BOOST_PHOENIX_NO_PREDEFINED_TERIMINALS_RESTORE
  113. #endif
  114. #if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
  115. #pragma wave option(output: null)
  116. #endif
  117. #endif
  118. #endif
  119. }}
  120. #endif