Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 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 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 5 | #ifndef NDNBOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED |
| 6 | #define NDNBOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 7 | |
| 8 | #include <ndnboost/typeof/encode_decode_params.hpp> |
| 9 | #include <ndnboost/typeof/encode_decode.hpp> |
| 10 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 11 | #include NDNBOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 12 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 13 | NDNBOOST_TYPEOF_BEGIN_ENCODE_NS |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 14 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 15 | enum {PTR_DATA_MEM_ID = NDNBOOST_TYPEOF_UNIQUE_ID()}; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 16 | |
| 17 | template<class V, class P0, class P1> |
| 18 | struct encode_type_impl<V, P0 P1::*> |
| 19 | { |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 20 | typedef NDNBOOST_TYPEOF_ENCODE_PARAMS(2, PTR_DATA_MEM_ID) type; |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | template<class Iter> |
| 24 | struct decode_type_impl<ndnboost::mpl::size_t<PTR_DATA_MEM_ID>, Iter> |
| 25 | { |
| 26 | typedef Iter iter0; |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 27 | NDNBOOST_TYPEOF_DECODE_PARAMS(2) |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 28 | |
| 29 | template<class T> struct workaround{ |
| 30 | typedef p0 T::* type; |
| 31 | }; |
| 32 | typedef typename decode_type_impl<ndnboost::mpl::size_t<PTR_DATA_MEM_ID>, Iter>::template workaround<p1>::type type; |
| 33 | typedef iter2 iter; |
| 34 | }; |
| 35 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 36 | NDNBOOST_TYPEOF_END_ENCODE_NS |
Jeff Thompson | a28eed8 | 2013-08-22 16:21:10 -0700 | [diff] [blame] | 37 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 38 | #endif//NDNBOOST_TYPEOF_POINTERS_DATA_MEMBERS_HPP_INCLUDED |