register_mem_functions.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (C) 2004 Arkadiy Vertleyb
  2. // Use, modification and distribution is subject to the Boost Software
  3. // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
  4. #include <boost/typeof/encode_decode_params.hpp>
  5. // member functions
  6. template<class V, class T, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
  7. struct encode_type_impl<V, R(T::*)(BOOST_PP_ENUM_PARAMS(n, P)) BOOST_TYPEOF_qualifier>
  8. {
  9. typedef R BOOST_PP_CAT(P, n);
  10. typedef T BOOST_PP_CAT(P, BOOST_PP_INC(n));
  11. typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_ADD(n, 2), BOOST_TYPEOF_id + n) type;
  12. };
  13. template<class Iter>
  14. struct decode_type_impl<boost::type_of::constant<std::size_t,BOOST_TYPEOF_id + n>, Iter>
  15. {
  16. typedef Iter iter0;
  17. BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_ADD(n, 2))
  18. template<class T> struct workaround{
  19. typedef BOOST_PP_CAT(p, n)(T::*type)(BOOST_PP_ENUM_PARAMS(n, p)) BOOST_TYPEOF_qualifier;
  20. };
  21. typedef typename workaround<BOOST_PP_CAT(p, BOOST_PP_INC(n))>::type type;
  22. typedef BOOST_PP_CAT(iter, BOOST_PP_ADD(n, 2)) iter;
  23. };
  24. // undef parameters
  25. #undef BOOST_TYPEOF_id
  26. #undef BOOST_TYPEOF_qualifier