tuple_expand.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*=============================================================================
  2. Copyright (c) 2001-2011 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 BOOST_PP_IS_ITERATING
  7. #if !defined(FUSION_TUPLE_EXPAND_10032005_0815)
  8. #define FUSION_TUPLE_EXPAND_10032005_0815
  9. #include <boost/preprocessor/iterate.hpp>
  10. #include <boost/preprocessor/repetition/enum_params.hpp>
  11. #include <boost/preprocessor/repetition/enum_binary_params.hpp>
  12. #define BOOST_PP_FILENAME_1 \
  13. <boost/fusion/tuple/detail/tuple_expand.hpp>
  14. #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
  15. #include BOOST_PP_ITERATE()
  16. #endif
  17. #else // defined(BOOST_PP_IS_ITERATING)
  18. ///////////////////////////////////////////////////////////////////////////////
  19. //
  20. // Preprocessor vertical repetition code
  21. //
  22. ///////////////////////////////////////////////////////////////////////////////
  23. #define N BOOST_PP_ITERATION()
  24. #if N == 1
  25. explicit
  26. #endif
  27. tuple(BOOST_PP_ENUM_BINARY_PARAMS(
  28. N, typename detail::call_param<T, >::type _))
  29. : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {}
  30. template <BOOST_PP_ENUM_PARAMS(N, typename U)>
  31. tuple(tuple<BOOST_PP_ENUM_PARAMS(N, U)> const& rhs)
  32. : base_type(rhs) {}
  33. template <BOOST_PP_ENUM_PARAMS(N, typename U)>
  34. tuple& operator=(tuple<BOOST_PP_ENUM_PARAMS(N, U)> const& rhs)
  35. {
  36. base_type::operator=(rhs);
  37. return *this;
  38. }
  39. #undef N
  40. #endif // defined(BOOST_PP_IS_ITERATING)