| OLD | NEW |
| 1 // This file was GENERATED by command: | 1 // This file was GENERATED by command: |
| 2 // pump.py bind_internal.h.pump | 2 // pump.py bind_internal.h.pump |
| 3 // DO NOT EDIT BY HAND!!! | 3 // DO NOT EDIT BY HAND!!! |
| 4 | 4 |
| 5 | 5 |
| 6 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 6 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 7 // Use of this source code is governed by a BSD-style license that can be | 7 // Use of this source code is governed by a BSD-style license that can be |
| 8 // found in the LICENSE file. | 8 // found in the LICENSE file. |
| 9 | 9 |
| 10 #ifndef BASE_BIND_INTERNAL_H_ | 10 #ifndef BASE_BIND_INTERNAL_H_ |
| 11 #define BASE_BIND_INTERNAL_H_ | 11 #define BASE_BIND_INTERNAL_H_ |
| 12 #pragma once | 12 #pragma once |
| 13 | 13 |
| 14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 15 #include "base/callback_internal.h" | 15 #include "base/callback_internal.h" |
| 16 #include "base/template_util.h" | 16 #include "base/template_util.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 namespace internal { | 19 namespace internal { |
| 20 | 20 |
| 21 // The method by which a function is invoked is determined by 3 different | 21 // The method by which a function is invoked is determined by 3 different |
| 22 // dimensions: | 22 // dimensions: |
| 23 // | 23 // |
| 24 // 1) The type of function (normal, method, const-method) | 24 // 1) The type of function (normal or method). |
| 25 // 2) The arity of the function | 25 // 2) The arity of the function. |
| 26 // 3) The number of bound parameters. | 26 // 3) The number of bound parameters. |
| 27 // | 27 // |
| 28 // The FunctionTraitsN classes unwrap the function signature type to | 28 // The templates below handle the determination of each of these dimensions. |
| 29 // specialize based on the first two dimensions. The N in FunctionTraitsN | 29 // In brief: |
| 30 // specifies the 3rd dimension. We could have specified the unbound parameters | 30 // |
| 31 // via template parameters, but this method looked cleaner. | 31 // FunctionTraits<> -- Provides a normalied signature, and other traits. |
| 32 // | 32 // InvokerN<> -- Provides a DoInvoke() function that actually executes |
| 33 // The FunctionTraitsN contains a static DoInvoke() function that is the key to | 33 // a calback. |
| 34 // implementing type erasure in the Callback() classes. DoInvoke() is a static | 34 // InvokerStorageN<> -- Provides storage for the bound parameters, and |
| 35 // function with a fixed signature that is independent of StorageType; its | 35 // typedefs to the above. |
| 36 // first argument is a pointer to the non-templated common baseclass of | 36 // |
| 37 // StorageType. This lets us store pointer to DoInvoke() in a function pointer | 37 // More details about the design of each class is included in a comment closer |
| 38 // that has knowledge of the specific StorageType, and thus no knowledge of the | 38 // to their defition. |
| 39 // bound function and bound parameter types. | 39 |
| 40 // FunctionTraits<> |
| 41 // |
| 42 // The FunctionTraits<> template determines the type of function, and also |
| 43 // creates a NormalizedType used to select the InvokerN classes. It turns out |
| 44 // that syntactically, you only really have 2 variations when invoking a |
| 45 // funciton pointer: normal, and method. One is invoked func_ptr(arg1). The |
| 46 // other is invoked (*obj_->method_ptr(arg1)). |
| 47 // |
| 48 // However, in the type system, there are many more distinctions. In standard |
| 49 // C++, there's all variations of const, and volatile on the function pointer. |
| 50 // In Windows, there are additional calling conventions (eg., __stdcall, |
| 51 // __fastcall, etc.). FunctionTraits<> handles categorizing each of these into |
| 52 // a normalized signature. |
| 53 // |
| 54 // Having a NormalizedSignature signature, reduces the combinatoric |
| 55 // complexity of defintions for the InvokerN<> later. Even though there are |
| 56 // only 2 syntactic variations on invoking a function, without normalizing the |
| 57 // signature, there would need to be one specialization of InvokerN for each |
| 58 // unique (function_type, bound_arg, unbound_args) tuple in order to match all |
| 59 // function signatures. |
| 60 // |
| 61 // By normalizing the function signature, we reduce function_type to exactly 2. |
| 62 |
| 63 template <typename Sig> |
| 64 struct FunctionTraits; |
| 65 |
| 66 // Function: Arity 0. |
| 67 template <typename R> |
| 68 struct FunctionTraits<R(*)()> { |
| 69 typedef R (*NormalizedSig)(); |
| 70 typedef base::false_type IsMethod; |
| 71 }; |
| 72 |
| 73 // Method: Arity 0. |
| 74 template <typename R, typename T> |
| 75 struct FunctionTraits<R(T::*)()> { |
| 76 typedef R (T::*NormalizedSig)(); |
| 77 typedef base::true_type IsMethod; |
| 78 }; |
| 79 |
| 80 // Const Method: Arity 0. |
| 81 template <typename R, typename T> |
| 82 struct FunctionTraits<R(T::*)() const> { |
| 83 typedef R (T::*NormalizedSig)(); |
| 84 typedef base::true_type IsMethod; |
| 85 }; |
| 86 |
| 87 // Function: Arity 1. |
| 88 template <typename R, typename X1> |
| 89 struct FunctionTraits<R(*)(X1)> { |
| 90 typedef R (*NormalizedSig)(X1); |
| 91 typedef base::false_type IsMethod; |
| 92 }; |
| 93 |
| 94 // Method: Arity 1. |
| 95 template <typename R, typename T, typename X1> |
| 96 struct FunctionTraits<R(T::*)(X1)> { |
| 97 typedef R (T::*NormalizedSig)(X1); |
| 98 typedef base::true_type IsMethod; |
| 99 }; |
| 100 |
| 101 // Const Method: Arity 1. |
| 102 template <typename R, typename T, typename X1> |
| 103 struct FunctionTraits<R(T::*)(X1) const> { |
| 104 typedef R (T::*NormalizedSig)(X1); |
| 105 typedef base::true_type IsMethod; |
| 106 }; |
| 107 |
| 108 // Function: Arity 2. |
| 109 template <typename R, typename X1, typename X2> |
| 110 struct FunctionTraits<R(*)(X1, X2)> { |
| 111 typedef R (*NormalizedSig)(X1, X2); |
| 112 typedef base::false_type IsMethod; |
| 113 }; |
| 114 |
| 115 // Method: Arity 2. |
| 116 template <typename R, typename T, typename X1, typename X2> |
| 117 struct FunctionTraits<R(T::*)(X1, X2)> { |
| 118 typedef R (T::*NormalizedSig)(X1, X2); |
| 119 typedef base::true_type IsMethod; |
| 120 }; |
| 121 |
| 122 // Const Method: Arity 2. |
| 123 template <typename R, typename T, typename X1, typename X2> |
| 124 struct FunctionTraits<R(T::*)(X1, X2) const> { |
| 125 typedef R (T::*NormalizedSig)(X1, X2); |
| 126 typedef base::true_type IsMethod; |
| 127 }; |
| 128 |
| 129 // Function: Arity 3. |
| 130 template <typename R, typename X1, typename X2, typename X3> |
| 131 struct FunctionTraits<R(*)(X1, X2, X3)> { |
| 132 typedef R (*NormalizedSig)(X1, X2, X3); |
| 133 typedef base::false_type IsMethod; |
| 134 }; |
| 135 |
| 136 // Method: Arity 3. |
| 137 template <typename R, typename T, typename X1, typename X2, typename X3> |
| 138 struct FunctionTraits<R(T::*)(X1, X2, X3)> { |
| 139 typedef R (T::*NormalizedSig)(X1, X2, X3); |
| 140 typedef base::true_type IsMethod; |
| 141 }; |
| 142 |
| 143 // Const Method: Arity 3. |
| 144 template <typename R, typename T, typename X1, typename X2, typename X3> |
| 145 struct FunctionTraits<R(T::*)(X1, X2, X3) const> { |
| 146 typedef R (T::*NormalizedSig)(X1, X2, X3); |
| 147 typedef base::true_type IsMethod; |
| 148 }; |
| 149 |
| 150 // Function: Arity 4. |
| 151 template <typename R, typename X1, typename X2, typename X3, typename X4> |
| 152 struct FunctionTraits<R(*)(X1, X2, X3, X4)> { |
| 153 typedef R (*NormalizedSig)(X1, X2, X3, X4); |
| 154 typedef base::false_type IsMethod; |
| 155 }; |
| 156 |
| 157 // Method: Arity 4. |
| 158 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 159 typename X4> |
| 160 struct FunctionTraits<R(T::*)(X1, X2, X3, X4)> { |
| 161 typedef R (T::*NormalizedSig)(X1, X2, X3, X4); |
| 162 typedef base::true_type IsMethod; |
| 163 }; |
| 164 |
| 165 // Const Method: Arity 4. |
| 166 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 167 typename X4> |
| 168 struct FunctionTraits<R(T::*)(X1, X2, X3, X4) const> { |
| 169 typedef R (T::*NormalizedSig)(X1, X2, X3, X4); |
| 170 typedef base::true_type IsMethod; |
| 171 }; |
| 172 |
| 173 // Function: Arity 5. |
| 174 template <typename R, typename X1, typename X2, typename X3, typename X4, |
| 175 typename X5> |
| 176 struct FunctionTraits<R(*)(X1, X2, X3, X4, X5)> { |
| 177 typedef R (*NormalizedSig)(X1, X2, X3, X4, X5); |
| 178 typedef base::false_type IsMethod; |
| 179 }; |
| 180 |
| 181 // Method: Arity 5. |
| 182 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 183 typename X4, typename X5> |
| 184 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5)> { |
| 185 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5); |
| 186 typedef base::true_type IsMethod; |
| 187 }; |
| 188 |
| 189 // Const Method: Arity 5. |
| 190 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 191 typename X4, typename X5> |
| 192 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5) const> { |
| 193 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5); |
| 194 typedef base::true_type IsMethod; |
| 195 }; |
| 196 |
| 197 // Function: Arity 6. |
| 198 template <typename R, typename X1, typename X2, typename X3, typename X4, |
| 199 typename X5, typename X6> |
| 200 struct FunctionTraits<R(*)(X1, X2, X3, X4, X5, X6)> { |
| 201 typedef R (*NormalizedSig)(X1, X2, X3, X4, X5, X6); |
| 202 typedef base::false_type IsMethod; |
| 203 }; |
| 204 |
| 205 // Method: Arity 6. |
| 206 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 207 typename X4, typename X5, typename X6> |
| 208 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5, X6)> { |
| 209 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5, X6); |
| 210 typedef base::true_type IsMethod; |
| 211 }; |
| 212 |
| 213 // Const Method: Arity 6. |
| 214 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 215 typename X4, typename X5, typename X6> |
| 216 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5, X6) const> { |
| 217 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5, X6); |
| 218 typedef base::true_type IsMethod; |
| 219 }; |
| 220 |
| 221 // InvokerN<> |
| 222 // |
| 223 // The InvokerN templates contain a static DoInvoke() function that is the key |
| 224 // to implementing type erasure in the Callback() classes. |
| 225 // |
| 226 // DoInvoke() is a static function with a fixed signature that is independent |
| 227 // of StorageType; its first argument is a pointer to the non-templated common |
| 228 // baseclass of StorageType. This lets us store pointer to DoInvoke() in a |
| 229 // function pointer that has knowledge of the specific StorageType, and thus |
| 230 // no knowledge of the bound function and bound parameter types. |
| 40 // | 231 // |
| 41 // As long as we ensure that DoInvoke() is only used with pointers there were | 232 // As long as we ensure that DoInvoke() is only used with pointers there were |
| 42 // upcasted from the correct StorageType, we can be sure that execution is | 233 // upcasted from the correct StorageType, we can be sure that execution is |
| 43 // safe. | 234 // safe. |
| 44 | 235 // |
| 45 template <typename StorageType, typename Sig> | 236 // The InvokerN templates are the only point that knows the number of bound |
| 46 struct FunctionTraits0; | 237 // and unbound arguments. This is intentional because it allows the other |
| 238 // templates classes in the system to only have as many specializations as |
| 239 // the max arity of function we wish to support. |
| 240 |
| 241 template <typename StorageType, typename NormalizedSig> |
| 242 struct Invoker0; |
| 47 | 243 |
| 48 // Function: Arity 0 -> 0. | 244 // Function: Arity 0 -> 0. |
| 49 template <typename StorageType, typename R> | 245 template <typename StorageType, typename R> |
| 50 struct FunctionTraits0<StorageType, R(*)()> { | 246 struct Invoker0<StorageType, R(*)()> { |
| 51 typedef base::false_type IsMethod; | |
| 52 | |
| 53 static R DoInvoke(InvokerStorageBase* base) { | 247 static R DoInvoke(InvokerStorageBase* base) { |
| 54 StorageType* invoker = static_cast<StorageType*>(base); | 248 StorageType* invoker = static_cast<StorageType*>(base); |
| 55 return invoker->f_(); | 249 return invoker->f_(); |
| 56 } | 250 } |
| 57 }; | 251 }; |
| 58 | 252 |
| 59 // Function: Arity 1 -> 1. | 253 // Function: Arity 1 -> 1. |
| 60 template <typename StorageType, typename R,typename X1> | 254 template <typename StorageType, typename R,typename X1> |
| 61 struct FunctionTraits0<StorageType, R(*)(X1)> { | 255 struct Invoker0<StorageType, R(*)(X1)> { |
| 62 COMPILE_ASSERT( | 256 COMPILE_ASSERT( |
| 63 !( is_non_const_reference<X1>::value ), | 257 !( is_non_const_reference<X1>::value ), |
| 64 do_not_bind_functions_with_nonconst_ref); | 258 do_not_bind_functions_with_nonconst_ref); |
| 65 | 259 |
| 66 typedef base::false_type IsMethod; | |
| 67 | |
| 68 static R DoInvoke(InvokerStorageBase* base, const X1& x1) { | 260 static R DoInvoke(InvokerStorageBase* base, const X1& x1) { |
| 69 StorageType* invoker = static_cast<StorageType*>(base); | 261 StorageType* invoker = static_cast<StorageType*>(base); |
| 70 return invoker->f_(x1); | 262 return invoker->f_(x1); |
| 71 } | 263 } |
| 72 }; | 264 }; |
| 73 | 265 |
| 74 // Function: Arity 2 -> 2. | 266 // Function: Arity 2 -> 2. |
| 75 template <typename StorageType, typename R,typename X1, typename X2> | 267 template <typename StorageType, typename R,typename X1, typename X2> |
| 76 struct FunctionTraits0<StorageType, R(*)(X1, X2)> { | 268 struct Invoker0<StorageType, R(*)(X1, X2)> { |
| 77 COMPILE_ASSERT( | 269 COMPILE_ASSERT( |
| 78 !( is_non_const_reference<X1>::value || | 270 !( is_non_const_reference<X1>::value || |
| 79 is_non_const_reference<X2>::value ), | 271 is_non_const_reference<X2>::value ), |
| 80 do_not_bind_functions_with_nonconst_ref); | 272 do_not_bind_functions_with_nonconst_ref); |
| 81 | 273 |
| 82 typedef base::false_type IsMethod; | |
| 83 | |
| 84 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2) { | 274 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2) { |
| 85 StorageType* invoker = static_cast<StorageType*>(base); | 275 StorageType* invoker = static_cast<StorageType*>(base); |
| 86 return invoker->f_(x1, x2); | 276 return invoker->f_(x1, x2); |
| 87 } | 277 } |
| 88 }; | 278 }; |
| 89 | 279 |
| 90 // Function: Arity 3 -> 3. | 280 // Function: Arity 3 -> 3. |
| 91 template <typename StorageType, typename R,typename X1, typename X2, | 281 template <typename StorageType, typename R,typename X1, typename X2, |
| 92 typename X3> | 282 typename X3> |
| 93 struct FunctionTraits0<StorageType, R(*)(X1, X2, X3)> { | 283 struct Invoker0<StorageType, R(*)(X1, X2, X3)> { |
| 94 COMPILE_ASSERT( | 284 COMPILE_ASSERT( |
| 95 !( is_non_const_reference<X1>::value || | 285 !( is_non_const_reference<X1>::value || |
| 96 is_non_const_reference<X2>::value || | 286 is_non_const_reference<X2>::value || |
| 97 is_non_const_reference<X3>::value ), | 287 is_non_const_reference<X3>::value ), |
| 98 do_not_bind_functions_with_nonconst_ref); | 288 do_not_bind_functions_with_nonconst_ref); |
| 99 | 289 |
| 100 typedef base::false_type IsMethod; | |
| 101 | |
| 102 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | 290 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, |
| 103 const X3& x3) { | 291 const X3& x3) { |
| 104 StorageType* invoker = static_cast<StorageType*>(base); | 292 StorageType* invoker = static_cast<StorageType*>(base); |
| 105 return invoker->f_(x1, x2, x3); | 293 return invoker->f_(x1, x2, x3); |
| 106 } | 294 } |
| 107 }; | 295 }; |
| 108 | 296 |
| 109 // Function: Arity 4 -> 4. | 297 // Function: Arity 4 -> 4. |
| 110 template <typename StorageType, typename R,typename X1, typename X2, | 298 template <typename StorageType, typename R,typename X1, typename X2, |
| 111 typename X3, typename X4> | 299 typename X3, typename X4> |
| 112 struct FunctionTraits0<StorageType, R(*)(X1, X2, X3, X4)> { | 300 struct Invoker0<StorageType, R(*)(X1, X2, X3, X4)> { |
| 113 COMPILE_ASSERT( | 301 COMPILE_ASSERT( |
| 114 !( is_non_const_reference<X1>::value || | 302 !( is_non_const_reference<X1>::value || |
| 115 is_non_const_reference<X2>::value || | 303 is_non_const_reference<X2>::value || |
| 116 is_non_const_reference<X3>::value || | 304 is_non_const_reference<X3>::value || |
| 117 is_non_const_reference<X4>::value ), | 305 is_non_const_reference<X4>::value ), |
| 118 do_not_bind_functions_with_nonconst_ref); | 306 do_not_bind_functions_with_nonconst_ref); |
| 119 | 307 |
| 120 typedef base::false_type IsMethod; | |
| 121 | |
| 122 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | 308 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, |
| 123 const X3& x3, const X4& x4) { | 309 const X3& x3, const X4& x4) { |
| 124 StorageType* invoker = static_cast<StorageType*>(base); | 310 StorageType* invoker = static_cast<StorageType*>(base); |
| 125 return invoker->f_(x1, x2, x3, x4); | 311 return invoker->f_(x1, x2, x3, x4); |
| 126 } | 312 } |
| 127 }; | 313 }; |
| 128 | 314 |
| 129 // Function: Arity 5 -> 5. | 315 // Function: Arity 5 -> 5. |
| 130 template <typename StorageType, typename R,typename X1, typename X2, | 316 template <typename StorageType, typename R,typename X1, typename X2, |
| 131 typename X3, typename X4, typename X5> | 317 typename X3, typename X4, typename X5> |
| 132 struct FunctionTraits0<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 318 struct Invoker0<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 133 COMPILE_ASSERT( | 319 COMPILE_ASSERT( |
| 134 !( is_non_const_reference<X1>::value || | 320 !( is_non_const_reference<X1>::value || |
| 135 is_non_const_reference<X2>::value || | 321 is_non_const_reference<X2>::value || |
| 136 is_non_const_reference<X3>::value || | 322 is_non_const_reference<X3>::value || |
| 137 is_non_const_reference<X4>::value || | 323 is_non_const_reference<X4>::value || |
| 138 is_non_const_reference<X5>::value ), | 324 is_non_const_reference<X5>::value ), |
| 139 do_not_bind_functions_with_nonconst_ref); | 325 do_not_bind_functions_with_nonconst_ref); |
| 140 | 326 |
| 141 typedef base::false_type IsMethod; | |
| 142 | |
| 143 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | 327 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, |
| 144 const X3& x3, const X4& x4, const X5& x5) { | 328 const X3& x3, const X4& x4, const X5& x5) { |
| 145 StorageType* invoker = static_cast<StorageType*>(base); | 329 StorageType* invoker = static_cast<StorageType*>(base); |
| 146 return invoker->f_(x1, x2, x3, x4, x5); | 330 return invoker->f_(x1, x2, x3, x4, x5); |
| 147 } | 331 } |
| 148 }; | 332 }; |
| 149 | 333 |
| 150 // Function: Arity 6 -> 6. | 334 // Function: Arity 6 -> 6. |
| 151 template <typename StorageType, typename R,typename X1, typename X2, | 335 template <typename StorageType, typename R,typename X1, typename X2, |
| 152 typename X3, typename X4, typename X5, typename X6> | 336 typename X3, typename X4, typename X5, typename X6> |
| 153 struct FunctionTraits0<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 337 struct Invoker0<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 154 COMPILE_ASSERT( | 338 COMPILE_ASSERT( |
| 155 !( is_non_const_reference<X1>::value || | 339 !( is_non_const_reference<X1>::value || |
| 156 is_non_const_reference<X2>::value || | 340 is_non_const_reference<X2>::value || |
| 157 is_non_const_reference<X3>::value || | 341 is_non_const_reference<X3>::value || |
| 158 is_non_const_reference<X4>::value || | 342 is_non_const_reference<X4>::value || |
| 159 is_non_const_reference<X5>::value || | 343 is_non_const_reference<X5>::value || |
| 160 is_non_const_reference<X6>::value ), | 344 is_non_const_reference<X6>::value ), |
| 161 do_not_bind_functions_with_nonconst_ref); | 345 do_not_bind_functions_with_nonconst_ref); |
| 162 | 346 |
| 163 typedef base::false_type IsMethod; | |
| 164 | |
| 165 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | 347 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, |
| 166 const X3& x3, const X4& x4, const X5& x5, const X6& x6) { | 348 const X3& x3, const X4& x4, const X5& x5, const X6& x6) { |
| 167 StorageType* invoker = static_cast<StorageType*>(base); | 349 StorageType* invoker = static_cast<StorageType*>(base); |
| 168 return invoker->f_(x1, x2, x3, x4, x5, x6); | 350 return invoker->f_(x1, x2, x3, x4, x5, x6); |
| 169 } | 351 } |
| 170 }; | 352 }; |
| 171 | 353 |
| 172 template <typename StorageType, typename Sig> | 354 template <typename StorageType, typename NormalizedSig> |
| 173 struct FunctionTraits1; | 355 struct Invoker1; |
| 174 | 356 |
| 175 // Function: Arity 1 -> 0. | 357 // Function: Arity 1 -> 0. |
| 176 template <typename StorageType, typename R,typename X1> | 358 template <typename StorageType, typename R,typename X1> |
| 177 struct FunctionTraits1<StorageType, R(*)(X1)> { | 359 struct Invoker1<StorageType, R(*)(X1)> { |
| 178 COMPILE_ASSERT( | 360 COMPILE_ASSERT( |
| 179 !( is_non_const_reference<X1>::value ), | 361 !( is_non_const_reference<X1>::value ), |
| 180 do_not_bind_functions_with_nonconst_ref); | 362 do_not_bind_functions_with_nonconst_ref); |
| 181 | 363 |
| 182 typedef base::false_type IsMethod; | |
| 183 | |
| 184 static R DoInvoke(InvokerStorageBase* base) { | 364 static R DoInvoke(InvokerStorageBase* base) { |
| 185 StorageType* invoker = static_cast<StorageType*>(base); | 365 StorageType* invoker = static_cast<StorageType*>(base); |
| 186 return invoker->f_(Unwrap(invoker->p1_)); | 366 return invoker->f_(Unwrap(invoker->p1_)); |
| 187 } | 367 } |
| 188 }; | 368 }; |
| 189 | 369 |
| 190 // Method: Arity 0 -> 0. | 370 // Method: Arity 0 -> 0. |
| 191 template <typename StorageType, typename R, typename T> | 371 template <typename StorageType, typename R, typename T> |
| 192 struct FunctionTraits1<StorageType, R(T::*)()> { | 372 struct Invoker1<StorageType, R(T::*)()> { |
| 193 typedef base::true_type IsMethod; | |
| 194 | |
| 195 static R DoInvoke(InvokerStorageBase* base) { | 373 static R DoInvoke(InvokerStorageBase* base) { |
| 196 StorageType* invoker = static_cast<StorageType*>(base); | 374 StorageType* invoker = static_cast<StorageType*>(base); |
| 197 return (Unwrap(invoker->p1_)->*invoker->f_)(); | 375 return (Unwrap(invoker->p1_)->*invoker->f_)(); |
| 198 } | 376 } |
| 199 }; | 377 }; |
| 200 | 378 |
| 201 // Const Method: Arity 0 -> 0. | |
| 202 template <typename StorageType, typename R, typename T> | |
| 203 struct FunctionTraits1<StorageType, R(T::*)() const> { | |
| 204 typedef base::true_type IsMethod; | |
| 205 | |
| 206 static R DoInvoke(InvokerStorageBase* base ) { | |
| 207 StorageType* invoker = static_cast<StorageType*>(base); | |
| 208 return (Unwrap(invoker->p1_)->*invoker->f_)(); | |
| 209 } | |
| 210 }; | |
| 211 | |
| 212 // Function: Arity 2 -> 1. | 379 // Function: Arity 2 -> 1. |
| 213 template <typename StorageType, typename R,typename X1, typename X2> | 380 template <typename StorageType, typename R,typename X1, typename X2> |
| 214 struct FunctionTraits1<StorageType, R(*)(X1, X2)> { | 381 struct Invoker1<StorageType, R(*)(X1, X2)> { |
| 215 COMPILE_ASSERT( | 382 COMPILE_ASSERT( |
| 216 !( is_non_const_reference<X1>::value || | 383 !( is_non_const_reference<X1>::value || |
| 217 is_non_const_reference<X2>::value ), | 384 is_non_const_reference<X2>::value ), |
| 218 do_not_bind_functions_with_nonconst_ref); | 385 do_not_bind_functions_with_nonconst_ref); |
| 219 | 386 |
| 220 typedef base::false_type IsMethod; | |
| 221 | |
| 222 static R DoInvoke(InvokerStorageBase* base, const X2& x2) { | 387 static R DoInvoke(InvokerStorageBase* base, const X2& x2) { |
| 223 StorageType* invoker = static_cast<StorageType*>(base); | 388 StorageType* invoker = static_cast<StorageType*>(base); |
| 224 return invoker->f_(Unwrap(invoker->p1_), x2); | 389 return invoker->f_(Unwrap(invoker->p1_), x2); |
| 225 } | 390 } |
| 226 }; | 391 }; |
| 227 | 392 |
| 228 // Method: Arity 1 -> 1. | 393 // Method: Arity 1 -> 1. |
| 229 template <typename StorageType, typename R, typename T, typename X1> | 394 template <typename StorageType, typename R, typename T, typename X1> |
| 230 struct FunctionTraits1<StorageType, R(T::*)(X1)> { | 395 struct Invoker1<StorageType, R(T::*)(X1)> { |
| 231 COMPILE_ASSERT( | 396 COMPILE_ASSERT( |
| 232 !( is_non_const_reference<X1>::value ), | 397 !( is_non_const_reference<X1>::value ), |
| 233 do_not_bind_functions_with_nonconst_ref); | 398 do_not_bind_functions_with_nonconst_ref); |
| 234 | 399 |
| 235 typedef base::true_type IsMethod; | |
| 236 | |
| 237 static R DoInvoke(InvokerStorageBase* base, const X1& x1) { | 400 static R DoInvoke(InvokerStorageBase* base, const X1& x1) { |
| 238 StorageType* invoker = static_cast<StorageType*>(base); | 401 StorageType* invoker = static_cast<StorageType*>(base); |
| 239 return (Unwrap(invoker->p1_)->*invoker->f_)(x1); | 402 return (Unwrap(invoker->p1_)->*invoker->f_)(x1); |
| 240 } | 403 } |
| 241 }; | 404 }; |
| 242 | 405 |
| 243 // Const Method: Arity 1 -> 1. | |
| 244 template <typename StorageType, typename R, typename T, typename X1> | |
| 245 struct FunctionTraits1<StorageType, R(T::*)(X1) const> { | |
| 246 COMPILE_ASSERT( | |
| 247 !(is_non_const_reference<X1>::value ), | |
| 248 do_not_bind_functions_with_nonconst_ref); | |
| 249 | |
| 250 typedef base::true_type IsMethod; | |
| 251 | |
| 252 static R DoInvoke(InvokerStorageBase* base, const X1& x1) { | |
| 253 StorageType* invoker = static_cast<StorageType*>(base); | |
| 254 return (Unwrap(invoker->p1_)->*invoker->f_)(x1); | |
| 255 } | |
| 256 }; | |
| 257 | |
| 258 // Function: Arity 3 -> 2. | 406 // Function: Arity 3 -> 2. |
| 259 template <typename StorageType, typename R,typename X1, typename X2, | 407 template <typename StorageType, typename R,typename X1, typename X2, |
| 260 typename X3> | 408 typename X3> |
| 261 struct FunctionTraits1<StorageType, R(*)(X1, X2, X3)> { | 409 struct Invoker1<StorageType, R(*)(X1, X2, X3)> { |
| 262 COMPILE_ASSERT( | 410 COMPILE_ASSERT( |
| 263 !( is_non_const_reference<X1>::value || | 411 !( is_non_const_reference<X1>::value || |
| 264 is_non_const_reference<X2>::value || | 412 is_non_const_reference<X2>::value || |
| 265 is_non_const_reference<X3>::value ), | 413 is_non_const_reference<X3>::value ), |
| 266 do_not_bind_functions_with_nonconst_ref); | 414 do_not_bind_functions_with_nonconst_ref); |
| 267 | 415 |
| 268 typedef base::false_type IsMethod; | |
| 269 | |
| 270 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3) { | 416 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3) { |
| 271 StorageType* invoker = static_cast<StorageType*>(base); | 417 StorageType* invoker = static_cast<StorageType*>(base); |
| 272 return invoker->f_(Unwrap(invoker->p1_), x2, x3); | 418 return invoker->f_(Unwrap(invoker->p1_), x2, x3); |
| 273 } | 419 } |
| 274 }; | 420 }; |
| 275 | 421 |
| 276 // Method: Arity 2 -> 2. | 422 // Method: Arity 2 -> 2. |
| 277 template <typename StorageType, typename R, typename T, typename X1, | 423 template <typename StorageType, typename R, typename T, typename X1, |
| 278 typename X2> | 424 typename X2> |
| 279 struct FunctionTraits1<StorageType, R(T::*)(X1, X2)> { | 425 struct Invoker1<StorageType, R(T::*)(X1, X2)> { |
| 280 COMPILE_ASSERT( | 426 COMPILE_ASSERT( |
| 281 !( is_non_const_reference<X1>::value || | 427 !( is_non_const_reference<X1>::value || |
| 282 is_non_const_reference<X2>::value ), | 428 is_non_const_reference<X2>::value ), |
| 283 do_not_bind_functions_with_nonconst_ref); | 429 do_not_bind_functions_with_nonconst_ref); |
| 284 | 430 |
| 285 typedef base::true_type IsMethod; | |
| 286 | |
| 287 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2) { | 431 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2) { |
| 288 StorageType* invoker = static_cast<StorageType*>(base); | 432 StorageType* invoker = static_cast<StorageType*>(base); |
| 289 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2); | 433 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2); |
| 290 } | 434 } |
| 291 }; | 435 }; |
| 292 | 436 |
| 293 // Const Method: Arity 2 -> 2. | |
| 294 template <typename StorageType, typename R, typename T, typename X1, | |
| 295 typename X2> | |
| 296 struct FunctionTraits1<StorageType, R(T::*)(X1, X2) const> { | |
| 297 COMPILE_ASSERT( | |
| 298 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 299 ), | |
| 300 do_not_bind_functions_with_nonconst_ref); | |
| 301 | |
| 302 typedef base::true_type IsMethod; | |
| 303 | |
| 304 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2) { | |
| 305 StorageType* invoker = static_cast<StorageType*>(base); | |
| 306 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2); | |
| 307 } | |
| 308 }; | |
| 309 | |
| 310 // Function: Arity 4 -> 3. | 437 // Function: Arity 4 -> 3. |
| 311 template <typename StorageType, typename R,typename X1, typename X2, | 438 template <typename StorageType, typename R,typename X1, typename X2, |
| 312 typename X3, typename X4> | 439 typename X3, typename X4> |
| 313 struct FunctionTraits1<StorageType, R(*)(X1, X2, X3, X4)> { | 440 struct Invoker1<StorageType, R(*)(X1, X2, X3, X4)> { |
| 314 COMPILE_ASSERT( | 441 COMPILE_ASSERT( |
| 315 !( is_non_const_reference<X1>::value || | 442 !( is_non_const_reference<X1>::value || |
| 316 is_non_const_reference<X2>::value || | 443 is_non_const_reference<X2>::value || |
| 317 is_non_const_reference<X3>::value || | 444 is_non_const_reference<X3>::value || |
| 318 is_non_const_reference<X4>::value ), | 445 is_non_const_reference<X4>::value ), |
| 319 do_not_bind_functions_with_nonconst_ref); | 446 do_not_bind_functions_with_nonconst_ref); |
| 320 | 447 |
| 321 typedef base::false_type IsMethod; | |
| 322 | |
| 323 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | 448 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, |
| 324 const X4& x4) { | 449 const X4& x4) { |
| 325 StorageType* invoker = static_cast<StorageType*>(base); | 450 StorageType* invoker = static_cast<StorageType*>(base); |
| 326 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4); | 451 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4); |
| 327 } | 452 } |
| 328 }; | 453 }; |
| 329 | 454 |
| 330 // Method: Arity 3 -> 3. | 455 // Method: Arity 3 -> 3. |
| 331 template <typename StorageType, typename R, typename T, typename X1, | 456 template <typename StorageType, typename R, typename T, typename X1, |
| 332 typename X2, typename X3> | 457 typename X2, typename X3> |
| 333 struct FunctionTraits1<StorageType, R(T::*)(X1, X2, X3)> { | 458 struct Invoker1<StorageType, R(T::*)(X1, X2, X3)> { |
| 334 COMPILE_ASSERT( | 459 COMPILE_ASSERT( |
| 335 !( is_non_const_reference<X1>::value || | 460 !( is_non_const_reference<X1>::value || |
| 336 is_non_const_reference<X2>::value || | 461 is_non_const_reference<X2>::value || |
| 337 is_non_const_reference<X3>::value ), | 462 is_non_const_reference<X3>::value ), |
| 338 do_not_bind_functions_with_nonconst_ref); | 463 do_not_bind_functions_with_nonconst_ref); |
| 339 | 464 |
| 340 typedef base::true_type IsMethod; | |
| 341 | |
| 342 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | 465 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, |
| 343 const X3& x3) { | 466 const X3& x3) { |
| 344 StorageType* invoker = static_cast<StorageType*>(base); | 467 StorageType* invoker = static_cast<StorageType*>(base); |
| 345 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3); | 468 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3); |
| 346 } | 469 } |
| 347 }; | 470 }; |
| 348 | 471 |
| 349 // Const Method: Arity 3 -> 3. | |
| 350 template <typename StorageType, typename R, typename T, typename X1, | |
| 351 typename X2, typename X3> | |
| 352 struct FunctionTraits1<StorageType, R(T::*)(X1, X2, X3) const> { | |
| 353 COMPILE_ASSERT( | |
| 354 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 355 || is_non_const_reference<X3>::value ), | |
| 356 do_not_bind_functions_with_nonconst_ref); | |
| 357 | |
| 358 typedef base::true_type IsMethod; | |
| 359 | |
| 360 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 361 const X3& x3) { | |
| 362 StorageType* invoker = static_cast<StorageType*>(base); | |
| 363 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3); | |
| 364 } | |
| 365 }; | |
| 366 | |
| 367 // Function: Arity 5 -> 4. | 472 // Function: Arity 5 -> 4. |
| 368 template <typename StorageType, typename R,typename X1, typename X2, | 473 template <typename StorageType, typename R,typename X1, typename X2, |
| 369 typename X3, typename X4, typename X5> | 474 typename X3, typename X4, typename X5> |
| 370 struct FunctionTraits1<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 475 struct Invoker1<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 371 COMPILE_ASSERT( | 476 COMPILE_ASSERT( |
| 372 !( is_non_const_reference<X1>::value || | 477 !( is_non_const_reference<X1>::value || |
| 373 is_non_const_reference<X2>::value || | 478 is_non_const_reference<X2>::value || |
| 374 is_non_const_reference<X3>::value || | 479 is_non_const_reference<X3>::value || |
| 375 is_non_const_reference<X4>::value || | 480 is_non_const_reference<X4>::value || |
| 376 is_non_const_reference<X5>::value ), | 481 is_non_const_reference<X5>::value ), |
| 377 do_not_bind_functions_with_nonconst_ref); | 482 do_not_bind_functions_with_nonconst_ref); |
| 378 | 483 |
| 379 typedef base::false_type IsMethod; | |
| 380 | |
| 381 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | 484 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, |
| 382 const X4& x4, const X5& x5) { | 485 const X4& x4, const X5& x5) { |
| 383 StorageType* invoker = static_cast<StorageType*>(base); | 486 StorageType* invoker = static_cast<StorageType*>(base); |
| 384 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4, x5); | 487 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4, x5); |
| 385 } | 488 } |
| 386 }; | 489 }; |
| 387 | 490 |
| 388 // Method: Arity 4 -> 4. | 491 // Method: Arity 4 -> 4. |
| 389 template <typename StorageType, typename R, typename T, typename X1, | 492 template <typename StorageType, typename R, typename T, typename X1, |
| 390 typename X2, typename X3, typename X4> | 493 typename X2, typename X3, typename X4> |
| 391 struct FunctionTraits1<StorageType, R(T::*)(X1, X2, X3, X4)> { | 494 struct Invoker1<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 392 COMPILE_ASSERT( | 495 COMPILE_ASSERT( |
| 393 !( is_non_const_reference<X1>::value || | 496 !( is_non_const_reference<X1>::value || |
| 394 is_non_const_reference<X2>::value || | 497 is_non_const_reference<X2>::value || |
| 395 is_non_const_reference<X3>::value || | 498 is_non_const_reference<X3>::value || |
| 396 is_non_const_reference<X4>::value ), | 499 is_non_const_reference<X4>::value ), |
| 397 do_not_bind_functions_with_nonconst_ref); | 500 do_not_bind_functions_with_nonconst_ref); |
| 398 | 501 |
| 399 typedef base::true_type IsMethod; | |
| 400 | |
| 401 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | 502 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, |
| 402 const X3& x3, const X4& x4) { | 503 const X3& x3, const X4& x4) { |
| 403 StorageType* invoker = static_cast<StorageType*>(base); | 504 StorageType* invoker = static_cast<StorageType*>(base); |
| 404 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4); | 505 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4); |
| 405 } | 506 } |
| 406 }; | 507 }; |
| 407 | 508 |
| 408 // Const Method: Arity 4 -> 4. | |
| 409 template <typename StorageType, typename R, typename T, typename X1, | |
| 410 typename X2, typename X3, typename X4> | |
| 411 struct FunctionTraits1<StorageType, R(T::*)(X1, X2, X3, X4) const> { | |
| 412 COMPILE_ASSERT( | |
| 413 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 414 || is_non_const_reference<X3>::value || | |
| 415 is_non_const_reference<X4>::value ), | |
| 416 do_not_bind_functions_with_nonconst_ref); | |
| 417 | |
| 418 typedef base::true_type IsMethod; | |
| 419 | |
| 420 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 421 const X3& x3, const X4& x4) { | |
| 422 StorageType* invoker = static_cast<StorageType*>(base); | |
| 423 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4); | |
| 424 } | |
| 425 }; | |
| 426 | |
| 427 // Function: Arity 6 -> 5. | 509 // Function: Arity 6 -> 5. |
| 428 template <typename StorageType, typename R,typename X1, typename X2, | 510 template <typename StorageType, typename R,typename X1, typename X2, |
| 429 typename X3, typename X4, typename X5, typename X6> | 511 typename X3, typename X4, typename X5, typename X6> |
| 430 struct FunctionTraits1<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 512 struct Invoker1<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 431 COMPILE_ASSERT( | 513 COMPILE_ASSERT( |
| 432 !( is_non_const_reference<X1>::value || | 514 !( is_non_const_reference<X1>::value || |
| 433 is_non_const_reference<X2>::value || | 515 is_non_const_reference<X2>::value || |
| 434 is_non_const_reference<X3>::value || | 516 is_non_const_reference<X3>::value || |
| 435 is_non_const_reference<X4>::value || | 517 is_non_const_reference<X4>::value || |
| 436 is_non_const_reference<X5>::value || | 518 is_non_const_reference<X5>::value || |
| 437 is_non_const_reference<X6>::value ), | 519 is_non_const_reference<X6>::value ), |
| 438 do_not_bind_functions_with_nonconst_ref); | 520 do_not_bind_functions_with_nonconst_ref); |
| 439 | 521 |
| 440 typedef base::false_type IsMethod; | |
| 441 | |
| 442 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | 522 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, |
| 443 const X4& x4, const X5& x5, const X6& x6) { | 523 const X4& x4, const X5& x5, const X6& x6) { |
| 444 StorageType* invoker = static_cast<StorageType*>(base); | 524 StorageType* invoker = static_cast<StorageType*>(base); |
| 445 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4, x5, x6); | 525 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4, x5, x6); |
| 446 } | 526 } |
| 447 }; | 527 }; |
| 448 | 528 |
| 449 // Method: Arity 5 -> 5. | 529 // Method: Arity 5 -> 5. |
| 450 template <typename StorageType, typename R, typename T, typename X1, | 530 template <typename StorageType, typename R, typename T, typename X1, |
| 451 typename X2, typename X3, typename X4, typename X5> | 531 typename X2, typename X3, typename X4, typename X5> |
| 452 struct FunctionTraits1<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 532 struct Invoker1<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 453 COMPILE_ASSERT( | 533 COMPILE_ASSERT( |
| 454 !( is_non_const_reference<X1>::value || | 534 !( is_non_const_reference<X1>::value || |
| 455 is_non_const_reference<X2>::value || | 535 is_non_const_reference<X2>::value || |
| 456 is_non_const_reference<X3>::value || | 536 is_non_const_reference<X3>::value || |
| 457 is_non_const_reference<X4>::value || | 537 is_non_const_reference<X4>::value || |
| 458 is_non_const_reference<X5>::value ), | 538 is_non_const_reference<X5>::value ), |
| 459 do_not_bind_functions_with_nonconst_ref); | 539 do_not_bind_functions_with_nonconst_ref); |
| 460 | 540 |
| 461 typedef base::true_type IsMethod; | |
| 462 | |
| 463 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | 541 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, |
| 464 const X3& x3, const X4& x4, const X5& x5) { | 542 const X3& x3, const X4& x4, const X5& x5) { |
| 465 StorageType* invoker = static_cast<StorageType*>(base); | 543 StorageType* invoker = static_cast<StorageType*>(base); |
| 466 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4, x5); | 544 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4, x5); |
| 467 } | 545 } |
| 468 }; | 546 }; |
| 469 | 547 |
| 470 // Const Method: Arity 5 -> 5. | 548 template <typename StorageType, typename NormalizedSig> |
| 471 template <typename StorageType, typename R, typename T, typename X1, | 549 struct Invoker2; |
| 472 typename X2, typename X3, typename X4, typename X5> | |
| 473 struct FunctionTraits1<StorageType, R(T::*)(X1, X2, X3, X4, X5) const> { | |
| 474 COMPILE_ASSERT( | |
| 475 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 476 || is_non_const_reference<X3>::value || | |
| 477 is_non_const_reference<X4>::value || | |
| 478 is_non_const_reference<X5>::value ), | |
| 479 do_not_bind_functions_with_nonconst_ref); | |
| 480 | |
| 481 typedef base::true_type IsMethod; | |
| 482 | |
| 483 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 484 const X3& x3, const X4& x4, const X5& x5) { | |
| 485 StorageType* invoker = static_cast<StorageType*>(base); | |
| 486 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4, x5); | |
| 487 } | |
| 488 }; | |
| 489 | |
| 490 template <typename StorageType, typename Sig> | |
| 491 struct FunctionTraits2; | |
| 492 | 550 |
| 493 // Function: Arity 2 -> 0. | 551 // Function: Arity 2 -> 0. |
| 494 template <typename StorageType, typename R,typename X1, typename X2> | 552 template <typename StorageType, typename R,typename X1, typename X2> |
| 495 struct FunctionTraits2<StorageType, R(*)(X1, X2)> { | 553 struct Invoker2<StorageType, R(*)(X1, X2)> { |
| 496 COMPILE_ASSERT( | 554 COMPILE_ASSERT( |
| 497 !( is_non_const_reference<X1>::value || | 555 !( is_non_const_reference<X1>::value || |
| 498 is_non_const_reference<X2>::value ), | 556 is_non_const_reference<X2>::value ), |
| 499 do_not_bind_functions_with_nonconst_ref); | 557 do_not_bind_functions_with_nonconst_ref); |
| 500 | 558 |
| 501 typedef base::false_type IsMethod; | |
| 502 | |
| 503 static R DoInvoke(InvokerStorageBase* base) { | 559 static R DoInvoke(InvokerStorageBase* base) { |
| 504 StorageType* invoker = static_cast<StorageType*>(base); | 560 StorageType* invoker = static_cast<StorageType*>(base); |
| 505 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_)); | 561 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_)); |
| 506 } | 562 } |
| 507 }; | 563 }; |
| 508 | 564 |
| 509 // Method: Arity 1 -> 0. | 565 // Method: Arity 1 -> 0. |
| 510 template <typename StorageType, typename R, typename T, typename X1> | 566 template <typename StorageType, typename R, typename T, typename X1> |
| 511 struct FunctionTraits2<StorageType, R(T::*)(X1)> { | 567 struct Invoker2<StorageType, R(T::*)(X1)> { |
| 512 COMPILE_ASSERT( | 568 COMPILE_ASSERT( |
| 513 !( is_non_const_reference<X1>::value ), | 569 !( is_non_const_reference<X1>::value ), |
| 514 do_not_bind_functions_with_nonconst_ref); | 570 do_not_bind_functions_with_nonconst_ref); |
| 515 | 571 |
| 516 typedef base::true_type IsMethod; | |
| 517 | |
| 518 static R DoInvoke(InvokerStorageBase* base) { | 572 static R DoInvoke(InvokerStorageBase* base) { |
| 519 StorageType* invoker = static_cast<StorageType*>(base); | 573 StorageType* invoker = static_cast<StorageType*>(base); |
| 520 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_)); | 574 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_)); |
| 521 } | 575 } |
| 522 }; | 576 }; |
| 523 | 577 |
| 524 // Const Method: Arity 1 -> 0. | |
| 525 template <typename StorageType, typename R, typename T, typename X1> | |
| 526 struct FunctionTraits2<StorageType, R(T::*)(X1) const> { | |
| 527 COMPILE_ASSERT( | |
| 528 !(is_non_const_reference<X1>::value ), | |
| 529 do_not_bind_functions_with_nonconst_ref); | |
| 530 | |
| 531 typedef base::true_type IsMethod; | |
| 532 | |
| 533 static R DoInvoke(InvokerStorageBase* base ) { | |
| 534 StorageType* invoker = static_cast<StorageType*>(base); | |
| 535 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_)); | |
| 536 } | |
| 537 }; | |
| 538 | |
| 539 // Function: Arity 3 -> 1. | 578 // Function: Arity 3 -> 1. |
| 540 template <typename StorageType, typename R,typename X1, typename X2, | 579 template <typename StorageType, typename R,typename X1, typename X2, |
| 541 typename X3> | 580 typename X3> |
| 542 struct FunctionTraits2<StorageType, R(*)(X1, X2, X3)> { | 581 struct Invoker2<StorageType, R(*)(X1, X2, X3)> { |
| 543 COMPILE_ASSERT( | 582 COMPILE_ASSERT( |
| 544 !( is_non_const_reference<X1>::value || | 583 !( is_non_const_reference<X1>::value || |
| 545 is_non_const_reference<X2>::value || | 584 is_non_const_reference<X2>::value || |
| 546 is_non_const_reference<X3>::value ), | 585 is_non_const_reference<X3>::value ), |
| 547 do_not_bind_functions_with_nonconst_ref); | 586 do_not_bind_functions_with_nonconst_ref); |
| 548 | 587 |
| 549 typedef base::false_type IsMethod; | |
| 550 | |
| 551 static R DoInvoke(InvokerStorageBase* base, const X3& x3) { | 588 static R DoInvoke(InvokerStorageBase* base, const X3& x3) { |
| 552 StorageType* invoker = static_cast<StorageType*>(base); | 589 StorageType* invoker = static_cast<StorageType*>(base); |
| 553 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3); | 590 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3); |
| 554 } | 591 } |
| 555 }; | 592 }; |
| 556 | 593 |
| 557 // Method: Arity 2 -> 1. | 594 // Method: Arity 2 -> 1. |
| 558 template <typename StorageType, typename R, typename T, typename X1, | 595 template <typename StorageType, typename R, typename T, typename X1, |
| 559 typename X2> | 596 typename X2> |
| 560 struct FunctionTraits2<StorageType, R(T::*)(X1, X2)> { | 597 struct Invoker2<StorageType, R(T::*)(X1, X2)> { |
| 561 COMPILE_ASSERT( | 598 COMPILE_ASSERT( |
| 562 !( is_non_const_reference<X1>::value || | 599 !( is_non_const_reference<X1>::value || |
| 563 is_non_const_reference<X2>::value ), | 600 is_non_const_reference<X2>::value ), |
| 564 do_not_bind_functions_with_nonconst_ref); | 601 do_not_bind_functions_with_nonconst_ref); |
| 565 | 602 |
| 566 typedef base::true_type IsMethod; | |
| 567 | |
| 568 static R DoInvoke(InvokerStorageBase* base, const X2& x2) { | 603 static R DoInvoke(InvokerStorageBase* base, const X2& x2) { |
| 569 StorageType* invoker = static_cast<StorageType*>(base); | 604 StorageType* invoker = static_cast<StorageType*>(base); |
| 570 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2); | 605 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2); |
| 571 } | 606 } |
| 572 }; | 607 }; |
| 573 | 608 |
| 574 // Const Method: Arity 2 -> 1. | |
| 575 template <typename StorageType, typename R, typename T, typename X1, | |
| 576 typename X2> | |
| 577 struct FunctionTraits2<StorageType, R(T::*)(X1, X2) const> { | |
| 578 COMPILE_ASSERT( | |
| 579 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 580 ), | |
| 581 do_not_bind_functions_with_nonconst_ref); | |
| 582 | |
| 583 typedef base::true_type IsMethod; | |
| 584 | |
| 585 static R DoInvoke(InvokerStorageBase* base, const X2& x2) { | |
| 586 StorageType* invoker = static_cast<StorageType*>(base); | |
| 587 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2); | |
| 588 } | |
| 589 }; | |
| 590 | |
| 591 // Function: Arity 4 -> 2. | 609 // Function: Arity 4 -> 2. |
| 592 template <typename StorageType, typename R,typename X1, typename X2, | 610 template <typename StorageType, typename R,typename X1, typename X2, |
| 593 typename X3, typename X4> | 611 typename X3, typename X4> |
| 594 struct FunctionTraits2<StorageType, R(*)(X1, X2, X3, X4)> { | 612 struct Invoker2<StorageType, R(*)(X1, X2, X3, X4)> { |
| 595 COMPILE_ASSERT( | 613 COMPILE_ASSERT( |
| 596 !( is_non_const_reference<X1>::value || | 614 !( is_non_const_reference<X1>::value || |
| 597 is_non_const_reference<X2>::value || | 615 is_non_const_reference<X2>::value || |
| 598 is_non_const_reference<X3>::value || | 616 is_non_const_reference<X3>::value || |
| 599 is_non_const_reference<X4>::value ), | 617 is_non_const_reference<X4>::value ), |
| 600 do_not_bind_functions_with_nonconst_ref); | 618 do_not_bind_functions_with_nonconst_ref); |
| 601 | 619 |
| 602 typedef base::false_type IsMethod; | |
| 603 | |
| 604 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4) { | 620 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4) { |
| 605 StorageType* invoker = static_cast<StorageType*>(base); | 621 StorageType* invoker = static_cast<StorageType*>(base); |
| 606 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4); | 622 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4); |
| 607 } | 623 } |
| 608 }; | 624 }; |
| 609 | 625 |
| 610 // Method: Arity 3 -> 2. | 626 // Method: Arity 3 -> 2. |
| 611 template <typename StorageType, typename R, typename T, typename X1, | 627 template <typename StorageType, typename R, typename T, typename X1, |
| 612 typename X2, typename X3> | 628 typename X2, typename X3> |
| 613 struct FunctionTraits2<StorageType, R(T::*)(X1, X2, X3)> { | 629 struct Invoker2<StorageType, R(T::*)(X1, X2, X3)> { |
| 614 COMPILE_ASSERT( | 630 COMPILE_ASSERT( |
| 615 !( is_non_const_reference<X1>::value || | 631 !( is_non_const_reference<X1>::value || |
| 616 is_non_const_reference<X2>::value || | 632 is_non_const_reference<X2>::value || |
| 617 is_non_const_reference<X3>::value ), | 633 is_non_const_reference<X3>::value ), |
| 618 do_not_bind_functions_with_nonconst_ref); | 634 do_not_bind_functions_with_nonconst_ref); |
| 619 | 635 |
| 620 typedef base::true_type IsMethod; | |
| 621 | |
| 622 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3) { | 636 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3) { |
| 623 StorageType* invoker = static_cast<StorageType*>(base); | 637 StorageType* invoker = static_cast<StorageType*>(base); |
| 624 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3); | 638 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3); |
| 625 } | 639 } |
| 626 }; | 640 }; |
| 627 | 641 |
| 628 // Const Method: Arity 3 -> 2. | |
| 629 template <typename StorageType, typename R, typename T, typename X1, | |
| 630 typename X2, typename X3> | |
| 631 struct FunctionTraits2<StorageType, R(T::*)(X1, X2, X3) const> { | |
| 632 COMPILE_ASSERT( | |
| 633 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 634 || is_non_const_reference<X3>::value ), | |
| 635 do_not_bind_functions_with_nonconst_ref); | |
| 636 | |
| 637 typedef base::true_type IsMethod; | |
| 638 | |
| 639 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3) { | |
| 640 StorageType* invoker = static_cast<StorageType*>(base); | |
| 641 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3); | |
| 642 } | |
| 643 }; | |
| 644 | |
| 645 // Function: Arity 5 -> 3. | 642 // Function: Arity 5 -> 3. |
| 646 template <typename StorageType, typename R,typename X1, typename X2, | 643 template <typename StorageType, typename R,typename X1, typename X2, |
| 647 typename X3, typename X4, typename X5> | 644 typename X3, typename X4, typename X5> |
| 648 struct FunctionTraits2<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 645 struct Invoker2<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 649 COMPILE_ASSERT( | 646 COMPILE_ASSERT( |
| 650 !( is_non_const_reference<X1>::value || | 647 !( is_non_const_reference<X1>::value || |
| 651 is_non_const_reference<X2>::value || | 648 is_non_const_reference<X2>::value || |
| 652 is_non_const_reference<X3>::value || | 649 is_non_const_reference<X3>::value || |
| 653 is_non_const_reference<X4>::value || | 650 is_non_const_reference<X4>::value || |
| 654 is_non_const_reference<X5>::value ), | 651 is_non_const_reference<X5>::value ), |
| 655 do_not_bind_functions_with_nonconst_ref); | 652 do_not_bind_functions_with_nonconst_ref); |
| 656 | 653 |
| 657 typedef base::false_type IsMethod; | |
| 658 | |
| 659 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, | 654 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, |
| 660 const X5& x5) { | 655 const X5& x5) { |
| 661 StorageType* invoker = static_cast<StorageType*>(base); | 656 StorageType* invoker = static_cast<StorageType*>(base); |
| 662 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4, x5); | 657 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4, x5); |
| 663 } | 658 } |
| 664 }; | 659 }; |
| 665 | 660 |
| 666 // Method: Arity 4 -> 3. | 661 // Method: Arity 4 -> 3. |
| 667 template <typename StorageType, typename R, typename T, typename X1, | 662 template <typename StorageType, typename R, typename T, typename X1, |
| 668 typename X2, typename X3, typename X4> | 663 typename X2, typename X3, typename X4> |
| 669 struct FunctionTraits2<StorageType, R(T::*)(X1, X2, X3, X4)> { | 664 struct Invoker2<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 670 COMPILE_ASSERT( | 665 COMPILE_ASSERT( |
| 671 !( is_non_const_reference<X1>::value || | 666 !( is_non_const_reference<X1>::value || |
| 672 is_non_const_reference<X2>::value || | 667 is_non_const_reference<X2>::value || |
| 673 is_non_const_reference<X3>::value || | 668 is_non_const_reference<X3>::value || |
| 674 is_non_const_reference<X4>::value ), | 669 is_non_const_reference<X4>::value ), |
| 675 do_not_bind_functions_with_nonconst_ref); | 670 do_not_bind_functions_with_nonconst_ref); |
| 676 | 671 |
| 677 typedef base::true_type IsMethod; | |
| 678 | |
| 679 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | 672 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, |
| 680 const X4& x4) { | 673 const X4& x4) { |
| 681 StorageType* invoker = static_cast<StorageType*>(base); | 674 StorageType* invoker = static_cast<StorageType*>(base); |
| 682 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, | 675 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, |
| 683 x4); | 676 x4); |
| 684 } | 677 } |
| 685 }; | 678 }; |
| 686 | 679 |
| 687 // Const Method: Arity 4 -> 3. | |
| 688 template <typename StorageType, typename R, typename T, typename X1, | |
| 689 typename X2, typename X3, typename X4> | |
| 690 struct FunctionTraits2<StorageType, R(T::*)(X1, X2, X3, X4) const> { | |
| 691 COMPILE_ASSERT( | |
| 692 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 693 || is_non_const_reference<X3>::value || | |
| 694 is_non_const_reference<X4>::value ), | |
| 695 do_not_bind_functions_with_nonconst_ref); | |
| 696 | |
| 697 typedef base::true_type IsMethod; | |
| 698 | |
| 699 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | |
| 700 const X4& x4) { | |
| 701 StorageType* invoker = static_cast<StorageType*>(base); | |
| 702 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, | |
| 703 x4); | |
| 704 } | |
| 705 }; | |
| 706 | |
| 707 // Function: Arity 6 -> 4. | 680 // Function: Arity 6 -> 4. |
| 708 template <typename StorageType, typename R,typename X1, typename X2, | 681 template <typename StorageType, typename R,typename X1, typename X2, |
| 709 typename X3, typename X4, typename X5, typename X6> | 682 typename X3, typename X4, typename X5, typename X6> |
| 710 struct FunctionTraits2<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 683 struct Invoker2<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 711 COMPILE_ASSERT( | 684 COMPILE_ASSERT( |
| 712 !( is_non_const_reference<X1>::value || | 685 !( is_non_const_reference<X1>::value || |
| 713 is_non_const_reference<X2>::value || | 686 is_non_const_reference<X2>::value || |
| 714 is_non_const_reference<X3>::value || | 687 is_non_const_reference<X3>::value || |
| 715 is_non_const_reference<X4>::value || | 688 is_non_const_reference<X4>::value || |
| 716 is_non_const_reference<X5>::value || | 689 is_non_const_reference<X5>::value || |
| 717 is_non_const_reference<X6>::value ), | 690 is_non_const_reference<X6>::value ), |
| 718 do_not_bind_functions_with_nonconst_ref); | 691 do_not_bind_functions_with_nonconst_ref); |
| 719 | 692 |
| 720 typedef base::false_type IsMethod; | |
| 721 | |
| 722 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, | 693 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, |
| 723 const X5& x5, const X6& x6) { | 694 const X5& x5, const X6& x6) { |
| 724 StorageType* invoker = static_cast<StorageType*>(base); | 695 StorageType* invoker = static_cast<StorageType*>(base); |
| 725 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4, x5, | 696 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4, x5, |
| 726 x6); | 697 x6); |
| 727 } | 698 } |
| 728 }; | 699 }; |
| 729 | 700 |
| 730 // Method: Arity 5 -> 4. | 701 // Method: Arity 5 -> 4. |
| 731 template <typename StorageType, typename R, typename T, typename X1, | 702 template <typename StorageType, typename R, typename T, typename X1, |
| 732 typename X2, typename X3, typename X4, typename X5> | 703 typename X2, typename X3, typename X4, typename X5> |
| 733 struct FunctionTraits2<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 704 struct Invoker2<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 734 COMPILE_ASSERT( | 705 COMPILE_ASSERT( |
| 735 !( is_non_const_reference<X1>::value || | 706 !( is_non_const_reference<X1>::value || |
| 736 is_non_const_reference<X2>::value || | 707 is_non_const_reference<X2>::value || |
| 737 is_non_const_reference<X3>::value || | 708 is_non_const_reference<X3>::value || |
| 738 is_non_const_reference<X4>::value || | 709 is_non_const_reference<X4>::value || |
| 739 is_non_const_reference<X5>::value ), | 710 is_non_const_reference<X5>::value ), |
| 740 do_not_bind_functions_with_nonconst_ref); | 711 do_not_bind_functions_with_nonconst_ref); |
| 741 | 712 |
| 742 typedef base::true_type IsMethod; | |
| 743 | |
| 744 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | 713 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, |
| 745 const X4& x4, const X5& x5) { | 714 const X4& x4, const X5& x5) { |
| 746 StorageType* invoker = static_cast<StorageType*>(base); | 715 StorageType* invoker = static_cast<StorageType*>(base); |
| 747 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, | 716 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, |
| 748 x4, x5); | 717 x4, x5); |
| 749 } | 718 } |
| 750 }; | 719 }; |
| 751 | 720 |
| 752 // Const Method: Arity 5 -> 4. | 721 template <typename StorageType, typename NormalizedSig> |
| 753 template <typename StorageType, typename R, typename T, typename X1, | 722 struct Invoker3; |
| 754 typename X2, typename X3, typename X4, typename X5> | |
| 755 struct FunctionTraits2<StorageType, R(T::*)(X1, X2, X3, X4, X5) const> { | |
| 756 COMPILE_ASSERT( | |
| 757 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 758 || is_non_const_reference<X3>::value || | |
| 759 is_non_const_reference<X4>::value || | |
| 760 is_non_const_reference<X5>::value ), | |
| 761 do_not_bind_functions_with_nonconst_ref); | |
| 762 | |
| 763 typedef base::true_type IsMethod; | |
| 764 | |
| 765 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | |
| 766 const X4& x4, const X5& x5) { | |
| 767 StorageType* invoker = static_cast<StorageType*>(base); | |
| 768 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, | |
| 769 x4, x5); | |
| 770 } | |
| 771 }; | |
| 772 | |
| 773 template <typename StorageType, typename Sig> | |
| 774 struct FunctionTraits3; | |
| 775 | 723 |
| 776 // Function: Arity 3 -> 0. | 724 // Function: Arity 3 -> 0. |
| 777 template <typename StorageType, typename R,typename X1, typename X2, | 725 template <typename StorageType, typename R,typename X1, typename X2, |
| 778 typename X3> | 726 typename X3> |
| 779 struct FunctionTraits3<StorageType, R(*)(X1, X2, X3)> { | 727 struct Invoker3<StorageType, R(*)(X1, X2, X3)> { |
| 780 COMPILE_ASSERT( | 728 COMPILE_ASSERT( |
| 781 !( is_non_const_reference<X1>::value || | 729 !( is_non_const_reference<X1>::value || |
| 782 is_non_const_reference<X2>::value || | 730 is_non_const_reference<X2>::value || |
| 783 is_non_const_reference<X3>::value ), | 731 is_non_const_reference<X3>::value ), |
| 784 do_not_bind_functions_with_nonconst_ref); | 732 do_not_bind_functions_with_nonconst_ref); |
| 785 | 733 |
| 786 typedef base::false_type IsMethod; | |
| 787 | |
| 788 static R DoInvoke(InvokerStorageBase* base) { | 734 static R DoInvoke(InvokerStorageBase* base) { |
| 789 StorageType* invoker = static_cast<StorageType*>(base); | 735 StorageType* invoker = static_cast<StorageType*>(base); |
| 790 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 736 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 791 Unwrap(invoker->p3_)); | 737 Unwrap(invoker->p3_)); |
| 792 } | 738 } |
| 793 }; | 739 }; |
| 794 | 740 |
| 795 // Method: Arity 2 -> 0. | 741 // Method: Arity 2 -> 0. |
| 796 template <typename StorageType, typename R, typename T, typename X1, | 742 template <typename StorageType, typename R, typename T, typename X1, |
| 797 typename X2> | 743 typename X2> |
| 798 struct FunctionTraits3<StorageType, R(T::*)(X1, X2)> { | 744 struct Invoker3<StorageType, R(T::*)(X1, X2)> { |
| 799 COMPILE_ASSERT( | 745 COMPILE_ASSERT( |
| 800 !( is_non_const_reference<X1>::value || | 746 !( is_non_const_reference<X1>::value || |
| 801 is_non_const_reference<X2>::value ), | 747 is_non_const_reference<X2>::value ), |
| 802 do_not_bind_functions_with_nonconst_ref); | 748 do_not_bind_functions_with_nonconst_ref); |
| 803 | 749 |
| 804 typedef base::true_type IsMethod; | |
| 805 | |
| 806 static R DoInvoke(InvokerStorageBase* base) { | 750 static R DoInvoke(InvokerStorageBase* base) { |
| 807 StorageType* invoker = static_cast<StorageType*>(base); | 751 StorageType* invoker = static_cast<StorageType*>(base); |
| 808 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 752 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 809 Unwrap(invoker->p3_)); | 753 Unwrap(invoker->p3_)); |
| 810 } | 754 } |
| 811 }; | 755 }; |
| 812 | 756 |
| 813 // Const Method: Arity 2 -> 0. | |
| 814 template <typename StorageType, typename R, typename T, typename X1, | |
| 815 typename X2> | |
| 816 struct FunctionTraits3<StorageType, R(T::*)(X1, X2) const> { | |
| 817 COMPILE_ASSERT( | |
| 818 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 819 ), | |
| 820 do_not_bind_functions_with_nonconst_ref); | |
| 821 | |
| 822 typedef base::true_type IsMethod; | |
| 823 | |
| 824 static R DoInvoke(InvokerStorageBase* base ) { | |
| 825 StorageType* invoker = static_cast<StorageType*>(base); | |
| 826 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 827 Unwrap(invoker->p3_)); | |
| 828 } | |
| 829 }; | |
| 830 | |
| 831 // Function: Arity 4 -> 1. | 757 // Function: Arity 4 -> 1. |
| 832 template <typename StorageType, typename R,typename X1, typename X2, | 758 template <typename StorageType, typename R,typename X1, typename X2, |
| 833 typename X3, typename X4> | 759 typename X3, typename X4> |
| 834 struct FunctionTraits3<StorageType, R(*)(X1, X2, X3, X4)> { | 760 struct Invoker3<StorageType, R(*)(X1, X2, X3, X4)> { |
| 835 COMPILE_ASSERT( | 761 COMPILE_ASSERT( |
| 836 !( is_non_const_reference<X1>::value || | 762 !( is_non_const_reference<X1>::value || |
| 837 is_non_const_reference<X2>::value || | 763 is_non_const_reference<X2>::value || |
| 838 is_non_const_reference<X3>::value || | 764 is_non_const_reference<X3>::value || |
| 839 is_non_const_reference<X4>::value ), | 765 is_non_const_reference<X4>::value ), |
| 840 do_not_bind_functions_with_nonconst_ref); | 766 do_not_bind_functions_with_nonconst_ref); |
| 841 | 767 |
| 842 typedef base::false_type IsMethod; | |
| 843 | |
| 844 static R DoInvoke(InvokerStorageBase* base, const X4& x4) { | 768 static R DoInvoke(InvokerStorageBase* base, const X4& x4) { |
| 845 StorageType* invoker = static_cast<StorageType*>(base); | 769 StorageType* invoker = static_cast<StorageType*>(base); |
| 846 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 770 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 847 Unwrap(invoker->p3_), x4); | 771 Unwrap(invoker->p3_), x4); |
| 848 } | 772 } |
| 849 }; | 773 }; |
| 850 | 774 |
| 851 // Method: Arity 3 -> 1. | 775 // Method: Arity 3 -> 1. |
| 852 template <typename StorageType, typename R, typename T, typename X1, | 776 template <typename StorageType, typename R, typename T, typename X1, |
| 853 typename X2, typename X3> | 777 typename X2, typename X3> |
| 854 struct FunctionTraits3<StorageType, R(T::*)(X1, X2, X3)> { | 778 struct Invoker3<StorageType, R(T::*)(X1, X2, X3)> { |
| 855 COMPILE_ASSERT( | 779 COMPILE_ASSERT( |
| 856 !( is_non_const_reference<X1>::value || | 780 !( is_non_const_reference<X1>::value || |
| 857 is_non_const_reference<X2>::value || | 781 is_non_const_reference<X2>::value || |
| 858 is_non_const_reference<X3>::value ), | 782 is_non_const_reference<X3>::value ), |
| 859 do_not_bind_functions_with_nonconst_ref); | 783 do_not_bind_functions_with_nonconst_ref); |
| 860 | 784 |
| 861 typedef base::true_type IsMethod; | |
| 862 | |
| 863 static R DoInvoke(InvokerStorageBase* base, const X3& x3) { | 785 static R DoInvoke(InvokerStorageBase* base, const X3& x3) { |
| 864 StorageType* invoker = static_cast<StorageType*>(base); | 786 StorageType* invoker = static_cast<StorageType*>(base); |
| 865 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 787 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 866 Unwrap(invoker->p3_), x3); | 788 Unwrap(invoker->p3_), x3); |
| 867 } | 789 } |
| 868 }; | 790 }; |
| 869 | 791 |
| 870 // Const Method: Arity 3 -> 1. | |
| 871 template <typename StorageType, typename R, typename T, typename X1, | |
| 872 typename X2, typename X3> | |
| 873 struct FunctionTraits3<StorageType, R(T::*)(X1, X2, X3) const> { | |
| 874 COMPILE_ASSERT( | |
| 875 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 876 || is_non_const_reference<X3>::value ), | |
| 877 do_not_bind_functions_with_nonconst_ref); | |
| 878 | |
| 879 typedef base::true_type IsMethod; | |
| 880 | |
| 881 static R DoInvoke(InvokerStorageBase* base, const X3& x3) { | |
| 882 StorageType* invoker = static_cast<StorageType*>(base); | |
| 883 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 884 Unwrap(invoker->p3_), x3); | |
| 885 } | |
| 886 }; | |
| 887 | |
| 888 // Function: Arity 5 -> 2. | 792 // Function: Arity 5 -> 2. |
| 889 template <typename StorageType, typename R,typename X1, typename X2, | 793 template <typename StorageType, typename R,typename X1, typename X2, |
| 890 typename X3, typename X4, typename X5> | 794 typename X3, typename X4, typename X5> |
| 891 struct FunctionTraits3<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 795 struct Invoker3<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 892 COMPILE_ASSERT( | 796 COMPILE_ASSERT( |
| 893 !( is_non_const_reference<X1>::value || | 797 !( is_non_const_reference<X1>::value || |
| 894 is_non_const_reference<X2>::value || | 798 is_non_const_reference<X2>::value || |
| 895 is_non_const_reference<X3>::value || | 799 is_non_const_reference<X3>::value || |
| 896 is_non_const_reference<X4>::value || | 800 is_non_const_reference<X4>::value || |
| 897 is_non_const_reference<X5>::value ), | 801 is_non_const_reference<X5>::value ), |
| 898 do_not_bind_functions_with_nonconst_ref); | 802 do_not_bind_functions_with_nonconst_ref); |
| 899 | 803 |
| 900 typedef base::false_type IsMethod; | |
| 901 | |
| 902 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5) { | 804 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5) { |
| 903 StorageType* invoker = static_cast<StorageType*>(base); | 805 StorageType* invoker = static_cast<StorageType*>(base); |
| 904 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 806 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 905 Unwrap(invoker->p3_), x4, x5); | 807 Unwrap(invoker->p3_), x4, x5); |
| 906 } | 808 } |
| 907 }; | 809 }; |
| 908 | 810 |
| 909 // Method: Arity 4 -> 2. | 811 // Method: Arity 4 -> 2. |
| 910 template <typename StorageType, typename R, typename T, typename X1, | 812 template <typename StorageType, typename R, typename T, typename X1, |
| 911 typename X2, typename X3, typename X4> | 813 typename X2, typename X3, typename X4> |
| 912 struct FunctionTraits3<StorageType, R(T::*)(X1, X2, X3, X4)> { | 814 struct Invoker3<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 913 COMPILE_ASSERT( | 815 COMPILE_ASSERT( |
| 914 !( is_non_const_reference<X1>::value || | 816 !( is_non_const_reference<X1>::value || |
| 915 is_non_const_reference<X2>::value || | 817 is_non_const_reference<X2>::value || |
| 916 is_non_const_reference<X3>::value || | 818 is_non_const_reference<X3>::value || |
| 917 is_non_const_reference<X4>::value ), | 819 is_non_const_reference<X4>::value ), |
| 918 do_not_bind_functions_with_nonconst_ref); | 820 do_not_bind_functions_with_nonconst_ref); |
| 919 | 821 |
| 920 typedef base::true_type IsMethod; | |
| 921 | |
| 922 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4) { | 822 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4) { |
| 923 StorageType* invoker = static_cast<StorageType*>(base); | 823 StorageType* invoker = static_cast<StorageType*>(base); |
| 924 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 824 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 925 Unwrap(invoker->p3_), x3, x4); | 825 Unwrap(invoker->p3_), x3, x4); |
| 926 } | 826 } |
| 927 }; | 827 }; |
| 928 | 828 |
| 929 // Const Method: Arity 4 -> 2. | |
| 930 template <typename StorageType, typename R, typename T, typename X1, | |
| 931 typename X2, typename X3, typename X4> | |
| 932 struct FunctionTraits3<StorageType, R(T::*)(X1, X2, X3, X4) const> { | |
| 933 COMPILE_ASSERT( | |
| 934 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 935 || is_non_const_reference<X3>::value || | |
| 936 is_non_const_reference<X4>::value ), | |
| 937 do_not_bind_functions_with_nonconst_ref); | |
| 938 | |
| 939 typedef base::true_type IsMethod; | |
| 940 | |
| 941 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4) { | |
| 942 StorageType* invoker = static_cast<StorageType*>(base); | |
| 943 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 944 Unwrap(invoker->p3_), x3, x4); | |
| 945 } | |
| 946 }; | |
| 947 | |
| 948 // Function: Arity 6 -> 3. | 829 // Function: Arity 6 -> 3. |
| 949 template <typename StorageType, typename R,typename X1, typename X2, | 830 template <typename StorageType, typename R,typename X1, typename X2, |
| 950 typename X3, typename X4, typename X5, typename X6> | 831 typename X3, typename X4, typename X5, typename X6> |
| 951 struct FunctionTraits3<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 832 struct Invoker3<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 952 COMPILE_ASSERT( | 833 COMPILE_ASSERT( |
| 953 !( is_non_const_reference<X1>::value || | 834 !( is_non_const_reference<X1>::value || |
| 954 is_non_const_reference<X2>::value || | 835 is_non_const_reference<X2>::value || |
| 955 is_non_const_reference<X3>::value || | 836 is_non_const_reference<X3>::value || |
| 956 is_non_const_reference<X4>::value || | 837 is_non_const_reference<X4>::value || |
| 957 is_non_const_reference<X5>::value || | 838 is_non_const_reference<X5>::value || |
| 958 is_non_const_reference<X6>::value ), | 839 is_non_const_reference<X6>::value ), |
| 959 do_not_bind_functions_with_nonconst_ref); | 840 do_not_bind_functions_with_nonconst_ref); |
| 960 | 841 |
| 961 typedef base::false_type IsMethod; | |
| 962 | |
| 963 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5, | 842 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5, |
| 964 const X6& x6) { | 843 const X6& x6) { |
| 965 StorageType* invoker = static_cast<StorageType*>(base); | 844 StorageType* invoker = static_cast<StorageType*>(base); |
| 966 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 845 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 967 Unwrap(invoker->p3_), x4, x5, x6); | 846 Unwrap(invoker->p3_), x4, x5, x6); |
| 968 } | 847 } |
| 969 }; | 848 }; |
| 970 | 849 |
| 971 // Method: Arity 5 -> 3. | 850 // Method: Arity 5 -> 3. |
| 972 template <typename StorageType, typename R, typename T, typename X1, | 851 template <typename StorageType, typename R, typename T, typename X1, |
| 973 typename X2, typename X3, typename X4, typename X5> | 852 typename X2, typename X3, typename X4, typename X5> |
| 974 struct FunctionTraits3<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 853 struct Invoker3<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 975 COMPILE_ASSERT( | 854 COMPILE_ASSERT( |
| 976 !( is_non_const_reference<X1>::value || | 855 !( is_non_const_reference<X1>::value || |
| 977 is_non_const_reference<X2>::value || | 856 is_non_const_reference<X2>::value || |
| 978 is_non_const_reference<X3>::value || | 857 is_non_const_reference<X3>::value || |
| 979 is_non_const_reference<X4>::value || | 858 is_non_const_reference<X4>::value || |
| 980 is_non_const_reference<X5>::value ), | 859 is_non_const_reference<X5>::value ), |
| 981 do_not_bind_functions_with_nonconst_ref); | 860 do_not_bind_functions_with_nonconst_ref); |
| 982 | 861 |
| 983 typedef base::true_type IsMethod; | |
| 984 | |
| 985 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, | 862 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, |
| 986 const X5& x5) { | 863 const X5& x5) { |
| 987 StorageType* invoker = static_cast<StorageType*>(base); | 864 StorageType* invoker = static_cast<StorageType*>(base); |
| 988 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 865 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 989 Unwrap(invoker->p3_), x3, x4, x5); | 866 Unwrap(invoker->p3_), x3, x4, x5); |
| 990 } | 867 } |
| 991 }; | 868 }; |
| 992 | 869 |
| 993 // Const Method: Arity 5 -> 3. | 870 template <typename StorageType, typename NormalizedSig> |
| 994 template <typename StorageType, typename R, typename T, typename X1, | 871 struct Invoker4; |
| 995 typename X2, typename X3, typename X4, typename X5> | |
| 996 struct FunctionTraits3<StorageType, R(T::*)(X1, X2, X3, X4, X5) const> { | |
| 997 COMPILE_ASSERT( | |
| 998 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 999 || is_non_const_reference<X3>::value || | |
| 1000 is_non_const_reference<X4>::value || | |
| 1001 is_non_const_reference<X5>::value ), | |
| 1002 do_not_bind_functions_with_nonconst_ref); | |
| 1003 | |
| 1004 typedef base::true_type IsMethod; | |
| 1005 | |
| 1006 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, | |
| 1007 const X5& x5) { | |
| 1008 StorageType* invoker = static_cast<StorageType*>(base); | |
| 1009 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 1010 Unwrap(invoker->p3_), x3, x4, x5); | |
| 1011 } | |
| 1012 }; | |
| 1013 | |
| 1014 template <typename StorageType, typename Sig> | |
| 1015 struct FunctionTraits4; | |
| 1016 | 872 |
| 1017 // Function: Arity 4 -> 0. | 873 // Function: Arity 4 -> 0. |
| 1018 template <typename StorageType, typename R,typename X1, typename X2, | 874 template <typename StorageType, typename R,typename X1, typename X2, |
| 1019 typename X3, typename X4> | 875 typename X3, typename X4> |
| 1020 struct FunctionTraits4<StorageType, R(*)(X1, X2, X3, X4)> { | 876 struct Invoker4<StorageType, R(*)(X1, X2, X3, X4)> { |
| 1021 COMPILE_ASSERT( | 877 COMPILE_ASSERT( |
| 1022 !( is_non_const_reference<X1>::value || | 878 !( is_non_const_reference<X1>::value || |
| 1023 is_non_const_reference<X2>::value || | 879 is_non_const_reference<X2>::value || |
| 1024 is_non_const_reference<X3>::value || | 880 is_non_const_reference<X3>::value || |
| 1025 is_non_const_reference<X4>::value ), | 881 is_non_const_reference<X4>::value ), |
| 1026 do_not_bind_functions_with_nonconst_ref); | 882 do_not_bind_functions_with_nonconst_ref); |
| 1027 | 883 |
| 1028 typedef base::false_type IsMethod; | |
| 1029 | |
| 1030 static R DoInvoke(InvokerStorageBase* base) { | 884 static R DoInvoke(InvokerStorageBase* base) { |
| 1031 StorageType* invoker = static_cast<StorageType*>(base); | 885 StorageType* invoker = static_cast<StorageType*>(base); |
| 1032 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 886 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 1033 Unwrap(invoker->p3_), Unwrap(invoker->p4_)); | 887 Unwrap(invoker->p3_), Unwrap(invoker->p4_)); |
| 1034 } | 888 } |
| 1035 }; | 889 }; |
| 1036 | 890 |
| 1037 // Method: Arity 3 -> 0. | 891 // Method: Arity 3 -> 0. |
| 1038 template <typename StorageType, typename R, typename T, typename X1, | 892 template <typename StorageType, typename R, typename T, typename X1, |
| 1039 typename X2, typename X3> | 893 typename X2, typename X3> |
| 1040 struct FunctionTraits4<StorageType, R(T::*)(X1, X2, X3)> { | 894 struct Invoker4<StorageType, R(T::*)(X1, X2, X3)> { |
| 1041 COMPILE_ASSERT( | 895 COMPILE_ASSERT( |
| 1042 !( is_non_const_reference<X1>::value || | 896 !( is_non_const_reference<X1>::value || |
| 1043 is_non_const_reference<X2>::value || | 897 is_non_const_reference<X2>::value || |
| 1044 is_non_const_reference<X3>::value ), | 898 is_non_const_reference<X3>::value ), |
| 1045 do_not_bind_functions_with_nonconst_ref); | 899 do_not_bind_functions_with_nonconst_ref); |
| 1046 | 900 |
| 1047 typedef base::true_type IsMethod; | |
| 1048 | |
| 1049 static R DoInvoke(InvokerStorageBase* base) { | 901 static R DoInvoke(InvokerStorageBase* base) { |
| 1050 StorageType* invoker = static_cast<StorageType*>(base); | 902 StorageType* invoker = static_cast<StorageType*>(base); |
| 1051 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 903 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 1052 Unwrap(invoker->p3_), Unwrap(invoker->p4_)); | 904 Unwrap(invoker->p3_), Unwrap(invoker->p4_)); |
| 1053 } | 905 } |
| 1054 }; | 906 }; |
| 1055 | 907 |
| 1056 // Const Method: Arity 3 -> 0. | |
| 1057 template <typename StorageType, typename R, typename T, typename X1, | |
| 1058 typename X2, typename X3> | |
| 1059 struct FunctionTraits4<StorageType, R(T::*)(X1, X2, X3) const> { | |
| 1060 COMPILE_ASSERT( | |
| 1061 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 1062 || is_non_const_reference<X3>::value ), | |
| 1063 do_not_bind_functions_with_nonconst_ref); | |
| 1064 | |
| 1065 typedef base::true_type IsMethod; | |
| 1066 | |
| 1067 static R DoInvoke(InvokerStorageBase* base ) { | |
| 1068 StorageType* invoker = static_cast<StorageType*>(base); | |
| 1069 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 1070 Unwrap(invoker->p3_), Unwrap(invoker->p4_)); | |
| 1071 } | |
| 1072 }; | |
| 1073 | |
| 1074 // Function: Arity 5 -> 1. | 908 // Function: Arity 5 -> 1. |
| 1075 template <typename StorageType, typename R,typename X1, typename X2, | 909 template <typename StorageType, typename R,typename X1, typename X2, |
| 1076 typename X3, typename X4, typename X5> | 910 typename X3, typename X4, typename X5> |
| 1077 struct FunctionTraits4<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 911 struct Invoker4<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 1078 COMPILE_ASSERT( | 912 COMPILE_ASSERT( |
| 1079 !( is_non_const_reference<X1>::value || | 913 !( is_non_const_reference<X1>::value || |
| 1080 is_non_const_reference<X2>::value || | 914 is_non_const_reference<X2>::value || |
| 1081 is_non_const_reference<X3>::value || | 915 is_non_const_reference<X3>::value || |
| 1082 is_non_const_reference<X4>::value || | 916 is_non_const_reference<X4>::value || |
| 1083 is_non_const_reference<X5>::value ), | 917 is_non_const_reference<X5>::value ), |
| 1084 do_not_bind_functions_with_nonconst_ref); | 918 do_not_bind_functions_with_nonconst_ref); |
| 1085 | 919 |
| 1086 typedef base::false_type IsMethod; | |
| 1087 | |
| 1088 static R DoInvoke(InvokerStorageBase* base, const X5& x5) { | 920 static R DoInvoke(InvokerStorageBase* base, const X5& x5) { |
| 1089 StorageType* invoker = static_cast<StorageType*>(base); | 921 StorageType* invoker = static_cast<StorageType*>(base); |
| 1090 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 922 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 1091 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x5); | 923 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x5); |
| 1092 } | 924 } |
| 1093 }; | 925 }; |
| 1094 | 926 |
| 1095 // Method: Arity 4 -> 1. | 927 // Method: Arity 4 -> 1. |
| 1096 template <typename StorageType, typename R, typename T, typename X1, | 928 template <typename StorageType, typename R, typename T, typename X1, |
| 1097 typename X2, typename X3, typename X4> | 929 typename X2, typename X3, typename X4> |
| 1098 struct FunctionTraits4<StorageType, R(T::*)(X1, X2, X3, X4)> { | 930 struct Invoker4<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 1099 COMPILE_ASSERT( | 931 COMPILE_ASSERT( |
| 1100 !( is_non_const_reference<X1>::value || | 932 !( is_non_const_reference<X1>::value || |
| 1101 is_non_const_reference<X2>::value || | 933 is_non_const_reference<X2>::value || |
| 1102 is_non_const_reference<X3>::value || | 934 is_non_const_reference<X3>::value || |
| 1103 is_non_const_reference<X4>::value ), | 935 is_non_const_reference<X4>::value ), |
| 1104 do_not_bind_functions_with_nonconst_ref); | 936 do_not_bind_functions_with_nonconst_ref); |
| 1105 | 937 |
| 1106 typedef base::true_type IsMethod; | |
| 1107 | |
| 1108 static R DoInvoke(InvokerStorageBase* base, const X4& x4) { | 938 static R DoInvoke(InvokerStorageBase* base, const X4& x4) { |
| 1109 StorageType* invoker = static_cast<StorageType*>(base); | 939 StorageType* invoker = static_cast<StorageType*>(base); |
| 1110 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 940 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 1111 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4); | 941 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4); |
| 1112 } | 942 } |
| 1113 }; | 943 }; |
| 1114 | 944 |
| 1115 // Const Method: Arity 4 -> 1. | |
| 1116 template <typename StorageType, typename R, typename T, typename X1, | |
| 1117 typename X2, typename X3, typename X4> | |
| 1118 struct FunctionTraits4<StorageType, R(T::*)(X1, X2, X3, X4) const> { | |
| 1119 COMPILE_ASSERT( | |
| 1120 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 1121 || is_non_const_reference<X3>::value || | |
| 1122 is_non_const_reference<X4>::value ), | |
| 1123 do_not_bind_functions_with_nonconst_ref); | |
| 1124 | |
| 1125 typedef base::true_type IsMethod; | |
| 1126 | |
| 1127 static R DoInvoke(InvokerStorageBase* base, const X4& x4) { | |
| 1128 StorageType* invoker = static_cast<StorageType*>(base); | |
| 1129 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 1130 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4); | |
| 1131 } | |
| 1132 }; | |
| 1133 | |
| 1134 // Function: Arity 6 -> 2. | 945 // Function: Arity 6 -> 2. |
| 1135 template <typename StorageType, typename R,typename X1, typename X2, | 946 template <typename StorageType, typename R,typename X1, typename X2, |
| 1136 typename X3, typename X4, typename X5, typename X6> | 947 typename X3, typename X4, typename X5, typename X6> |
| 1137 struct FunctionTraits4<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 948 struct Invoker4<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 1138 COMPILE_ASSERT( | 949 COMPILE_ASSERT( |
| 1139 !( is_non_const_reference<X1>::value || | 950 !( is_non_const_reference<X1>::value || |
| 1140 is_non_const_reference<X2>::value || | 951 is_non_const_reference<X2>::value || |
| 1141 is_non_const_reference<X3>::value || | 952 is_non_const_reference<X3>::value || |
| 1142 is_non_const_reference<X4>::value || | 953 is_non_const_reference<X4>::value || |
| 1143 is_non_const_reference<X5>::value || | 954 is_non_const_reference<X5>::value || |
| 1144 is_non_const_reference<X6>::value ), | 955 is_non_const_reference<X6>::value ), |
| 1145 do_not_bind_functions_with_nonconst_ref); | 956 do_not_bind_functions_with_nonconst_ref); |
| 1146 | 957 |
| 1147 typedef base::false_type IsMethod; | |
| 1148 | |
| 1149 static R DoInvoke(InvokerStorageBase* base, const X5& x5, const X6& x6) { | 958 static R DoInvoke(InvokerStorageBase* base, const X5& x5, const X6& x6) { |
| 1150 StorageType* invoker = static_cast<StorageType*>(base); | 959 StorageType* invoker = static_cast<StorageType*>(base); |
| 1151 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 960 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 1152 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x5, x6); | 961 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x5, x6); |
| 1153 } | 962 } |
| 1154 }; | 963 }; |
| 1155 | 964 |
| 1156 // Method: Arity 5 -> 2. | 965 // Method: Arity 5 -> 2. |
| 1157 template <typename StorageType, typename R, typename T, typename X1, | 966 template <typename StorageType, typename R, typename T, typename X1, |
| 1158 typename X2, typename X3, typename X4, typename X5> | 967 typename X2, typename X3, typename X4, typename X5> |
| 1159 struct FunctionTraits4<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 968 struct Invoker4<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 1160 COMPILE_ASSERT( | 969 COMPILE_ASSERT( |
| 1161 !( is_non_const_reference<X1>::value || | 970 !( is_non_const_reference<X1>::value || |
| 1162 is_non_const_reference<X2>::value || | 971 is_non_const_reference<X2>::value || |
| 1163 is_non_const_reference<X3>::value || | 972 is_non_const_reference<X3>::value || |
| 1164 is_non_const_reference<X4>::value || | 973 is_non_const_reference<X4>::value || |
| 1165 is_non_const_reference<X5>::value ), | 974 is_non_const_reference<X5>::value ), |
| 1166 do_not_bind_functions_with_nonconst_ref); | 975 do_not_bind_functions_with_nonconst_ref); |
| 1167 | 976 |
| 1168 typedef base::true_type IsMethod; | |
| 1169 | |
| 1170 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5) { | 977 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5) { |
| 1171 StorageType* invoker = static_cast<StorageType*>(base); | 978 StorageType* invoker = static_cast<StorageType*>(base); |
| 1172 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 979 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 1173 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4, x5); | 980 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4, x5); |
| 1174 } | 981 } |
| 1175 }; | 982 }; |
| 1176 | 983 |
| 1177 // Const Method: Arity 5 -> 2. | 984 template <typename StorageType, typename NormalizedSig> |
| 1178 template <typename StorageType, typename R, typename T, typename X1, | 985 struct Invoker5; |
| 1179 typename X2, typename X3, typename X4, typename X5> | |
| 1180 struct FunctionTraits4<StorageType, R(T::*)(X1, X2, X3, X4, X5) const> { | |
| 1181 COMPILE_ASSERT( | |
| 1182 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 1183 || is_non_const_reference<X3>::value || | |
| 1184 is_non_const_reference<X4>::value || | |
| 1185 is_non_const_reference<X5>::value ), | |
| 1186 do_not_bind_functions_with_nonconst_ref); | |
| 1187 | |
| 1188 typedef base::true_type IsMethod; | |
| 1189 | |
| 1190 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5) { | |
| 1191 StorageType* invoker = static_cast<StorageType*>(base); | |
| 1192 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 1193 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4, x5); | |
| 1194 } | |
| 1195 }; | |
| 1196 | |
| 1197 template <typename StorageType, typename Sig> | |
| 1198 struct FunctionTraits5; | |
| 1199 | 986 |
| 1200 // Function: Arity 5 -> 0. | 987 // Function: Arity 5 -> 0. |
| 1201 template <typename StorageType, typename R,typename X1, typename X2, | 988 template <typename StorageType, typename R,typename X1, typename X2, |
| 1202 typename X3, typename X4, typename X5> | 989 typename X3, typename X4, typename X5> |
| 1203 struct FunctionTraits5<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 990 struct Invoker5<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 1204 COMPILE_ASSERT( | 991 COMPILE_ASSERT( |
| 1205 !( is_non_const_reference<X1>::value || | 992 !( is_non_const_reference<X1>::value || |
| 1206 is_non_const_reference<X2>::value || | 993 is_non_const_reference<X2>::value || |
| 1207 is_non_const_reference<X3>::value || | 994 is_non_const_reference<X3>::value || |
| 1208 is_non_const_reference<X4>::value || | 995 is_non_const_reference<X4>::value || |
| 1209 is_non_const_reference<X5>::value ), | 996 is_non_const_reference<X5>::value ), |
| 1210 do_not_bind_functions_with_nonconst_ref); | 997 do_not_bind_functions_with_nonconst_ref); |
| 1211 | 998 |
| 1212 typedef base::false_type IsMethod; | |
| 1213 | |
| 1214 static R DoInvoke(InvokerStorageBase* base) { | 999 static R DoInvoke(InvokerStorageBase* base) { |
| 1215 StorageType* invoker = static_cast<StorageType*>(base); | 1000 StorageType* invoker = static_cast<StorageType*>(base); |
| 1216 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 1001 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 1217 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_)); | 1002 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_)); |
| 1218 } | 1003 } |
| 1219 }; | 1004 }; |
| 1220 | 1005 |
| 1221 // Method: Arity 4 -> 0. | 1006 // Method: Arity 4 -> 0. |
| 1222 template <typename StorageType, typename R, typename T, typename X1, | 1007 template <typename StorageType, typename R, typename T, typename X1, |
| 1223 typename X2, typename X3, typename X4> | 1008 typename X2, typename X3, typename X4> |
| 1224 struct FunctionTraits5<StorageType, R(T::*)(X1, X2, X3, X4)> { | 1009 struct Invoker5<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 1225 COMPILE_ASSERT( | 1010 COMPILE_ASSERT( |
| 1226 !( is_non_const_reference<X1>::value || | 1011 !( is_non_const_reference<X1>::value || |
| 1227 is_non_const_reference<X2>::value || | 1012 is_non_const_reference<X2>::value || |
| 1228 is_non_const_reference<X3>::value || | 1013 is_non_const_reference<X3>::value || |
| 1229 is_non_const_reference<X4>::value ), | 1014 is_non_const_reference<X4>::value ), |
| 1230 do_not_bind_functions_with_nonconst_ref); | 1015 do_not_bind_functions_with_nonconst_ref); |
| 1231 | 1016 |
| 1232 typedef base::true_type IsMethod; | |
| 1233 | |
| 1234 static R DoInvoke(InvokerStorageBase* base) { | 1017 static R DoInvoke(InvokerStorageBase* base) { |
| 1235 StorageType* invoker = static_cast<StorageType*>(base); | 1018 StorageType* invoker = static_cast<StorageType*>(base); |
| 1236 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 1019 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 1237 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_)); | 1020 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_)); |
| 1238 } | 1021 } |
| 1239 }; | 1022 }; |
| 1240 | 1023 |
| 1241 // Const Method: Arity 4 -> 0. | |
| 1242 template <typename StorageType, typename R, typename T, typename X1, | |
| 1243 typename X2, typename X3, typename X4> | |
| 1244 struct FunctionTraits5<StorageType, R(T::*)(X1, X2, X3, X4) const> { | |
| 1245 COMPILE_ASSERT( | |
| 1246 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 1247 || is_non_const_reference<X3>::value || | |
| 1248 is_non_const_reference<X4>::value ), | |
| 1249 do_not_bind_functions_with_nonconst_ref); | |
| 1250 | |
| 1251 typedef base::true_type IsMethod; | |
| 1252 | |
| 1253 static R DoInvoke(InvokerStorageBase* base ) { | |
| 1254 StorageType* invoker = static_cast<StorageType*>(base); | |
| 1255 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 1256 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_)); | |
| 1257 } | |
| 1258 }; | |
| 1259 | |
| 1260 // Function: Arity 6 -> 1. | 1024 // Function: Arity 6 -> 1. |
| 1261 template <typename StorageType, typename R,typename X1, typename X2, | 1025 template <typename StorageType, typename R,typename X1, typename X2, |
| 1262 typename X3, typename X4, typename X5, typename X6> | 1026 typename X3, typename X4, typename X5, typename X6> |
| 1263 struct FunctionTraits5<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 1027 struct Invoker5<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 1264 COMPILE_ASSERT( | 1028 COMPILE_ASSERT( |
| 1265 !( is_non_const_reference<X1>::value || | 1029 !( is_non_const_reference<X1>::value || |
| 1266 is_non_const_reference<X2>::value || | 1030 is_non_const_reference<X2>::value || |
| 1267 is_non_const_reference<X3>::value || | 1031 is_non_const_reference<X3>::value || |
| 1268 is_non_const_reference<X4>::value || | 1032 is_non_const_reference<X4>::value || |
| 1269 is_non_const_reference<X5>::value || | 1033 is_non_const_reference<X5>::value || |
| 1270 is_non_const_reference<X6>::value ), | 1034 is_non_const_reference<X6>::value ), |
| 1271 do_not_bind_functions_with_nonconst_ref); | 1035 do_not_bind_functions_with_nonconst_ref); |
| 1272 | 1036 |
| 1273 typedef base::false_type IsMethod; | |
| 1274 | |
| 1275 static R DoInvoke(InvokerStorageBase* base, const X6& x6) { | 1037 static R DoInvoke(InvokerStorageBase* base, const X6& x6) { |
| 1276 StorageType* invoker = static_cast<StorageType*>(base); | 1038 StorageType* invoker = static_cast<StorageType*>(base); |
| 1277 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 1039 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 1278 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), x6); | 1040 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), x6); |
| 1279 } | 1041 } |
| 1280 }; | 1042 }; |
| 1281 | 1043 |
| 1282 // Method: Arity 5 -> 1. | 1044 // Method: Arity 5 -> 1. |
| 1283 template <typename StorageType, typename R, typename T, typename X1, | 1045 template <typename StorageType, typename R, typename T, typename X1, |
| 1284 typename X2, typename X3, typename X4, typename X5> | 1046 typename X2, typename X3, typename X4, typename X5> |
| 1285 struct FunctionTraits5<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 1047 struct Invoker5<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 1286 COMPILE_ASSERT( | 1048 COMPILE_ASSERT( |
| 1287 !( is_non_const_reference<X1>::value || | 1049 !( is_non_const_reference<X1>::value || |
| 1288 is_non_const_reference<X2>::value || | 1050 is_non_const_reference<X2>::value || |
| 1289 is_non_const_reference<X3>::value || | 1051 is_non_const_reference<X3>::value || |
| 1290 is_non_const_reference<X4>::value || | 1052 is_non_const_reference<X4>::value || |
| 1291 is_non_const_reference<X5>::value ), | 1053 is_non_const_reference<X5>::value ), |
| 1292 do_not_bind_functions_with_nonconst_ref); | 1054 do_not_bind_functions_with_nonconst_ref); |
| 1293 | 1055 |
| 1294 typedef base::true_type IsMethod; | |
| 1295 | |
| 1296 static R DoInvoke(InvokerStorageBase* base, const X5& x5) { | 1056 static R DoInvoke(InvokerStorageBase* base, const X5& x5) { |
| 1297 StorageType* invoker = static_cast<StorageType*>(base); | 1057 StorageType* invoker = static_cast<StorageType*>(base); |
| 1298 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 1058 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 1299 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), x5); | 1059 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), x5); |
| 1300 } | 1060 } |
| 1301 }; | 1061 }; |
| 1302 | 1062 |
| 1303 // Const Method: Arity 5 -> 1. | 1063 template <typename StorageType, typename NormalizedSig> |
| 1304 template <typename StorageType, typename R, typename T, typename X1, | 1064 struct Invoker6; |
| 1305 typename X2, typename X3, typename X4, typename X5> | |
| 1306 struct FunctionTraits5<StorageType, R(T::*)(X1, X2, X3, X4, X5) const> { | |
| 1307 COMPILE_ASSERT( | |
| 1308 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 1309 || is_non_const_reference<X3>::value || | |
| 1310 is_non_const_reference<X4>::value || | |
| 1311 is_non_const_reference<X5>::value ), | |
| 1312 do_not_bind_functions_with_nonconst_ref); | |
| 1313 | |
| 1314 typedef base::true_type IsMethod; | |
| 1315 | |
| 1316 static R DoInvoke(InvokerStorageBase* base, const X5& x5) { | |
| 1317 StorageType* invoker = static_cast<StorageType*>(base); | |
| 1318 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 1319 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), x5); | |
| 1320 } | |
| 1321 }; | |
| 1322 | |
| 1323 template <typename StorageType, typename Sig> | |
| 1324 struct FunctionTraits6; | |
| 1325 | 1065 |
| 1326 // Function: Arity 6 -> 0. | 1066 // Function: Arity 6 -> 0. |
| 1327 template <typename StorageType, typename R,typename X1, typename X2, | 1067 template <typename StorageType, typename R,typename X1, typename X2, |
| 1328 typename X3, typename X4, typename X5, typename X6> | 1068 typename X3, typename X4, typename X5, typename X6> |
| 1329 struct FunctionTraits6<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 1069 struct Invoker6<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 1330 COMPILE_ASSERT( | 1070 COMPILE_ASSERT( |
| 1331 !( is_non_const_reference<X1>::value || | 1071 !( is_non_const_reference<X1>::value || |
| 1332 is_non_const_reference<X2>::value || | 1072 is_non_const_reference<X2>::value || |
| 1333 is_non_const_reference<X3>::value || | 1073 is_non_const_reference<X3>::value || |
| 1334 is_non_const_reference<X4>::value || | 1074 is_non_const_reference<X4>::value || |
| 1335 is_non_const_reference<X5>::value || | 1075 is_non_const_reference<X5>::value || |
| 1336 is_non_const_reference<X6>::value ), | 1076 is_non_const_reference<X6>::value ), |
| 1337 do_not_bind_functions_with_nonconst_ref); | 1077 do_not_bind_functions_with_nonconst_ref); |
| 1338 | 1078 |
| 1339 typedef base::false_type IsMethod; | |
| 1340 | |
| 1341 static R DoInvoke(InvokerStorageBase* base) { | 1079 static R DoInvoke(InvokerStorageBase* base) { |
| 1342 StorageType* invoker = static_cast<StorageType*>(base); | 1080 StorageType* invoker = static_cast<StorageType*>(base); |
| 1343 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 1081 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 1344 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), | 1082 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), |
| 1345 Unwrap(invoker->p6_)); | 1083 Unwrap(invoker->p6_)); |
| 1346 } | 1084 } |
| 1347 }; | 1085 }; |
| 1348 | 1086 |
| 1349 // Method: Arity 5 -> 0. | 1087 // Method: Arity 5 -> 0. |
| 1350 template <typename StorageType, typename R, typename T, typename X1, | 1088 template <typename StorageType, typename R, typename T, typename X1, |
| 1351 typename X2, typename X3, typename X4, typename X5> | 1089 typename X2, typename X3, typename X4, typename X5> |
| 1352 struct FunctionTraits6<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 1090 struct Invoker6<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 1353 COMPILE_ASSERT( | 1091 COMPILE_ASSERT( |
| 1354 !( is_non_const_reference<X1>::value || | 1092 !( is_non_const_reference<X1>::value || |
| 1355 is_non_const_reference<X2>::value || | 1093 is_non_const_reference<X2>::value || |
| 1356 is_non_const_reference<X3>::value || | 1094 is_non_const_reference<X3>::value || |
| 1357 is_non_const_reference<X4>::value || | 1095 is_non_const_reference<X4>::value || |
| 1358 is_non_const_reference<X5>::value ), | 1096 is_non_const_reference<X5>::value ), |
| 1359 do_not_bind_functions_with_nonconst_ref); | 1097 do_not_bind_functions_with_nonconst_ref); |
| 1360 | 1098 |
| 1361 typedef base::true_type IsMethod; | |
| 1362 | |
| 1363 static R DoInvoke(InvokerStorageBase* base) { | 1099 static R DoInvoke(InvokerStorageBase* base) { |
| 1364 StorageType* invoker = static_cast<StorageType*>(base); | 1100 StorageType* invoker = static_cast<StorageType*>(base); |
| 1365 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 1101 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 1366 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), | 1102 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), |
| 1367 Unwrap(invoker->p6_)); | 1103 Unwrap(invoker->p6_)); |
| 1368 } | 1104 } |
| 1369 }; | 1105 }; |
| 1370 | 1106 |
| 1371 // Const Method: Arity 5 -> 0. | |
| 1372 template <typename StorageType, typename R, typename T, typename X1, | |
| 1373 typename X2, typename X3, typename X4, typename X5> | |
| 1374 struct FunctionTraits6<StorageType, R(T::*)(X1, X2, X3, X4, X5) const> { | |
| 1375 COMPILE_ASSERT( | |
| 1376 !(is_non_const_reference<X1>::value || is_non_const_reference<X2>::value | |
| 1377 || is_non_const_reference<X3>::value || | |
| 1378 is_non_const_reference<X4>::value || | |
| 1379 is_non_const_reference<X5>::value ), | |
| 1380 do_not_bind_functions_with_nonconst_ref); | |
| 1381 | |
| 1382 typedef base::true_type IsMethod; | |
| 1383 | |
| 1384 static R DoInvoke(InvokerStorageBase* base ) { | |
| 1385 StorageType* invoker = static_cast<StorageType*>(base); | |
| 1386 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | |
| 1387 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), | |
| 1388 Unwrap(invoker->p6_)); | |
| 1389 } | |
| 1390 }; | |
| 1391 | |
| 1392 | 1107 |
| 1393 // These are the actual storage classes for the invokers. | 1108 // InvokerStorageN<> |
| 1109 // |
| 1110 // These are the actual storage classes for the Invokers. |
| 1394 // | 1111 // |
| 1395 // Though these types are "classes", they are being used as structs with | 1112 // Though these types are "classes", they are being used as structs with |
| 1396 // all member variable public. We cannot make it a struct because it inherits | 1113 // all member variable public. We cannot make it a struct because it inherits |
| 1397 // from a class which causes a compiler warning. We cannot add a "Run()" method | 1114 // from a class which causes a compiler warning. We cannot add a "Run()" method |
| 1398 // that forwards the unbound arguments because that would require we unwrap the | 1115 // that forwards the unbound arguments because that would require we unwrap the |
| 1399 // Sig type like in FunctionTraitsN above to know the return type, and the arity | 1116 // Sig type like in InvokerN above to know the return type, and the arity |
| 1400 // of Run(). | 1117 // of Run(). |
| 1401 // | 1118 // |
| 1402 // An alternate solution would be to merge FunctionTraitsN and InvokerStorageN, | 1119 // An alternate solution would be to merge InvokerN and InvokerStorageN, |
| 1403 // but the generated code seemed harder to read. | 1120 // but the generated code seemed harder to read. |
| 1404 | 1121 |
| 1405 template <typename Sig> | 1122 template <typename Sig> |
| 1406 class InvokerStorage0 : public InvokerStorageBase { | 1123 class InvokerStorage0 : public InvokerStorageBase { |
| 1407 public: | 1124 public: |
| 1408 typedef InvokerStorage0 StorageType; | 1125 typedef InvokerStorage0 StorageType; |
| 1409 typedef FunctionTraits0<StorageType, Sig> FunctionTraits; | 1126 typedef FunctionTraits<Sig> TargetTraits; |
| 1410 typedef typename FunctionTraits::IsMethod IsMethod; | 1127 typedef Invoker0<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1411 | 1128 typedef typename TargetTraits::IsMethod IsMethod; |
| 1412 | 1129 |
| 1413 | 1130 |
| 1414 InvokerStorage0(Sig f) | 1131 InvokerStorage0(Sig f) |
| 1415 : f_(f) { | 1132 : f_(f) { |
| 1416 } | 1133 } |
| 1417 | 1134 |
| 1418 virtual ~InvokerStorage0() { } | 1135 virtual ~InvokerStorage0() { } |
| 1419 | 1136 |
| 1420 Sig f_; | 1137 Sig f_; |
| 1421 }; | 1138 }; |
| 1422 | 1139 |
| 1423 template <typename Sig, typename P1> | 1140 template <typename Sig, typename P1> |
| 1424 class InvokerStorage1 : public InvokerStorageBase { | 1141 class InvokerStorage1 : public InvokerStorageBase { |
| 1425 public: | 1142 public: |
| 1426 typedef InvokerStorage1 StorageType; | 1143 typedef InvokerStorage1 StorageType; |
| 1427 typedef FunctionTraits1<StorageType, Sig> FunctionTraits; | 1144 typedef FunctionTraits<Sig> TargetTraits; |
| 1428 typedef typename FunctionTraits::IsMethod IsMethod; | 1145 typedef Invoker1<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1429 | 1146 typedef typename TargetTraits::IsMethod IsMethod; |
| 1430 // For methods, we need to be careful for parameter 1. We skip the | 1147 // For methods, we need to be careful for parameter 1. We skip the |
| 1431 // scoped_refptr check because the binder itself takes care of this. We also | 1148 // scoped_refptr check because the binder itself takes care of this. We also |
| 1432 // disallow binding of an array as the method's target object. | 1149 // disallow binding of an array as the method's target object. |
| 1433 COMPILE_ASSERT(IsMethod::value || | 1150 COMPILE_ASSERT(IsMethod::value || |
| 1434 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1151 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1435 p1_is_refcounted_type_and_needs_scoped_refptr); | 1152 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1436 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1153 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1437 first_bound_argument_to_method_cannot_be_array); | 1154 first_bound_argument_to_method_cannot_be_array); |
| 1438 | 1155 |
| 1439 | 1156 |
| 1440 InvokerStorage1(Sig f, const P1& p1) | 1157 InvokerStorage1(Sig f, const P1& p1) |
| 1441 : f_(f), p1_(static_cast<typename BindType<P1>::StorageType>(p1)) { | 1158 : f_(f), p1_(static_cast<typename BindType<P1>::StorageType>(p1)) { |
| 1442 MaybeRefcount<IsMethod, P1>::AddRef(p1_); | 1159 MaybeRefcount<IsMethod, P1>::AddRef(p1_); |
| 1443 } | 1160 } |
| 1444 | 1161 |
| 1445 virtual ~InvokerStorage1() { | 1162 virtual ~InvokerStorage1() { |
| 1446 MaybeRefcount<IsMethod, P1>::Release(p1_); | 1163 MaybeRefcount<IsMethod, P1>::Release(p1_); |
| 1447 } | 1164 } |
| 1448 | 1165 |
| 1449 Sig f_; | 1166 Sig f_; |
| 1450 typename BindType<P1>::StorageType p1_; | 1167 typename BindType<P1>::StorageType p1_; |
| 1451 }; | 1168 }; |
| 1452 | 1169 |
| 1453 template <typename Sig, typename P1, typename P2> | 1170 template <typename Sig, typename P1, typename P2> |
| 1454 class InvokerStorage2 : public InvokerStorageBase { | 1171 class InvokerStorage2 : public InvokerStorageBase { |
| 1455 public: | 1172 public: |
| 1456 typedef InvokerStorage2 StorageType; | 1173 typedef InvokerStorage2 StorageType; |
| 1457 typedef FunctionTraits2<StorageType, Sig> FunctionTraits; | 1174 typedef FunctionTraits<Sig> TargetTraits; |
| 1458 typedef typename FunctionTraits::IsMethod IsMethod; | 1175 typedef Invoker2<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1459 | 1176 typedef typename TargetTraits::IsMethod IsMethod; |
| 1460 // For methods, we need to be careful for parameter 1. We skip the | 1177 // For methods, we need to be careful for parameter 1. We skip the |
| 1461 // scoped_refptr check because the binder itself takes care of this. We also | 1178 // scoped_refptr check because the binder itself takes care of this. We also |
| 1462 // disallow binding of an array as the method's target object. | 1179 // disallow binding of an array as the method's target object. |
| 1463 COMPILE_ASSERT(IsMethod::value || | 1180 COMPILE_ASSERT(IsMethod::value || |
| 1464 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1181 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1465 p1_is_refcounted_type_and_needs_scoped_refptr); | 1182 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1466 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1183 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1467 first_bound_argument_to_method_cannot_be_array); | 1184 first_bound_argument_to_method_cannot_be_array); |
| 1468 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1185 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1469 p2_is_refcounted_type_and_needs_scoped_refptr); | 1186 p2_is_refcounted_type_and_needs_scoped_refptr); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1481 | 1198 |
| 1482 Sig f_; | 1199 Sig f_; |
| 1483 typename BindType<P1>::StorageType p1_; | 1200 typename BindType<P1>::StorageType p1_; |
| 1484 typename BindType<P2>::StorageType p2_; | 1201 typename BindType<P2>::StorageType p2_; |
| 1485 }; | 1202 }; |
| 1486 | 1203 |
| 1487 template <typename Sig, typename P1, typename P2, typename P3> | 1204 template <typename Sig, typename P1, typename P2, typename P3> |
| 1488 class InvokerStorage3 : public InvokerStorageBase { | 1205 class InvokerStorage3 : public InvokerStorageBase { |
| 1489 public: | 1206 public: |
| 1490 typedef InvokerStorage3 StorageType; | 1207 typedef InvokerStorage3 StorageType; |
| 1491 typedef FunctionTraits3<StorageType, Sig> FunctionTraits; | 1208 typedef FunctionTraits<Sig> TargetTraits; |
| 1492 typedef typename FunctionTraits::IsMethod IsMethod; | 1209 typedef Invoker3<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1493 | 1210 typedef typename TargetTraits::IsMethod IsMethod; |
| 1494 // For methods, we need to be careful for parameter 1. We skip the | 1211 // For methods, we need to be careful for parameter 1. We skip the |
| 1495 // scoped_refptr check because the binder itself takes care of this. We also | 1212 // scoped_refptr check because the binder itself takes care of this. We also |
| 1496 // disallow binding of an array as the method's target object. | 1213 // disallow binding of an array as the method's target object. |
| 1497 COMPILE_ASSERT(IsMethod::value || | 1214 COMPILE_ASSERT(IsMethod::value || |
| 1498 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1215 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1499 p1_is_refcounted_type_and_needs_scoped_refptr); | 1216 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1500 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1217 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1501 first_bound_argument_to_method_cannot_be_array); | 1218 first_bound_argument_to_method_cannot_be_array); |
| 1502 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1219 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1503 p2_is_refcounted_type_and_needs_scoped_refptr); | 1220 p2_is_refcounted_type_and_needs_scoped_refptr); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1519 Sig f_; | 1236 Sig f_; |
| 1520 typename BindType<P1>::StorageType p1_; | 1237 typename BindType<P1>::StorageType p1_; |
| 1521 typename BindType<P2>::StorageType p2_; | 1238 typename BindType<P2>::StorageType p2_; |
| 1522 typename BindType<P3>::StorageType p3_; | 1239 typename BindType<P3>::StorageType p3_; |
| 1523 }; | 1240 }; |
| 1524 | 1241 |
| 1525 template <typename Sig, typename P1, typename P2, typename P3, typename P4> | 1242 template <typename Sig, typename P1, typename P2, typename P3, typename P4> |
| 1526 class InvokerStorage4 : public InvokerStorageBase { | 1243 class InvokerStorage4 : public InvokerStorageBase { |
| 1527 public: | 1244 public: |
| 1528 typedef InvokerStorage4 StorageType; | 1245 typedef InvokerStorage4 StorageType; |
| 1529 typedef FunctionTraits4<StorageType, Sig> FunctionTraits; | 1246 typedef FunctionTraits<Sig> TargetTraits; |
| 1530 typedef typename FunctionTraits::IsMethod IsMethod; | 1247 typedef Invoker4<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1531 | 1248 typedef typename TargetTraits::IsMethod IsMethod; |
| 1532 // For methods, we need to be careful for parameter 1. We skip the | 1249 // For methods, we need to be careful for parameter 1. We skip the |
| 1533 // scoped_refptr check because the binder itself takes care of this. We also | 1250 // scoped_refptr check because the binder itself takes care of this. We also |
| 1534 // disallow binding of an array as the method's target object. | 1251 // disallow binding of an array as the method's target object. |
| 1535 COMPILE_ASSERT(IsMethod::value || | 1252 COMPILE_ASSERT(IsMethod::value || |
| 1536 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1253 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1537 p1_is_refcounted_type_and_needs_scoped_refptr); | 1254 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1538 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1255 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1539 first_bound_argument_to_method_cannot_be_array); | 1256 first_bound_argument_to_method_cannot_be_array); |
| 1540 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1257 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1541 p2_is_refcounted_type_and_needs_scoped_refptr); | 1258 p2_is_refcounted_type_and_needs_scoped_refptr); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1562 typename BindType<P2>::StorageType p2_; | 1279 typename BindType<P2>::StorageType p2_; |
| 1563 typename BindType<P3>::StorageType p3_; | 1280 typename BindType<P3>::StorageType p3_; |
| 1564 typename BindType<P4>::StorageType p4_; | 1281 typename BindType<P4>::StorageType p4_; |
| 1565 }; | 1282 }; |
| 1566 | 1283 |
| 1567 template <typename Sig, typename P1, typename P2, typename P3, typename P4, | 1284 template <typename Sig, typename P1, typename P2, typename P3, typename P4, |
| 1568 typename P5> | 1285 typename P5> |
| 1569 class InvokerStorage5 : public InvokerStorageBase { | 1286 class InvokerStorage5 : public InvokerStorageBase { |
| 1570 public: | 1287 public: |
| 1571 typedef InvokerStorage5 StorageType; | 1288 typedef InvokerStorage5 StorageType; |
| 1572 typedef FunctionTraits5<StorageType, Sig> FunctionTraits; | 1289 typedef FunctionTraits<Sig> TargetTraits; |
| 1573 typedef typename FunctionTraits::IsMethod IsMethod; | 1290 typedef Invoker5<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1574 | 1291 typedef typename TargetTraits::IsMethod IsMethod; |
| 1575 // For methods, we need to be careful for parameter 1. We skip the | 1292 // For methods, we need to be careful for parameter 1. We skip the |
| 1576 // scoped_refptr check because the binder itself takes care of this. We also | 1293 // scoped_refptr check because the binder itself takes care of this. We also |
| 1577 // disallow binding of an array as the method's target object. | 1294 // disallow binding of an array as the method's target object. |
| 1578 COMPILE_ASSERT(IsMethod::value || | 1295 COMPILE_ASSERT(IsMethod::value || |
| 1579 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1296 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1580 p1_is_refcounted_type_and_needs_scoped_refptr); | 1297 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1581 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1298 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1582 first_bound_argument_to_method_cannot_be_array); | 1299 first_bound_argument_to_method_cannot_be_array); |
| 1583 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1300 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1584 p2_is_refcounted_type_and_needs_scoped_refptr); | 1301 p2_is_refcounted_type_and_needs_scoped_refptr); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1610 typename BindType<P3>::StorageType p3_; | 1327 typename BindType<P3>::StorageType p3_; |
| 1611 typename BindType<P4>::StorageType p4_; | 1328 typename BindType<P4>::StorageType p4_; |
| 1612 typename BindType<P5>::StorageType p5_; | 1329 typename BindType<P5>::StorageType p5_; |
| 1613 }; | 1330 }; |
| 1614 | 1331 |
| 1615 template <typename Sig, typename P1, typename P2, typename P3, typename P4, | 1332 template <typename Sig, typename P1, typename P2, typename P3, typename P4, |
| 1616 typename P5, typename P6> | 1333 typename P5, typename P6> |
| 1617 class InvokerStorage6 : public InvokerStorageBase { | 1334 class InvokerStorage6 : public InvokerStorageBase { |
| 1618 public: | 1335 public: |
| 1619 typedef InvokerStorage6 StorageType; | 1336 typedef InvokerStorage6 StorageType; |
| 1620 typedef FunctionTraits6<StorageType, Sig> FunctionTraits; | 1337 typedef FunctionTraits<Sig> TargetTraits; |
| 1621 typedef typename FunctionTraits::IsMethod IsMethod; | 1338 typedef Invoker6<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1622 | 1339 typedef typename TargetTraits::IsMethod IsMethod; |
| 1623 // For methods, we need to be careful for parameter 1. We skip the | 1340 // For methods, we need to be careful for parameter 1. We skip the |
| 1624 // scoped_refptr check because the binder itself takes care of this. We also | 1341 // scoped_refptr check because the binder itself takes care of this. We also |
| 1625 // disallow binding of an array as the method's target object. | 1342 // disallow binding of an array as the method's target object. |
| 1626 COMPILE_ASSERT(IsMethod::value || | 1343 COMPILE_ASSERT(IsMethod::value || |
| 1627 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1344 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1628 p1_is_refcounted_type_and_needs_scoped_refptr); | 1345 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1629 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1346 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1630 first_bound_argument_to_method_cannot_be_array); | 1347 first_bound_argument_to_method_cannot_be_array); |
| 1631 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1348 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1632 p2_is_refcounted_type_and_needs_scoped_refptr); | 1349 p2_is_refcounted_type_and_needs_scoped_refptr); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1661 typename BindType<P3>::StorageType p3_; | 1378 typename BindType<P3>::StorageType p3_; |
| 1662 typename BindType<P4>::StorageType p4_; | 1379 typename BindType<P4>::StorageType p4_; |
| 1663 typename BindType<P5>::StorageType p5_; | 1380 typename BindType<P5>::StorageType p5_; |
| 1664 typename BindType<P6>::StorageType p6_; | 1381 typename BindType<P6>::StorageType p6_; |
| 1665 }; | 1382 }; |
| 1666 | 1383 |
| 1667 } // namespace internal | 1384 } // namespace internal |
| 1668 } // namespace base | 1385 } // namespace base |
| 1669 | 1386 |
| 1670 #endif // BASE_BIND_INTERNAL_H_ | 1387 #endif // BASE_BIND_INTERNAL_H_ |
| OLD | NEW |