encode_decode_params.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright (C) 2005 Arkadiy Vertleyb
  2. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
  5. #define BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED
  6. #include <boost/preprocessor/cat.hpp>
  7. #include <boost/preprocessor/repetition/repeat.hpp>
  8. // Assumes iter0 contains initial iterator
  9. #define BOOST_TYPEOF_DECODE_PARAM(z, n, text) \
  10. typedef boost::type_of::decode_type<iter##n> decode##n; \
  11. typedef typename decode##n::type p##n; \
  12. typedef typename decode##n::iter BOOST_PP_CAT(iter, BOOST_PP_INC(n));
  13. #define BOOST_TYPEOF_DECODE_PARAMS(n)\
  14. BOOST_PP_REPEAT(n, BOOST_TYPEOF_DECODE_PARAM, ~)
  15. // The P0, P1, ... PN are encoded and added to V
  16. #define BOOST_TYPEOF_ENCODE_PARAMS_BEGIN(z, n, text)\
  17. typename boost::type_of::encode_type<
  18. #define BOOST_TYPEOF_ENCODE_PARAMS_END(z, n, text)\
  19. , BOOST_PP_CAT(P, n)>::type
  20. #define BOOST_TYPEOF_ENCODE_PARAMS(n, ID) \
  21. BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_BEGIN, ~) \
  22. typename boost::type_of::push_back<V, boost::type_of::constant<std::size_t,ID> >::type \
  23. BOOST_PP_REPEAT(n, BOOST_TYPEOF_ENCODE_PARAMS_END, ~)
  24. #endif//BOOST_TYPEOF_ENCODE_DECODE_PARAMS_HPP_INCLUDED