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;
19 struct decode_type_impl<boost::mpl::size_t<FUN_PTR_ID + n>, Iter>
22 BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
23 typedef BOOST_PP_CAT(p, n)(*type)(BOOST_PP_ENUM_PARAMS(n, p));
24 typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
27 #ifndef BOOST_TYPEOF_NO_FUNCTION_TYPES
29 // function references
31 template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
32 struct encode_type_impl<V, R(&)(BOOST_PP_ENUM_PARAMS(n, P))>
34 typedef R BOOST_PP_CAT(P, n);
35 typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_REF_ID + n) type;
39 struct decode_type_impl<boost::mpl::size_t<FUN_REF_ID + n>, Iter>
42 BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
43 typedef BOOST_PP_CAT(p, n)(&type)(BOOST_PP_ENUM_PARAMS(n, p));
44 typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
49 template<class V, class R BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
50 struct encode_type_impl<V, R(BOOST_PP_ENUM_PARAMS(n, P))>
52 typedef R BOOST_PP_CAT(P, n);
53 typedef BOOST_TYPEOF_ENCODE_PARAMS(BOOST_PP_INC(n), FUN_ID + n) type;
57 struct decode_type_impl<boost::mpl::size_t<FUN_ID + n>, Iter>
60 BOOST_TYPEOF_DECODE_PARAMS(BOOST_PP_INC(n))
61 typedef BOOST_PP_CAT(p, n)(type)(BOOST_PP_ENUM_PARAMS(n, p));
62 typedef BOOST_PP_CAT(iter, BOOST_PP_INC(n)) iter;
65 #endif//BOOST_TYPEOF_NO_FUNCTION_TYPES
69 #define BOOST_TYPEOF_qualifier
70 #define BOOST_TYPEOF_id MEM_FUN_ID
71 #include <boost/typeof/register_mem_functions.hpp>
73 #define BOOST_TYPEOF_qualifier const
74 #define BOOST_TYPEOF_id CONST_MEM_FUN_ID
75 #include <boost/typeof/register_mem_functions.hpp>
77 #define BOOST_TYPEOF_qualifier volatile
78 #define BOOST_TYPEOF_id VOLATILE_MEM_FUN_ID
79 #include <boost/typeof/register_mem_functions.hpp>
81 #define BOOST_TYPEOF_qualifier volatile const
82 #define BOOST_TYPEOF_id VOLATILE_CONST_MEM_FUN_ID
83 #include <boost/typeof/register_mem_functions.hpp>