1 // Copyright (C) 2004 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)
5 #include <boost/typeof/encode_decode_params.hpp>
7 #define n BOOST_PP_ITERATION()
11 template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
12 struct encode_type_impl<V, R(*)(BOOST_PP_ENUM_PARAMS(n, P))>
14 typedef R BOOST_PP_CAT(P, n);
15 typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_PTR_ID + n) type;
18 template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
19 struct encode_type_impl<V, R(*)(BOOST_PP_ENUM_PARAMS(n, P) ...)>
21 typedef R BOOST_PP_CAT(P, n);
22 typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_VAR_PTR_ID + n) type;
26 struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
29 BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
30 typedef BOOST_PP_CAT(p, n)(*type)(BOOST_PP_ENUM_PARAMS(n, p));
31 typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
35 struct decode_type_impl<boost::mpl::size_t<FUN_VAR_PTR_ID + n>, Iter>
38 BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
39 typedef BOOST_PP_CAT(p, n)(*type)(BOOST_PP_ENUM_PARAMS(n, p) ...);
40 typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
43 #ifndef BOOST_TYPEOF_NO_FUNCTION_TYPES
45 // function references
47 template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
48 struct encode_type_impl<V, R(&)(BOOST_PP_ENUM_PARAMS(n, P))>
50 typedef R BOOST_PP_CAT(P, n);
51 typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_REF_ID + n) type;
54 template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
55 struct encode_type_impl<V, R(&)(BOOST_PP_ENUM_PARAMS(n, P) ...)>
57 typedef R BOOST_PP_CAT(P, n);
58 typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_VAR_REF_ID + n) type;
62 struct decode_type_impl<boost::mpl::size_t<FUN_REF_ID + n>, Iter>
65 BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
66 typedef BOOST_PP_CAT(p, n)(&type)(BOOST_PP_ENUM_PARAMS(n, p));
67 typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
71 struct decode_type_impl<boost::mpl::size_t<FUN_VAR_REF_ID + n>, Iter>
74 BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
75 typedef BOOST_PP_CAT(p, n)(&type)(BOOST_PP_ENUM_PARAMS(n, p) ...);
76 typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
81 template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
82 struct encode_type_impl<V, R(BOOST_PP_ENUM_PARAMS(n, P))>
84 typedef R BOOST_PP_CAT(P, n);
85 typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_ID + n) type;
88 template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
89 struct encode_type_impl<V, R(BOOST_PP_ENUM_PARAMS(n, P) ...)>
91 typedef R BOOST_PP_CAT(P, n);
92 typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_VAR_ID + n) type;
96 struct decode_type_impl<boost::mpl::size_t<FUN_ID + n>, Iter>
99 BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
100 typedef BOOST_PP_CAT(p, n)(type)(BOOST_PP_ENUM_PARAMS(n, p));
101 typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
105 struct decode_type_impl<boost::mpl::size_t<FUN_VAR_ID + n>, Iter>
108 BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
109 typedef BOOST_PP_CAT(p, n)(type)(BOOST_PP_ENUM_PARAMS(n, p) ...);
110 typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
113 #endif//BOOST_TYPEOF_NO_FUNCTION_TYPES
115 #ifndef BOOST_TYPEOF_NO_MEMBER_FUNCTION_TYPES
118 #define BOOST_TYPEOF_qualifier
119 #define BOOST_TYPEOF_id MEM_FUN_ID
120 #include <boost/typeof/register_mem_functions.hpp>
122 #define BOOST_TYPEOF_qualifier const
123 #define BOOST_TYPEOF_id CONST_MEM_FUN_ID
124 #include <boost/typeof/register_mem_functions.hpp>
126 #define BOOST_TYPEOF_qualifier volatile
127 #define BOOST_TYPEOF_id VOLATILE_MEM_FUN_ID
128 #include <boost/typeof/register_mem_functions.hpp>
130 #define BOOST_TYPEOF_qualifier volatile const
131 #define BOOST_TYPEOF_id VOLATILE_CONST_MEM_FUN_ID
132 #include <boost/typeof/register_mem_functions.hpp>