blob: 35de8c3b46eb6ec59a6c34010e002dc359d30266 [file] [log] [blame]
Jeff Thompsona28eed82013-08-22 16:21:10 -07001// 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
5#include <ndnboost/typeof/encode_decode_params.hpp>
6
7// member functions
8
Jeff Thompson3d613fd2013-10-15 15:39:04 -07009template<class V, class T, class R NDNBOOST_PP_ENUM_TRAILING_PARAMS(n, class P)>
10struct encode_type_impl<V, R(T::*)(NDNBOOST_PP_ENUM_PARAMS(n, P)) NDNBOOST_TYPEOF_qualifier>
Jeff Thompsona28eed82013-08-22 16:21:10 -070011{
Jeff Thompson3d613fd2013-10-15 15:39:04 -070012 typedef R NDNBOOST_PP_CAT(P, n);
13 typedef T NDNBOOST_PP_CAT(P, NDNBOOST_PP_INC(n));
14 typedef NDNBOOST_TYPEOF_ENCODE_PARAMS(NDNBOOST_PP_ADD(n, 2), NDNBOOST_TYPEOF_id + n) type;
Jeff Thompsona28eed82013-08-22 16:21:10 -070015};
16
17template<class Iter>
Jeff Thompson3d613fd2013-10-15 15:39:04 -070018struct decode_type_impl<ndnboost::mpl::size_t<NDNBOOST_TYPEOF_id + n>, Iter>
Jeff Thompsona28eed82013-08-22 16:21:10 -070019{
20 typedef Iter iter0;
Jeff Thompson3d613fd2013-10-15 15:39:04 -070021 NDNBOOST_TYPEOF_DECODE_PARAMS(NDNBOOST_PP_ADD(n, 2))
Jeff Thompsona28eed82013-08-22 16:21:10 -070022 template<class T> struct workaround{
Jeff Thompson3d613fd2013-10-15 15:39:04 -070023 typedef NDNBOOST_PP_CAT(p, n)(T::*type)(NDNBOOST_PP_ENUM_PARAMS(n, p)) NDNBOOST_TYPEOF_qualifier;
Jeff Thompsona28eed82013-08-22 16:21:10 -070024 };
Jeff Thompson3d613fd2013-10-15 15:39:04 -070025 typedef typename workaround<NDNBOOST_PP_CAT(p, NDNBOOST_PP_INC(n))>::type type;
26 typedef NDNBOOST_PP_CAT(iter, NDNBOOST_PP_ADD(n, 2)) iter;
Jeff Thompsona28eed82013-08-22 16:21:10 -070027};
28
29// undef parameters
30
Jeff Thompson3d613fd2013-10-15 15:39:04 -070031#undef NDNBOOST_TYPEOF_id
32#undef NDNBOOST_TYPEOF_qualifier