sequence.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*=============================================================================
  2. Copyright (c) 2001-2007 Joel de Guzman
  3. Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. ==============================================================================*/
  6. #ifndef PHOENIX_STATEMENT_SEQUENCE_HPP
  7. #define PHOENIX_STATEMENT_SEQUENCE_HPP
  8. #include <boost/spirit/home/phoenix/core/composite.hpp>
  9. #include <boost/spirit/home/phoenix/core/compose.hpp>
  10. namespace boost { namespace phoenix
  11. {
  12. struct sequence_eval
  13. {
  14. template <typename Env, typename A0, typename A1>
  15. struct result
  16. {
  17. typedef void type;
  18. };
  19. template <typename RT, typename Env, typename A0, typename A1>
  20. static void
  21. eval(Env const& env, A0& a0, A1& a1)
  22. {
  23. a0.eval(env);
  24. a1.eval(env);
  25. }
  26. };
  27. namespace detail
  28. {
  29. template <typename BaseT0, typename BaseT1>
  30. struct comma_result
  31. {
  32. typedef actor<
  33. typename as_composite<
  34. sequence_eval
  35. , actor<BaseT0>
  36. , actor<BaseT1>
  37. >::type
  38. > type;
  39. };
  40. }
  41. template <typename BaseT0, typename BaseT1>
  42. inline typename detail::comma_result<BaseT0, BaseT1>::type
  43. operator,(actor<BaseT0> const& a0, actor<BaseT1> const& a1)
  44. {
  45. return compose<sequence_eval>(a0, a1);
  46. }
  47. }}
  48. #endif