combine_rvalue.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. // Boost.Range library
  2. //
  3. // Copyright Neil Groves 2014. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. // For more information, see http://www.boost.org/libs/range/
  9. //
  10. #define BOOST_RANGE_combined_args(z, n, i) \
  11. BOOST_PP_CAT(R, n)&& BOOST_PP_CAT(r, n)
  12. #define BOOST_RANGE_combined_range_iterator(z, n, i) \
  13. typename range_iterator< \
  14. typename remove_reference<BOOST_PP_CAT(R,n)>::type \
  15. >::type
  16. #define BOOST_RANGE_combine(z, n, data) \
  17. template <BOOST_PP_ENUM_PARAMS(n, typename R)> \
  18. inline range::combined_range< \
  19. tuple<BOOST_PP_ENUM(n, BOOST_RANGE_combined_range_iterator, ~)> \
  20. > \
  21. combine(BOOST_PP_ENUM(n, BOOST_RANGE_combined_args, ~)) \
  22. { \
  23. typedef tuple< \
  24. BOOST_PP_ENUM(n, BOOST_RANGE_combined_range_iterator, ~) \
  25. > rng_tuple_t; \
  26. return range::combined_range<rng_tuple_t>( \
  27. rng_tuple_t(BOOST_PP_ENUM(n, BOOST_RANGE_combined_seq, begin)), \
  28. rng_tuple_t(BOOST_PP_ENUM(n, BOOST_RANGE_combined_seq, end))); \
  29. }