Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/tti/detail/dmem_data.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children | c530137014c0 |
comparison
equal
deleted
inserted
replaced
15:663ca0da4350 | 16:2665513ce2d3 |
---|---|
1 | |
2 // (C) Copyright Edward Diener 2011,2012,2013 | |
3 // Use, modification and distribution are subject to the Boost Software License, | |
4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
5 // http://www.boost.org/LICENSE_1_0.txt). | |
6 | |
7 #if !defined(BOOST_TTI_DETAIL_MEM_DATA_HPP) | |
8 #define BOOST_TTI_DETAIL_MEM_DATA_HPP | |
9 | |
10 #include <boost/config.hpp> | |
11 #include <boost/detail/workaround.hpp> | |
12 #include <boost/function_types/components.hpp> | |
13 #include <boost/function_types/is_member_object_pointer.hpp> | |
14 #include <boost/mpl/assert.hpp> | |
15 #include <boost/mpl/bool.hpp> | |
16 #include <boost/mpl/eval_if.hpp> | |
17 #include <boost/mpl/identity.hpp> | |
18 #include <boost/preprocessor/cat.hpp> | |
19 #include <boost/tti/detail/ddeftype.hpp> | |
20 #include <boost/tti/detail/dftclass.hpp> | |
21 #include <boost/tti/gen/namespace_gen.hpp> | |
22 #include <boost/type_traits/detail/yes_no_type.hpp> | |
23 #include <boost/type_traits/is_same.hpp> | |
24 | |
25 #if defined(BOOST_MSVC) || (BOOST_WORKAROUND(BOOST_GCC, >= 40400) && BOOST_WORKAROUND(BOOST_GCC, < 40600)) | |
26 | |
27 #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \ | |
28 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_C> \ | |
29 struct BOOST_PP_CAT(trait,_detail_hmd) \ | |
30 { \ | |
31 template<class> \ | |
32 struct return_of; \ | |
33 \ | |
34 template<class BOOST_TTI_DETAIL_TP_R,class BOOST_TTI_DETAIL_TP_IC> \ | |
35 struct return_of<BOOST_TTI_DETAIL_TP_R BOOST_TTI_DETAIL_TP_IC::*> \ | |
36 { \ | |
37 typedef BOOST_TTI_DETAIL_TP_R type; \ | |
38 }; \ | |
39 \ | |
40 template<bool,typename BOOST_TTI_DETAIL_TP_U> \ | |
41 struct menable_if; \ | |
42 \ | |
43 template<typename BOOST_TTI_DETAIL_TP_U> \ | |
44 struct menable_if<true,BOOST_TTI_DETAIL_TP_U> \ | |
45 { \ | |
46 typedef BOOST_TTI_DETAIL_TP_U type; \ | |
47 }; \ | |
48 \ | |
49 template<typename BOOST_TTI_DETAIL_TP_U,typename BOOST_TTI_DETAIL_TP_V> \ | |
50 static ::boost::type_traits::yes_type check2(BOOST_TTI_DETAIL_TP_V BOOST_TTI_DETAIL_TP_U::*); \ | |
51 \ | |
52 template<typename BOOST_TTI_DETAIL_TP_U,typename BOOST_TTI_DETAIL_TP_V> \ | |
53 static ::boost::type_traits::no_type check2(BOOST_TTI_DETAIL_TP_U); \ | |
54 \ | |
55 template<typename BOOST_TTI_DETAIL_TP_U,typename BOOST_TTI_DETAIL_TP_V> \ | |
56 static typename \ | |
57 menable_if \ | |
58 < \ | |
59 sizeof(check2<BOOST_TTI_DETAIL_TP_U,BOOST_TTI_DETAIL_TP_V>(&BOOST_TTI_DETAIL_TP_U::name))==sizeof(::boost::type_traits::yes_type), \ | |
60 ::boost::type_traits::yes_type \ | |
61 > \ | |
62 ::type \ | |
63 has_matching_member(int); \ | |
64 \ | |
65 template<typename BOOST_TTI_DETAIL_TP_U,typename BOOST_TTI_DETAIL_TP_V> \ | |
66 static ::boost::type_traits::no_type has_matching_member(...); \ | |
67 \ | |
68 template<class BOOST_TTI_DETAIL_TP_U,class BOOST_TTI_DETAIL_TP_V> \ | |
69 struct ttc_md \ | |
70 { \ | |
71 typedef boost::mpl::bool_<sizeof(has_matching_member<BOOST_TTI_DETAIL_TP_V,typename return_of<BOOST_TTI_DETAIL_TP_U>::type>(0))==sizeof(::boost::type_traits::yes_type)> type; \ | |
72 }; \ | |
73 \ | |
74 typedef typename ttc_md<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_C>::type type; \ | |
75 \ | |
76 BOOST_STATIC_CONSTANT(bool,value=type::value); \ | |
77 \ | |
78 }; \ | |
79 /**/ | |
80 | |
81 #else // !defined(BOOST_MSVC) | |
82 | |
83 #include <boost/tti/detail/dmem_fun.hpp> | |
84 | |
85 #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_DATA(trait,name) \ | |
86 BOOST_TTI_DETAIL_TRAIT_HAS_TYPES_MEMBER_FUNCTION(trait,name) \ | |
87 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_C> \ | |
88 struct BOOST_PP_CAT(trait,_detail_hmd) : \ | |
89 BOOST_PP_CAT(trait,_detail_types)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_C> \ | |
90 { \ | |
91 }; \ | |
92 /**/ | |
93 | |
94 #endif // defined(BOOST_MSVC) | |
95 | |
96 namespace boost | |
97 { | |
98 namespace tti | |
99 { | |
100 namespace detail | |
101 { | |
102 | |
103 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_R> | |
104 struct ptmd | |
105 { | |
106 typedef BOOST_TTI_DETAIL_TP_R BOOST_TTI_DETAIL_TP_T::* type; | |
107 }; | |
108 | |
109 template<class BOOST_TTI_DETAIL_TP_T> | |
110 struct dmem_check_ptmd : | |
111 boost::mpl::identity<BOOST_TTI_DETAIL_TP_T> | |
112 { | |
113 BOOST_MPL_ASSERT((boost::function_types::is_member_object_pointer<BOOST_TTI_DETAIL_TP_T>)); | |
114 }; | |
115 | |
116 template<class BOOST_TTI_DETAIL_TP_T> | |
117 struct dmem_check_ptec : | |
118 BOOST_TTI_NAMESPACE::detail::class_type<BOOST_TTI_DETAIL_TP_T> | |
119 { | |
120 BOOST_MPL_ASSERT((boost::function_types::is_member_object_pointer<BOOST_TTI_DETAIL_TP_T>)); | |
121 }; | |
122 | |
123 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_T2> | |
124 struct dmem_get_type : | |
125 boost::mpl::eval_if | |
126 < | |
127 boost::is_same<BOOST_TTI_DETAIL_TP_T2,BOOST_TTI_NAMESPACE::detail::deftype>, | |
128 BOOST_TTI_NAMESPACE::detail::dmem_check_ptmd<BOOST_TTI_DETAIL_TP_T>, | |
129 BOOST_TTI_NAMESPACE::detail::ptmd<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_T2> | |
130 > | |
131 { | |
132 }; | |
133 | |
134 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_T2> | |
135 struct dmem_get_enclosing : | |
136 boost::mpl::eval_if | |
137 < | |
138 boost::is_same<BOOST_TTI_DETAIL_TP_T2,BOOST_TTI_NAMESPACE::detail::deftype>, | |
139 BOOST_TTI_NAMESPACE::detail::dmem_check_ptec<BOOST_TTI_DETAIL_TP_T>, | |
140 boost::mpl::identity<BOOST_TTI_DETAIL_TP_T> | |
141 > | |
142 { | |
143 }; | |
144 | |
145 } | |
146 } | |
147 } | |
148 | |
149 #endif // BOOST_TTI_DETAIL_MEM_DATA_HPP |