sequence.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef BOOST_METAPARSE_V1_CPP98_IMPL_SEQUENCE_HPP
  2. #define BOOST_METAPARSE_V1_CPP98_IMPL_SEQUENCE_HPP
  3. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. #include <boost/metaparse/v1/cpp98/impl/sequence_impl.hpp>
  8. #include <boost/metaparse/limit_sequence_size.hpp>
  9. #include <boost/mpl/vector.hpp>
  10. #include <boost/preprocessor/repetition/repeat_from_to.hpp>
  11. #include <boost/preprocessor/repetition/enum_params.hpp>
  12. #include <boost/preprocessor/cat.hpp>
  13. namespace boost
  14. {
  15. namespace metaparse
  16. {
  17. namespace v1
  18. {
  19. namespace impl
  20. {
  21. #ifdef BOOST_METAPARSE_SEQUENCE_CASE
  22. # error BOOST_METAPARSE_SEQUENCE_CASE already defined
  23. #endif
  24. #define BOOST_METAPARSE_SEQUENCE_CASE(z, n, unused) \
  25. template <BOOST_PP_ENUM_PARAMS(n, class P)> \
  26. struct BOOST_PP_CAT(sequence, n) \
  27. { \
  28. typedef BOOST_PP_CAT(sequence, n) type; \
  29. \
  30. template <class S, class Pos> \
  31. struct apply : \
  32. sequence_impl< \
  33. boost::mpl::vector<BOOST_PP_ENUM_PARAMS(n, P)>, \
  34. S, \
  35. Pos \
  36. > \
  37. {}; \
  38. };
  39. BOOST_PP_REPEAT_FROM_TO(
  40. 1,
  41. BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE,
  42. BOOST_METAPARSE_SEQUENCE_CASE,
  43. ~
  44. )
  45. #undef BOOST_METAPARSE_SEQUENCE_CASE
  46. }
  47. }
  48. }
  49. }
  50. #endif