| 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 |
| 6 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 7 // 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 | 8 // Use of this source code is governed by a BSD-style license that can be |
| 8 // found in the LICENSE file. | 9 // found in the LICENSE file. |
| 9 | 10 |
| 10 #ifndef BASE_BIND_INTERNAL_H_ | 11 #ifndef BASE_BIND_INTERNAL_H_ |
| 11 #define BASE_BIND_INTERNAL_H_ | 12 #define BASE_BIND_INTERNAL_H_ |
| 12 #pragma once | 13 #pragma once |
| 13 | 14 |
| 14 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
| 15 #include "base/callback_internal.h" | 16 #include "base/callback_internal.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // By normalizing the function signature, we reduce function_type to exactly 2. | 67 // By normalizing the function signature, we reduce function_type to exactly 2. |
| 67 | 68 |
| 68 template <typename Sig> | 69 template <typename Sig> |
| 69 struct FunctionTraits; | 70 struct FunctionTraits; |
| 70 | 71 |
| 71 // Function: Arity 0. | 72 // Function: Arity 0. |
| 72 template <typename R> | 73 template <typename R> |
| 73 struct FunctionTraits<R(*)()> { | 74 struct FunctionTraits<R(*)()> { |
| 74 typedef R (*NormalizedSig)(); | 75 typedef R (*NormalizedSig)(); |
| 75 typedef false_type IsMethod; | 76 typedef false_type IsMethod; |
| 77 |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 // Method: Arity 0. | 80 // Method: Arity 0. |
| 79 template <typename R, typename T> | 81 template <typename R, typename T> |
| 80 struct FunctionTraits<R(T::*)()> { | 82 struct FunctionTraits<R(T::*)()> { |
| 81 typedef R (T::*NormalizedSig)(); | 83 typedef R (T::*NormalizedSig)(); |
| 82 typedef true_type IsMethod; | 84 typedef true_type IsMethod; |
| 85 |
| 86 // Target type for each bound parameter. |
| 87 typedef T B1; |
| 88 |
| 83 }; | 89 }; |
| 84 | 90 |
| 85 // Const Method: Arity 0. | 91 // Const Method: Arity 0. |
| 86 template <typename R, typename T> | 92 template <typename R, typename T> |
| 87 struct FunctionTraits<R(T::*)() const> { | 93 struct FunctionTraits<R(T::*)() const> { |
| 88 typedef R (T::*NormalizedSig)(); | 94 typedef R (T::*NormalizedSig)(); |
| 89 typedef true_type IsMethod; | 95 typedef true_type IsMethod; |
| 96 |
| 97 // Target type for each bound parameter. |
| 98 typedef T B1; |
| 99 |
| 90 }; | 100 }; |
| 91 | 101 |
| 92 // Function: Arity 1. | 102 // Function: Arity 1. |
| 93 template <typename R, typename X1> | 103 template <typename R, typename X1> |
| 94 struct FunctionTraits<R(*)(X1)> { | 104 struct FunctionTraits<R(*)(X1)> { |
| 95 typedef R (*NormalizedSig)(X1); | 105 typedef R (*NormalizedSig)(X1); |
| 96 typedef false_type IsMethod; | 106 typedef false_type IsMethod; |
| 107 // Target type for each bound parameter. |
| 108 typedef X1 B1; |
| 109 |
| 97 }; | 110 }; |
| 98 | 111 |
| 99 // Method: Arity 1. | 112 // Method: Arity 1. |
| 100 template <typename R, typename T, typename X1> | 113 template <typename R, typename T, typename X1> |
| 101 struct FunctionTraits<R(T::*)(X1)> { | 114 struct FunctionTraits<R(T::*)(X1)> { |
| 102 typedef R (T::*NormalizedSig)(X1); | 115 typedef R (T::*NormalizedSig)(X1); |
| 103 typedef true_type IsMethod; | 116 typedef true_type IsMethod; |
| 117 |
| 118 // Target type for each bound parameter. |
| 119 typedef T B1; |
| 120 typedef X1 B2; |
| 121 |
| 104 }; | 122 }; |
| 105 | 123 |
| 106 // Const Method: Arity 1. | 124 // Const Method: Arity 1. |
| 107 template <typename R, typename T, typename X1> | 125 template <typename R, typename T, typename X1> |
| 108 struct FunctionTraits<R(T::*)(X1) const> { | 126 struct FunctionTraits<R(T::*)(X1) const> { |
| 109 typedef R (T::*NormalizedSig)(X1); | 127 typedef R (T::*NormalizedSig)(X1); |
| 110 typedef true_type IsMethod; | 128 typedef true_type IsMethod; |
| 129 |
| 130 // Target type for each bound parameter. |
| 131 typedef T B1; |
| 132 typedef X1 B2; |
| 133 |
| 111 }; | 134 }; |
| 112 | 135 |
| 113 // Function: Arity 2. | 136 // Function: Arity 2. |
| 114 template <typename R, typename X1, typename X2> | 137 template <typename R, typename X1, typename X2> |
| 115 struct FunctionTraits<R(*)(X1, X2)> { | 138 struct FunctionTraits<R(*)(X1, X2)> { |
| 116 typedef R (*NormalizedSig)(X1, X2); | 139 typedef R (*NormalizedSig)(X1, X2); |
| 117 typedef false_type IsMethod; | 140 typedef false_type IsMethod; |
| 141 // Target type for each bound parameter. |
| 142 typedef X1 B1; |
| 143 typedef X2 B2; |
| 144 |
| 118 }; | 145 }; |
| 119 | 146 |
| 120 // Method: Arity 2. | 147 // Method: Arity 2. |
| 121 template <typename R, typename T, typename X1, typename X2> | 148 template <typename R, typename T, typename X1, typename X2> |
| 122 struct FunctionTraits<R(T::*)(X1, X2)> { | 149 struct FunctionTraits<R(T::*)(X1, X2)> { |
| 123 typedef R (T::*NormalizedSig)(X1, X2); | 150 typedef R (T::*NormalizedSig)(X1, X2); |
| 124 typedef true_type IsMethod; | 151 typedef true_type IsMethod; |
| 152 |
| 153 // Target type for each bound parameter. |
| 154 typedef T B1; |
| 155 typedef X1 B2; |
| 156 typedef X2 B3; |
| 157 |
| 125 }; | 158 }; |
| 126 | 159 |
| 127 // Const Method: Arity 2. | 160 // Const Method: Arity 2. |
| 128 template <typename R, typename T, typename X1, typename X2> | 161 template <typename R, typename T, typename X1, typename X2> |
| 129 struct FunctionTraits<R(T::*)(X1, X2) const> { | 162 struct FunctionTraits<R(T::*)(X1, X2) const> { |
| 130 typedef R (T::*NormalizedSig)(X1, X2); | 163 typedef R (T::*NormalizedSig)(X1, X2); |
| 131 typedef true_type IsMethod; | 164 typedef true_type IsMethod; |
| 165 |
| 166 // Target type for each bound parameter. |
| 167 typedef T B1; |
| 168 typedef X1 B2; |
| 169 typedef X2 B3; |
| 170 |
| 132 }; | 171 }; |
| 133 | 172 |
| 134 // Function: Arity 3. | 173 // Function: Arity 3. |
| 135 template <typename R, typename X1, typename X2, typename X3> | 174 template <typename R, typename X1, typename X2, typename X3> |
| 136 struct FunctionTraits<R(*)(X1, X2, X3)> { | 175 struct FunctionTraits<R(*)(X1, X2, X3)> { |
| 137 typedef R (*NormalizedSig)(X1, X2, X3); | 176 typedef R (*NormalizedSig)(X1, X2, X3); |
| 138 typedef false_type IsMethod; | 177 typedef false_type IsMethod; |
| 178 // Target type for each bound parameter. |
| 179 typedef X1 B1; |
| 180 typedef X2 B2; |
| 181 typedef X3 B3; |
| 182 |
| 139 }; | 183 }; |
| 140 | 184 |
| 141 // Method: Arity 3. | 185 // Method: Arity 3. |
| 142 template <typename R, typename T, typename X1, typename X2, typename X3> | 186 template <typename R, typename T, typename X1, typename X2, typename X3> |
| 143 struct FunctionTraits<R(T::*)(X1, X2, X3)> { | 187 struct FunctionTraits<R(T::*)(X1, X2, X3)> { |
| 144 typedef R (T::*NormalizedSig)(X1, X2, X3); | 188 typedef R (T::*NormalizedSig)(X1, X2, X3); |
| 145 typedef true_type IsMethod; | 189 typedef true_type IsMethod; |
| 190 |
| 191 // Target type for each bound parameter. |
| 192 typedef T B1; |
| 193 typedef X1 B2; |
| 194 typedef X2 B3; |
| 195 typedef X3 B4; |
| 196 |
| 146 }; | 197 }; |
| 147 | 198 |
| 148 // Const Method: Arity 3. | 199 // Const Method: Arity 3. |
| 149 template <typename R, typename T, typename X1, typename X2, typename X3> | 200 template <typename R, typename T, typename X1, typename X2, typename X3> |
| 150 struct FunctionTraits<R(T::*)(X1, X2, X3) const> { | 201 struct FunctionTraits<R(T::*)(X1, X2, X3) const> { |
| 151 typedef R (T::*NormalizedSig)(X1, X2, X3); | 202 typedef R (T::*NormalizedSig)(X1, X2, X3); |
| 152 typedef true_type IsMethod; | 203 typedef true_type IsMethod; |
| 204 |
| 205 // Target type for each bound parameter. |
| 206 typedef T B1; |
| 207 typedef X1 B2; |
| 208 typedef X2 B3; |
| 209 typedef X3 B4; |
| 210 |
| 153 }; | 211 }; |
| 154 | 212 |
| 155 // Function: Arity 4. | 213 // Function: Arity 4. |
| 156 template <typename R, typename X1, typename X2, typename X3, typename X4> | 214 template <typename R, typename X1, typename X2, typename X3, typename X4> |
| 157 struct FunctionTraits<R(*)(X1, X2, X3, X4)> { | 215 struct FunctionTraits<R(*)(X1, X2, X3, X4)> { |
| 158 typedef R (*NormalizedSig)(X1, X2, X3, X4); | 216 typedef R (*NormalizedSig)(X1, X2, X3, X4); |
| 159 typedef false_type IsMethod; | 217 typedef false_type IsMethod; |
| 218 // Target type for each bound parameter. |
| 219 typedef X1 B1; |
| 220 typedef X2 B2; |
| 221 typedef X3 B3; |
| 222 typedef X4 B4; |
| 223 |
| 160 }; | 224 }; |
| 161 | 225 |
| 162 // Method: Arity 4. | 226 // Method: Arity 4. |
| 163 template <typename R, typename T, typename X1, typename X2, typename X3, | 227 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 164 typename X4> | 228 typename X4> |
| 165 struct FunctionTraits<R(T::*)(X1, X2, X3, X4)> { | 229 struct FunctionTraits<R(T::*)(X1, X2, X3, X4)> { |
| 166 typedef R (T::*NormalizedSig)(X1, X2, X3, X4); | 230 typedef R (T::*NormalizedSig)(X1, X2, X3, X4); |
| 167 typedef true_type IsMethod; | 231 typedef true_type IsMethod; |
| 232 |
| 233 // Target type for each bound parameter. |
| 234 typedef T B1; |
| 235 typedef X1 B2; |
| 236 typedef X2 B3; |
| 237 typedef X3 B4; |
| 238 typedef X4 B5; |
| 239 |
| 168 }; | 240 }; |
| 169 | 241 |
| 170 // Const Method: Arity 4. | 242 // Const Method: Arity 4. |
| 171 template <typename R, typename T, typename X1, typename X2, typename X3, | 243 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 172 typename X4> | 244 typename X4> |
| 173 struct FunctionTraits<R(T::*)(X1, X2, X3, X4) const> { | 245 struct FunctionTraits<R(T::*)(X1, X2, X3, X4) const> { |
| 174 typedef R (T::*NormalizedSig)(X1, X2, X3, X4); | 246 typedef R (T::*NormalizedSig)(X1, X2, X3, X4); |
| 175 typedef true_type IsMethod; | 247 typedef true_type IsMethod; |
| 248 |
| 249 // Target type for each bound parameter. |
| 250 typedef T B1; |
| 251 typedef X1 B2; |
| 252 typedef X2 B3; |
| 253 typedef X3 B4; |
| 254 typedef X4 B5; |
| 255 |
| 176 }; | 256 }; |
| 177 | 257 |
| 178 // Function: Arity 5. | 258 // Function: Arity 5. |
| 179 template <typename R, typename X1, typename X2, typename X3, typename X4, | 259 template <typename R, typename X1, typename X2, typename X3, typename X4, |
| 180 typename X5> | 260 typename X5> |
| 181 struct FunctionTraits<R(*)(X1, X2, X3, X4, X5)> { | 261 struct FunctionTraits<R(*)(X1, X2, X3, X4, X5)> { |
| 182 typedef R (*NormalizedSig)(X1, X2, X3, X4, X5); | 262 typedef R (*NormalizedSig)(X1, X2, X3, X4, X5); |
| 183 typedef false_type IsMethod; | 263 typedef false_type IsMethod; |
| 264 // Target type for each bound parameter. |
| 265 typedef X1 B1; |
| 266 typedef X2 B2; |
| 267 typedef X3 B3; |
| 268 typedef X4 B4; |
| 269 typedef X5 B5; |
| 270 |
| 184 }; | 271 }; |
| 185 | 272 |
| 186 // Method: Arity 5. | 273 // Method: Arity 5. |
| 187 template <typename R, typename T, typename X1, typename X2, typename X3, | 274 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 188 typename X4, typename X5> | 275 typename X4, typename X5> |
| 189 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5)> { | 276 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5)> { |
| 190 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5); | 277 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5); |
| 191 typedef true_type IsMethod; | 278 typedef true_type IsMethod; |
| 279 |
| 280 // Target type for each bound parameter. |
| 281 typedef T B1; |
| 282 typedef X1 B2; |
| 283 typedef X2 B3; |
| 284 typedef X3 B4; |
| 285 typedef X4 B5; |
| 286 typedef X5 B6; |
| 287 |
| 192 }; | 288 }; |
| 193 | 289 |
| 194 // Const Method: Arity 5. | 290 // Const Method: Arity 5. |
| 195 template <typename R, typename T, typename X1, typename X2, typename X3, | 291 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 196 typename X4, typename X5> | 292 typename X4, typename X5> |
| 197 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5) const> { | 293 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5) const> { |
| 198 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5); | 294 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5); |
| 199 typedef true_type IsMethod; | 295 typedef true_type IsMethod; |
| 296 |
| 297 // Target type for each bound parameter. |
| 298 typedef T B1; |
| 299 typedef X1 B2; |
| 300 typedef X2 B3; |
| 301 typedef X3 B4; |
| 302 typedef X4 B5; |
| 303 typedef X5 B6; |
| 304 |
| 200 }; | 305 }; |
| 201 | 306 |
| 202 // Function: Arity 6. | 307 // Function: Arity 6. |
| 203 template <typename R, typename X1, typename X2, typename X3, typename X4, | 308 template <typename R, typename X1, typename X2, typename X3, typename X4, |
| 204 typename X5, typename X6> | 309 typename X5, typename X6> |
| 205 struct FunctionTraits<R(*)(X1, X2, X3, X4, X5, X6)> { | 310 struct FunctionTraits<R(*)(X1, X2, X3, X4, X5, X6)> { |
| 206 typedef R (*NormalizedSig)(X1, X2, X3, X4, X5, X6); | 311 typedef R (*NormalizedSig)(X1, X2, X3, X4, X5, X6); |
| 207 typedef false_type IsMethod; | 312 typedef false_type IsMethod; |
| 313 // Target type for each bound parameter. |
| 314 typedef X1 B1; |
| 315 typedef X2 B2; |
| 316 typedef X3 B3; |
| 317 typedef X4 B4; |
| 318 typedef X5 B5; |
| 319 typedef X6 B6; |
| 320 |
| 208 }; | 321 }; |
| 209 | 322 |
| 210 // Method: Arity 6. | 323 // Method: Arity 6. |
| 211 template <typename R, typename T, typename X1, typename X2, typename X3, | 324 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 212 typename X4, typename X5, typename X6> | 325 typename X4, typename X5, typename X6> |
| 213 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5, X6)> { | 326 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5, X6)> { |
| 214 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5, X6); | 327 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5, X6); |
| 215 typedef true_type IsMethod; | 328 typedef true_type IsMethod; |
| 329 |
| 330 // Target type for each bound parameter. |
| 331 typedef T B1; |
| 332 typedef X1 B2; |
| 333 typedef X2 B3; |
| 334 typedef X3 B4; |
| 335 typedef X4 B5; |
| 336 typedef X5 B6; |
| 337 typedef X6 B7; |
| 338 |
| 216 }; | 339 }; |
| 217 | 340 |
| 218 // Const Method: Arity 6. | 341 // Const Method: Arity 6. |
| 219 template <typename R, typename T, typename X1, typename X2, typename X3, | 342 template <typename R, typename T, typename X1, typename X2, typename X3, |
| 220 typename X4, typename X5, typename X6> | 343 typename X4, typename X5, typename X6> |
| 221 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5, X6) const> { | 344 struct FunctionTraits<R(T::*)(X1, X2, X3, X4, X5, X6) const> { |
| 222 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5, X6); | 345 typedef R (T::*NormalizedSig)(X1, X2, X3, X4, X5, X6); |
| 223 typedef true_type IsMethod; | 346 typedef true_type IsMethod; |
| 347 |
| 348 // Target type for each bound parameter. |
| 349 typedef T B1; |
| 350 typedef X1 B2; |
| 351 typedef X2 B3; |
| 352 typedef X3 B4; |
| 353 typedef X4 B5; |
| 354 typedef X5 B6; |
| 355 typedef X6 B7; |
| 356 |
| 224 }; | 357 }; |
| 225 | 358 |
| 226 // InvokerN<> | 359 // InvokerN<> |
| 227 // | 360 // |
| 228 // The InvokerN templates contain a static DoInvoke() function that is the key | 361 // The InvokerN templates contain a static DoInvoke() function that is the key |
| 229 // to implementing type erasure in the Callback() classes. | 362 // to implementing type erasure in the Callback() classes. |
| 230 // | 363 // |
| 231 // DoInvoke() is a static function with a fixed signature that is independent | 364 // DoInvoke() is a static function with a fixed signature that is independent |
| 232 // of StorageType; its first argument is a pointer to the non-templated common | 365 // of StorageType; its first argument is a pointer to the non-templated common |
| 233 // baseclass of StorageType. This lets us store pointer to DoInvoke() in a | 366 // baseclass of StorageType. This lets us store pointer to DoInvoke() in a |
| (...skipping 17 matching lines...) Expand all Loading... |
| 251 struct Invoker0<StorageType, R(*)()> { | 384 struct Invoker0<StorageType, R(*)()> { |
| 252 static R DoInvoke(InvokerStorageBase* base) { | 385 static R DoInvoke(InvokerStorageBase* base) { |
| 253 StorageType* invoker = static_cast<StorageType*>(base); | 386 StorageType* invoker = static_cast<StorageType*>(base); |
| 254 return invoker->f_(); | 387 return invoker->f_(); |
| 255 } | 388 } |
| 256 }; | 389 }; |
| 257 | 390 |
| 258 // Function: Arity 1 -> 1. | 391 // Function: Arity 1 -> 1. |
| 259 template <typename StorageType, typename R,typename X1> | 392 template <typename StorageType, typename R,typename X1> |
| 260 struct Invoker0<StorageType, R(*)(X1)> { | 393 struct Invoker0<StorageType, R(*)(X1)> { |
| 261 COMPILE_ASSERT( | 394 static R DoInvoke(InvokerStorageBase* base, |
| 262 !( is_non_const_reference<X1>::value ), | 395 typename internal::ParamTraits<X1>::ForwardType x1) { |
| 263 do_not_bind_functions_with_nonconst_ref); | |
| 264 | |
| 265 static R DoInvoke(InvokerStorageBase* base, const X1& x1) { | |
| 266 StorageType* invoker = static_cast<StorageType*>(base); | 396 StorageType* invoker = static_cast<StorageType*>(base); |
| 267 return invoker->f_(x1); | 397 return invoker->f_(x1); |
| 268 } | 398 } |
| 269 }; | 399 }; |
| 270 | 400 |
| 271 // Function: Arity 2 -> 2. | 401 // Function: Arity 2 -> 2. |
| 272 template <typename StorageType, typename R,typename X1, typename X2> | 402 template <typename StorageType, typename R,typename X1, typename X2> |
| 273 struct Invoker0<StorageType, R(*)(X1, X2)> { | 403 struct Invoker0<StorageType, R(*)(X1, X2)> { |
| 274 COMPILE_ASSERT( | 404 static R DoInvoke(InvokerStorageBase* base, |
| 275 !( is_non_const_reference<X1>::value || | 405 typename internal::ParamTraits<X1>::ForwardType x1, |
| 276 is_non_const_reference<X2>::value ), | 406 typename internal::ParamTraits<X2>::ForwardType x2) { |
| 277 do_not_bind_functions_with_nonconst_ref); | |
| 278 | |
| 279 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2) { | |
| 280 StorageType* invoker = static_cast<StorageType*>(base); | 407 StorageType* invoker = static_cast<StorageType*>(base); |
| 281 return invoker->f_(x1, x2); | 408 return invoker->f_(x1, x2); |
| 282 } | 409 } |
| 283 }; | 410 }; |
| 284 | 411 |
| 285 // Function: Arity 3 -> 3. | 412 // Function: Arity 3 -> 3. |
| 286 template <typename StorageType, typename R,typename X1, typename X2, | 413 template <typename StorageType, typename R,typename X1, typename X2, |
| 287 typename X3> | 414 typename X3> |
| 288 struct Invoker0<StorageType, R(*)(X1, X2, X3)> { | 415 struct Invoker0<StorageType, R(*)(X1, X2, X3)> { |
| 289 COMPILE_ASSERT( | 416 static R DoInvoke(InvokerStorageBase* base, |
| 290 !( is_non_const_reference<X1>::value || | 417 typename internal::ParamTraits<X1>::ForwardType x1, |
| 291 is_non_const_reference<X2>::value || | 418 typename internal::ParamTraits<X2>::ForwardType x2, |
| 292 is_non_const_reference<X3>::value ), | 419 typename internal::ParamTraits<X3>::ForwardType x3) { |
| 293 do_not_bind_functions_with_nonconst_ref); | |
| 294 | |
| 295 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 296 const X3& x3) { | |
| 297 StorageType* invoker = static_cast<StorageType*>(base); | 420 StorageType* invoker = static_cast<StorageType*>(base); |
| 298 return invoker->f_(x1, x2, x3); | 421 return invoker->f_(x1, x2, x3); |
| 299 } | 422 } |
| 300 }; | 423 }; |
| 301 | 424 |
| 302 // Function: Arity 4 -> 4. | 425 // Function: Arity 4 -> 4. |
| 303 template <typename StorageType, typename R,typename X1, typename X2, | 426 template <typename StorageType, typename R,typename X1, typename X2, |
| 304 typename X3, typename X4> | 427 typename X3, typename X4> |
| 305 struct Invoker0<StorageType, R(*)(X1, X2, X3, X4)> { | 428 struct Invoker0<StorageType, R(*)(X1, X2, X3, X4)> { |
| 306 COMPILE_ASSERT( | 429 static R DoInvoke(InvokerStorageBase* base, |
| 307 !( is_non_const_reference<X1>::value || | 430 typename internal::ParamTraits<X1>::ForwardType x1, |
| 308 is_non_const_reference<X2>::value || | 431 typename internal::ParamTraits<X2>::ForwardType x2, |
| 309 is_non_const_reference<X3>::value || | 432 typename internal::ParamTraits<X3>::ForwardType x3, |
| 310 is_non_const_reference<X4>::value ), | 433 typename internal::ParamTraits<X4>::ForwardType x4) { |
| 311 do_not_bind_functions_with_nonconst_ref); | |
| 312 | |
| 313 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 314 const X3& x3, const X4& x4) { | |
| 315 StorageType* invoker = static_cast<StorageType*>(base); | 434 StorageType* invoker = static_cast<StorageType*>(base); |
| 316 return invoker->f_(x1, x2, x3, x4); | 435 return invoker->f_(x1, x2, x3, x4); |
| 317 } | 436 } |
| 318 }; | 437 }; |
| 319 | 438 |
| 320 // Function: Arity 5 -> 5. | 439 // Function: Arity 5 -> 5. |
| 321 template <typename StorageType, typename R,typename X1, typename X2, | 440 template <typename StorageType, typename R,typename X1, typename X2, |
| 322 typename X3, typename X4, typename X5> | 441 typename X3, typename X4, typename X5> |
| 323 struct Invoker0<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 442 struct Invoker0<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 324 COMPILE_ASSERT( | 443 static R DoInvoke(InvokerStorageBase* base, |
| 325 !( is_non_const_reference<X1>::value || | 444 typename internal::ParamTraits<X1>::ForwardType x1, |
| 326 is_non_const_reference<X2>::value || | 445 typename internal::ParamTraits<X2>::ForwardType x2, |
| 327 is_non_const_reference<X3>::value || | 446 typename internal::ParamTraits<X3>::ForwardType x3, |
| 328 is_non_const_reference<X4>::value || | 447 typename internal::ParamTraits<X4>::ForwardType x4, |
| 329 is_non_const_reference<X5>::value ), | 448 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 330 do_not_bind_functions_with_nonconst_ref); | |
| 331 | |
| 332 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 333 const X3& x3, const X4& x4, const X5& x5) { | |
| 334 StorageType* invoker = static_cast<StorageType*>(base); | 449 StorageType* invoker = static_cast<StorageType*>(base); |
| 335 return invoker->f_(x1, x2, x3, x4, x5); | 450 return invoker->f_(x1, x2, x3, x4, x5); |
| 336 } | 451 } |
| 337 }; | 452 }; |
| 338 | 453 |
| 339 // Function: Arity 6 -> 6. | 454 // Function: Arity 6 -> 6. |
| 340 template <typename StorageType, typename R,typename X1, typename X2, | 455 template <typename StorageType, typename R,typename X1, typename X2, |
| 341 typename X3, typename X4, typename X5, typename X6> | 456 typename X3, typename X4, typename X5, typename X6> |
| 342 struct Invoker0<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 457 struct Invoker0<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 343 COMPILE_ASSERT( | 458 static R DoInvoke(InvokerStorageBase* base, |
| 344 !( is_non_const_reference<X1>::value || | 459 typename internal::ParamTraits<X1>::ForwardType x1, |
| 345 is_non_const_reference<X2>::value || | 460 typename internal::ParamTraits<X2>::ForwardType x2, |
| 346 is_non_const_reference<X3>::value || | 461 typename internal::ParamTraits<X3>::ForwardType x3, |
| 347 is_non_const_reference<X4>::value || | 462 typename internal::ParamTraits<X4>::ForwardType x4, |
| 348 is_non_const_reference<X5>::value || | 463 typename internal::ParamTraits<X5>::ForwardType x5, |
| 349 is_non_const_reference<X6>::value ), | 464 typename internal::ParamTraits<X6>::ForwardType x6) { |
| 350 do_not_bind_functions_with_nonconst_ref); | |
| 351 | |
| 352 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 353 const X3& x3, const X4& x4, const X5& x5, const X6& x6) { | |
| 354 StorageType* invoker = static_cast<StorageType*>(base); | 465 StorageType* invoker = static_cast<StorageType*>(base); |
| 355 return invoker->f_(x1, x2, x3, x4, x5, x6); | 466 return invoker->f_(x1, x2, x3, x4, x5, x6); |
| 356 } | 467 } |
| 357 }; | 468 }; |
| 358 | 469 |
| 359 template <typename StorageType, typename NormalizedSig> | 470 template <typename StorageType, typename NormalizedSig> |
| 360 struct Invoker1; | 471 struct Invoker1; |
| 361 | 472 |
| 362 // Function: Arity 1 -> 0. | 473 // Function: Arity 1 -> 0. |
| 363 template <typename StorageType, typename R,typename X1> | 474 template <typename StorageType, typename R,typename X1> |
| 364 struct Invoker1<StorageType, R(*)(X1)> { | 475 struct Invoker1<StorageType, R(*)(X1)> { |
| 365 COMPILE_ASSERT( | |
| 366 !( is_non_const_reference<X1>::value ), | |
| 367 do_not_bind_functions_with_nonconst_ref); | |
| 368 | |
| 369 static R DoInvoke(InvokerStorageBase* base) { | 476 static R DoInvoke(InvokerStorageBase* base) { |
| 370 StorageType* invoker = static_cast<StorageType*>(base); | 477 StorageType* invoker = static_cast<StorageType*>(base); |
| 371 return invoker->f_(Unwrap(invoker->p1_)); | 478 return invoker->f_(Unwrap(invoker->p1_)); |
| 372 } | 479 } |
| 373 }; | 480 }; |
| 374 | 481 |
| 375 // Method: Arity 0 -> 0. | 482 // Method: Arity 0 -> 0. |
| 376 template <typename StorageType, typename R, typename T> | 483 template <typename StorageType, typename R, typename T> |
| 377 struct Invoker1<StorageType, R(T::*)()> { | 484 struct Invoker1<StorageType, R(T::*)()> { |
| 378 static R DoInvoke(InvokerStorageBase* base) { | 485 static R DoInvoke(InvokerStorageBase* base) { |
| 379 StorageType* invoker = static_cast<StorageType*>(base); | 486 StorageType* invoker = static_cast<StorageType*>(base); |
| 380 return (Unwrap(invoker->p1_)->*invoker->f_)(); | 487 return (Unwrap(invoker->p1_)->*invoker->f_)(); |
| 381 } | 488 } |
| 382 }; | 489 }; |
| 383 | 490 |
| 384 // Function: Arity 2 -> 1. | 491 // Function: Arity 2 -> 1. |
| 385 template <typename StorageType, typename R,typename X1, typename X2> | 492 template <typename StorageType, typename R,typename X1, typename X2> |
| 386 struct Invoker1<StorageType, R(*)(X1, X2)> { | 493 struct Invoker1<StorageType, R(*)(X1, X2)> { |
| 387 COMPILE_ASSERT( | 494 static R DoInvoke(InvokerStorageBase* base, |
| 388 !( is_non_const_reference<X1>::value || | 495 typename internal::ParamTraits<X2>::ForwardType x2) { |
| 389 is_non_const_reference<X2>::value ), | |
| 390 do_not_bind_functions_with_nonconst_ref); | |
| 391 | |
| 392 static R DoInvoke(InvokerStorageBase* base, const X2& x2) { | |
| 393 StorageType* invoker = static_cast<StorageType*>(base); | 496 StorageType* invoker = static_cast<StorageType*>(base); |
| 394 return invoker->f_(Unwrap(invoker->p1_), x2); | 497 return invoker->f_(Unwrap(invoker->p1_), x2); |
| 395 } | 498 } |
| 396 }; | 499 }; |
| 397 | 500 |
| 398 // Method: Arity 1 -> 1. | 501 // Method: Arity 1 -> 1. |
| 399 template <typename StorageType, typename R, typename T, typename X1> | 502 template <typename StorageType, typename R, typename T, typename X1> |
| 400 struct Invoker1<StorageType, R(T::*)(X1)> { | 503 struct Invoker1<StorageType, R(T::*)(X1)> { |
| 401 COMPILE_ASSERT( | 504 static R DoInvoke(InvokerStorageBase* base, |
| 402 !( is_non_const_reference<X1>::value ), | 505 typename internal::ParamTraits<X1>::ForwardType x1) { |
| 403 do_not_bind_functions_with_nonconst_ref); | |
| 404 | |
| 405 static R DoInvoke(InvokerStorageBase* base, const X1& x1) { | |
| 406 StorageType* invoker = static_cast<StorageType*>(base); | 506 StorageType* invoker = static_cast<StorageType*>(base); |
| 407 return (Unwrap(invoker->p1_)->*invoker->f_)(x1); | 507 return (Unwrap(invoker->p1_)->*invoker->f_)(x1); |
| 408 } | 508 } |
| 409 }; | 509 }; |
| 410 | 510 |
| 411 // Function: Arity 3 -> 2. | 511 // Function: Arity 3 -> 2. |
| 412 template <typename StorageType, typename R,typename X1, typename X2, | 512 template <typename StorageType, typename R,typename X1, typename X2, |
| 413 typename X3> | 513 typename X3> |
| 414 struct Invoker1<StorageType, R(*)(X1, X2, X3)> { | 514 struct Invoker1<StorageType, R(*)(X1, X2, X3)> { |
| 415 COMPILE_ASSERT( | 515 static R DoInvoke(InvokerStorageBase* base, |
| 416 !( is_non_const_reference<X1>::value || | 516 typename internal::ParamTraits<X2>::ForwardType x2, |
| 417 is_non_const_reference<X2>::value || | 517 typename internal::ParamTraits<X3>::ForwardType x3) { |
| 418 is_non_const_reference<X3>::value ), | |
| 419 do_not_bind_functions_with_nonconst_ref); | |
| 420 | |
| 421 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3) { | |
| 422 StorageType* invoker = static_cast<StorageType*>(base); | 518 StorageType* invoker = static_cast<StorageType*>(base); |
| 423 return invoker->f_(Unwrap(invoker->p1_), x2, x3); | 519 return invoker->f_(Unwrap(invoker->p1_), x2, x3); |
| 424 } | 520 } |
| 425 }; | 521 }; |
| 426 | 522 |
| 427 // Method: Arity 2 -> 2. | 523 // Method: Arity 2 -> 2. |
| 428 template <typename StorageType, typename R, typename T, typename X1, | 524 template <typename StorageType, typename R, typename T, typename X1, |
| 429 typename X2> | 525 typename X2> |
| 430 struct Invoker1<StorageType, R(T::*)(X1, X2)> { | 526 struct Invoker1<StorageType, R(T::*)(X1, X2)> { |
| 431 COMPILE_ASSERT( | 527 static R DoInvoke(InvokerStorageBase* base, |
| 432 !( is_non_const_reference<X1>::value || | 528 typename internal::ParamTraits<X1>::ForwardType x1, |
| 433 is_non_const_reference<X2>::value ), | 529 typename internal::ParamTraits<X2>::ForwardType x2) { |
| 434 do_not_bind_functions_with_nonconst_ref); | |
| 435 | |
| 436 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2) { | |
| 437 StorageType* invoker = static_cast<StorageType*>(base); | 530 StorageType* invoker = static_cast<StorageType*>(base); |
| 438 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2); | 531 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2); |
| 439 } | 532 } |
| 440 }; | 533 }; |
| 441 | 534 |
| 442 // Function: Arity 4 -> 3. | 535 // Function: Arity 4 -> 3. |
| 443 template <typename StorageType, typename R,typename X1, typename X2, | 536 template <typename StorageType, typename R,typename X1, typename X2, |
| 444 typename X3, typename X4> | 537 typename X3, typename X4> |
| 445 struct Invoker1<StorageType, R(*)(X1, X2, X3, X4)> { | 538 struct Invoker1<StorageType, R(*)(X1, X2, X3, X4)> { |
| 446 COMPILE_ASSERT( | 539 static R DoInvoke(InvokerStorageBase* base, |
| 447 !( is_non_const_reference<X1>::value || | 540 typename internal::ParamTraits<X2>::ForwardType x2, |
| 448 is_non_const_reference<X2>::value || | 541 typename internal::ParamTraits<X3>::ForwardType x3, |
| 449 is_non_const_reference<X3>::value || | 542 typename internal::ParamTraits<X4>::ForwardType x4) { |
| 450 is_non_const_reference<X4>::value ), | |
| 451 do_not_bind_functions_with_nonconst_ref); | |
| 452 | |
| 453 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | |
| 454 const X4& x4) { | |
| 455 StorageType* invoker = static_cast<StorageType*>(base); | 543 StorageType* invoker = static_cast<StorageType*>(base); |
| 456 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4); | 544 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4); |
| 457 } | 545 } |
| 458 }; | 546 }; |
| 459 | 547 |
| 460 // Method: Arity 3 -> 3. | 548 // Method: Arity 3 -> 3. |
| 461 template <typename StorageType, typename R, typename T, typename X1, | 549 template <typename StorageType, typename R, typename T, typename X1, |
| 462 typename X2, typename X3> | 550 typename X2, typename X3> |
| 463 struct Invoker1<StorageType, R(T::*)(X1, X2, X3)> { | 551 struct Invoker1<StorageType, R(T::*)(X1, X2, X3)> { |
| 464 COMPILE_ASSERT( | 552 static R DoInvoke(InvokerStorageBase* base, |
| 465 !( is_non_const_reference<X1>::value || | 553 typename internal::ParamTraits<X1>::ForwardType x1, |
| 466 is_non_const_reference<X2>::value || | 554 typename internal::ParamTraits<X2>::ForwardType x2, |
| 467 is_non_const_reference<X3>::value ), | 555 typename internal::ParamTraits<X3>::ForwardType x3) { |
| 468 do_not_bind_functions_with_nonconst_ref); | |
| 469 | |
| 470 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 471 const X3& x3) { | |
| 472 StorageType* invoker = static_cast<StorageType*>(base); | 556 StorageType* invoker = static_cast<StorageType*>(base); |
| 473 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3); | 557 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3); |
| 474 } | 558 } |
| 475 }; | 559 }; |
| 476 | 560 |
| 477 // Function: Arity 5 -> 4. | 561 // Function: Arity 5 -> 4. |
| 478 template <typename StorageType, typename R,typename X1, typename X2, | 562 template <typename StorageType, typename R,typename X1, typename X2, |
| 479 typename X3, typename X4, typename X5> | 563 typename X3, typename X4, typename X5> |
| 480 struct Invoker1<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 564 struct Invoker1<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 481 COMPILE_ASSERT( | 565 static R DoInvoke(InvokerStorageBase* base, |
| 482 !( is_non_const_reference<X1>::value || | 566 typename internal::ParamTraits<X2>::ForwardType x2, |
| 483 is_non_const_reference<X2>::value || | 567 typename internal::ParamTraits<X3>::ForwardType x3, |
| 484 is_non_const_reference<X3>::value || | 568 typename internal::ParamTraits<X4>::ForwardType x4, |
| 485 is_non_const_reference<X4>::value || | 569 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 486 is_non_const_reference<X5>::value ), | |
| 487 do_not_bind_functions_with_nonconst_ref); | |
| 488 | |
| 489 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | |
| 490 const X4& x4, const X5& x5) { | |
| 491 StorageType* invoker = static_cast<StorageType*>(base); | 570 StorageType* invoker = static_cast<StorageType*>(base); |
| 492 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4, x5); | 571 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4, x5); |
| 493 } | 572 } |
| 494 }; | 573 }; |
| 495 | 574 |
| 496 // Method: Arity 4 -> 4. | 575 // Method: Arity 4 -> 4. |
| 497 template <typename StorageType, typename R, typename T, typename X1, | 576 template <typename StorageType, typename R, typename T, typename X1, |
| 498 typename X2, typename X3, typename X4> | 577 typename X2, typename X3, typename X4> |
| 499 struct Invoker1<StorageType, R(T::*)(X1, X2, X3, X4)> { | 578 struct Invoker1<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 500 COMPILE_ASSERT( | 579 static R DoInvoke(InvokerStorageBase* base, |
| 501 !( is_non_const_reference<X1>::value || | 580 typename internal::ParamTraits<X1>::ForwardType x1, |
| 502 is_non_const_reference<X2>::value || | 581 typename internal::ParamTraits<X2>::ForwardType x2, |
| 503 is_non_const_reference<X3>::value || | 582 typename internal::ParamTraits<X3>::ForwardType x3, |
| 504 is_non_const_reference<X4>::value ), | 583 typename internal::ParamTraits<X4>::ForwardType x4) { |
| 505 do_not_bind_functions_with_nonconst_ref); | |
| 506 | |
| 507 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 508 const X3& x3, const X4& x4) { | |
| 509 StorageType* invoker = static_cast<StorageType*>(base); | 584 StorageType* invoker = static_cast<StorageType*>(base); |
| 510 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4); | 585 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4); |
| 511 } | 586 } |
| 512 }; | 587 }; |
| 513 | 588 |
| 514 // Function: Arity 6 -> 5. | 589 // Function: Arity 6 -> 5. |
| 515 template <typename StorageType, typename R,typename X1, typename X2, | 590 template <typename StorageType, typename R,typename X1, typename X2, |
| 516 typename X3, typename X4, typename X5, typename X6> | 591 typename X3, typename X4, typename X5, typename X6> |
| 517 struct Invoker1<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 592 struct Invoker1<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 518 COMPILE_ASSERT( | 593 static R DoInvoke(InvokerStorageBase* base, |
| 519 !( is_non_const_reference<X1>::value || | 594 typename internal::ParamTraits<X2>::ForwardType x2, |
| 520 is_non_const_reference<X2>::value || | 595 typename internal::ParamTraits<X3>::ForwardType x3, |
| 521 is_non_const_reference<X3>::value || | 596 typename internal::ParamTraits<X4>::ForwardType x4, |
| 522 is_non_const_reference<X4>::value || | 597 typename internal::ParamTraits<X5>::ForwardType x5, |
| 523 is_non_const_reference<X5>::value || | 598 typename internal::ParamTraits<X6>::ForwardType x6) { |
| 524 is_non_const_reference<X6>::value ), | |
| 525 do_not_bind_functions_with_nonconst_ref); | |
| 526 | |
| 527 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | |
| 528 const X4& x4, const X5& x5, const X6& x6) { | |
| 529 StorageType* invoker = static_cast<StorageType*>(base); | 599 StorageType* invoker = static_cast<StorageType*>(base); |
| 530 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4, x5, x6); | 600 return invoker->f_(Unwrap(invoker->p1_), x2, x3, x4, x5, x6); |
| 531 } | 601 } |
| 532 }; | 602 }; |
| 533 | 603 |
| 534 // Method: Arity 5 -> 5. | 604 // Method: Arity 5 -> 5. |
| 535 template <typename StorageType, typename R, typename T, typename X1, | 605 template <typename StorageType, typename R, typename T, typename X1, |
| 536 typename X2, typename X3, typename X4, typename X5> | 606 typename X2, typename X3, typename X4, typename X5> |
| 537 struct Invoker1<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 607 struct Invoker1<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 538 COMPILE_ASSERT( | 608 static R DoInvoke(InvokerStorageBase* base, |
| 539 !( is_non_const_reference<X1>::value || | 609 typename internal::ParamTraits<X1>::ForwardType x1, |
| 540 is_non_const_reference<X2>::value || | 610 typename internal::ParamTraits<X2>::ForwardType x2, |
| 541 is_non_const_reference<X3>::value || | 611 typename internal::ParamTraits<X3>::ForwardType x3, |
| 542 is_non_const_reference<X4>::value || | 612 typename internal::ParamTraits<X4>::ForwardType x4, |
| 543 is_non_const_reference<X5>::value ), | 613 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 544 do_not_bind_functions_with_nonconst_ref); | |
| 545 | |
| 546 static R DoInvoke(InvokerStorageBase* base, const X1& x1, const X2& x2, | |
| 547 const X3& x3, const X4& x4, const X5& x5) { | |
| 548 StorageType* invoker = static_cast<StorageType*>(base); | 614 StorageType* invoker = static_cast<StorageType*>(base); |
| 549 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4, x5); | 615 return (Unwrap(invoker->p1_)->*invoker->f_)(x1, x2, x3, x4, x5); |
| 550 } | 616 } |
| 551 }; | 617 }; |
| 552 | 618 |
| 553 template <typename StorageType, typename NormalizedSig> | 619 template <typename StorageType, typename NormalizedSig> |
| 554 struct Invoker2; | 620 struct Invoker2; |
| 555 | 621 |
| 556 // Function: Arity 2 -> 0. | 622 // Function: Arity 2 -> 0. |
| 557 template <typename StorageType, typename R,typename X1, typename X2> | 623 template <typename StorageType, typename R,typename X1, typename X2> |
| 558 struct Invoker2<StorageType, R(*)(X1, X2)> { | 624 struct Invoker2<StorageType, R(*)(X1, X2)> { |
| 559 COMPILE_ASSERT( | |
| 560 !( is_non_const_reference<X1>::value || | |
| 561 is_non_const_reference<X2>::value ), | |
| 562 do_not_bind_functions_with_nonconst_ref); | |
| 563 | |
| 564 static R DoInvoke(InvokerStorageBase* base) { | 625 static R DoInvoke(InvokerStorageBase* base) { |
| 565 StorageType* invoker = static_cast<StorageType*>(base); | 626 StorageType* invoker = static_cast<StorageType*>(base); |
| 566 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_)); | 627 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_)); |
| 567 } | 628 } |
| 568 }; | 629 }; |
| 569 | 630 |
| 570 // Method: Arity 1 -> 0. | 631 // Method: Arity 1 -> 0. |
| 571 template <typename StorageType, typename R, typename T, typename X1> | 632 template <typename StorageType, typename R, typename T, typename X1> |
| 572 struct Invoker2<StorageType, R(T::*)(X1)> { | 633 struct Invoker2<StorageType, R(T::*)(X1)> { |
| 573 COMPILE_ASSERT( | |
| 574 !( is_non_const_reference<X1>::value ), | |
| 575 do_not_bind_functions_with_nonconst_ref); | |
| 576 | |
| 577 static R DoInvoke(InvokerStorageBase* base) { | 634 static R DoInvoke(InvokerStorageBase* base) { |
| 578 StorageType* invoker = static_cast<StorageType*>(base); | 635 StorageType* invoker = static_cast<StorageType*>(base); |
| 579 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_)); | 636 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_)); |
| 580 } | 637 } |
| 581 }; | 638 }; |
| 582 | 639 |
| 583 // Function: Arity 3 -> 1. | 640 // Function: Arity 3 -> 1. |
| 584 template <typename StorageType, typename R,typename X1, typename X2, | 641 template <typename StorageType, typename R,typename X1, typename X2, |
| 585 typename X3> | 642 typename X3> |
| 586 struct Invoker2<StorageType, R(*)(X1, X2, X3)> { | 643 struct Invoker2<StorageType, R(*)(X1, X2, X3)> { |
| 587 COMPILE_ASSERT( | 644 static R DoInvoke(InvokerStorageBase* base, |
| 588 !( is_non_const_reference<X1>::value || | 645 typename internal::ParamTraits<X3>::ForwardType x3) { |
| 589 is_non_const_reference<X2>::value || | |
| 590 is_non_const_reference<X3>::value ), | |
| 591 do_not_bind_functions_with_nonconst_ref); | |
| 592 | |
| 593 static R DoInvoke(InvokerStorageBase* base, const X3& x3) { | |
| 594 StorageType* invoker = static_cast<StorageType*>(base); | 646 StorageType* invoker = static_cast<StorageType*>(base); |
| 595 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3); | 647 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3); |
| 596 } | 648 } |
| 597 }; | 649 }; |
| 598 | 650 |
| 599 // Method: Arity 2 -> 1. | 651 // Method: Arity 2 -> 1. |
| 600 template <typename StorageType, typename R, typename T, typename X1, | 652 template <typename StorageType, typename R, typename T, typename X1, |
| 601 typename X2> | 653 typename X2> |
| 602 struct Invoker2<StorageType, R(T::*)(X1, X2)> { | 654 struct Invoker2<StorageType, R(T::*)(X1, X2)> { |
| 603 COMPILE_ASSERT( | 655 static R DoInvoke(InvokerStorageBase* base, |
| 604 !( is_non_const_reference<X1>::value || | 656 typename internal::ParamTraits<X2>::ForwardType x2) { |
| 605 is_non_const_reference<X2>::value ), | |
| 606 do_not_bind_functions_with_nonconst_ref); | |
| 607 | |
| 608 static R DoInvoke(InvokerStorageBase* base, const X2& x2) { | |
| 609 StorageType* invoker = static_cast<StorageType*>(base); | 657 StorageType* invoker = static_cast<StorageType*>(base); |
| 610 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2); | 658 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2); |
| 611 } | 659 } |
| 612 }; | 660 }; |
| 613 | 661 |
| 614 // Function: Arity 4 -> 2. | 662 // Function: Arity 4 -> 2. |
| 615 template <typename StorageType, typename R,typename X1, typename X2, | 663 template <typename StorageType, typename R,typename X1, typename X2, |
| 616 typename X3, typename X4> | 664 typename X3, typename X4> |
| 617 struct Invoker2<StorageType, R(*)(X1, X2, X3, X4)> { | 665 struct Invoker2<StorageType, R(*)(X1, X2, X3, X4)> { |
| 618 COMPILE_ASSERT( | 666 static R DoInvoke(InvokerStorageBase* base, |
| 619 !( is_non_const_reference<X1>::value || | 667 typename internal::ParamTraits<X3>::ForwardType x3, |
| 620 is_non_const_reference<X2>::value || | 668 typename internal::ParamTraits<X4>::ForwardType x4) { |
| 621 is_non_const_reference<X3>::value || | |
| 622 is_non_const_reference<X4>::value ), | |
| 623 do_not_bind_functions_with_nonconst_ref); | |
| 624 | |
| 625 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4) { | |
| 626 StorageType* invoker = static_cast<StorageType*>(base); | 669 StorageType* invoker = static_cast<StorageType*>(base); |
| 627 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4); | 670 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4); |
| 628 } | 671 } |
| 629 }; | 672 }; |
| 630 | 673 |
| 631 // Method: Arity 3 -> 2. | 674 // Method: Arity 3 -> 2. |
| 632 template <typename StorageType, typename R, typename T, typename X1, | 675 template <typename StorageType, typename R, typename T, typename X1, |
| 633 typename X2, typename X3> | 676 typename X2, typename X3> |
| 634 struct Invoker2<StorageType, R(T::*)(X1, X2, X3)> { | 677 struct Invoker2<StorageType, R(T::*)(X1, X2, X3)> { |
| 635 COMPILE_ASSERT( | 678 static R DoInvoke(InvokerStorageBase* base, |
| 636 !( is_non_const_reference<X1>::value || | 679 typename internal::ParamTraits<X2>::ForwardType x2, |
| 637 is_non_const_reference<X2>::value || | 680 typename internal::ParamTraits<X3>::ForwardType x3) { |
| 638 is_non_const_reference<X3>::value ), | |
| 639 do_not_bind_functions_with_nonconst_ref); | |
| 640 | |
| 641 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3) { | |
| 642 StorageType* invoker = static_cast<StorageType*>(base); | 681 StorageType* invoker = static_cast<StorageType*>(base); |
| 643 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3); | 682 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3); |
| 644 } | 683 } |
| 645 }; | 684 }; |
| 646 | 685 |
| 647 // Function: Arity 5 -> 3. | 686 // Function: Arity 5 -> 3. |
| 648 template <typename StorageType, typename R,typename X1, typename X2, | 687 template <typename StorageType, typename R,typename X1, typename X2, |
| 649 typename X3, typename X4, typename X5> | 688 typename X3, typename X4, typename X5> |
| 650 struct Invoker2<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 689 struct Invoker2<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 651 COMPILE_ASSERT( | 690 static R DoInvoke(InvokerStorageBase* base, |
| 652 !( is_non_const_reference<X1>::value || | 691 typename internal::ParamTraits<X3>::ForwardType x3, |
| 653 is_non_const_reference<X2>::value || | 692 typename internal::ParamTraits<X4>::ForwardType x4, |
| 654 is_non_const_reference<X3>::value || | 693 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 655 is_non_const_reference<X4>::value || | |
| 656 is_non_const_reference<X5>::value ), | |
| 657 do_not_bind_functions_with_nonconst_ref); | |
| 658 | |
| 659 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, | |
| 660 const X5& x5) { | |
| 661 StorageType* invoker = static_cast<StorageType*>(base); | 694 StorageType* invoker = static_cast<StorageType*>(base); |
| 662 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4, x5); | 695 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4, x5); |
| 663 } | 696 } |
| 664 }; | 697 }; |
| 665 | 698 |
| 666 // Method: Arity 4 -> 3. | 699 // Method: Arity 4 -> 3. |
| 667 template <typename StorageType, typename R, typename T, typename X1, | 700 template <typename StorageType, typename R, typename T, typename X1, |
| 668 typename X2, typename X3, typename X4> | 701 typename X2, typename X3, typename X4> |
| 669 struct Invoker2<StorageType, R(T::*)(X1, X2, X3, X4)> { | 702 struct Invoker2<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 670 COMPILE_ASSERT( | 703 static R DoInvoke(InvokerStorageBase* base, |
| 671 !( is_non_const_reference<X1>::value || | 704 typename internal::ParamTraits<X2>::ForwardType x2, |
| 672 is_non_const_reference<X2>::value || | 705 typename internal::ParamTraits<X3>::ForwardType x3, |
| 673 is_non_const_reference<X3>::value || | 706 typename internal::ParamTraits<X4>::ForwardType x4) { |
| 674 is_non_const_reference<X4>::value ), | |
| 675 do_not_bind_functions_with_nonconst_ref); | |
| 676 | |
| 677 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | |
| 678 const X4& x4) { | |
| 679 StorageType* invoker = static_cast<StorageType*>(base); | 707 StorageType* invoker = static_cast<StorageType*>(base); |
| 680 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, | 708 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, |
| 681 x4); | 709 x4); |
| 682 } | 710 } |
| 683 }; | 711 }; |
| 684 | 712 |
| 685 // Function: Arity 6 -> 4. | 713 // Function: Arity 6 -> 4. |
| 686 template <typename StorageType, typename R,typename X1, typename X2, | 714 template <typename StorageType, typename R,typename X1, typename X2, |
| 687 typename X3, typename X4, typename X5, typename X6> | 715 typename X3, typename X4, typename X5, typename X6> |
| 688 struct Invoker2<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 716 struct Invoker2<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 689 COMPILE_ASSERT( | 717 static R DoInvoke(InvokerStorageBase* base, |
| 690 !( is_non_const_reference<X1>::value || | 718 typename internal::ParamTraits<X3>::ForwardType x3, |
| 691 is_non_const_reference<X2>::value || | 719 typename internal::ParamTraits<X4>::ForwardType x4, |
| 692 is_non_const_reference<X3>::value || | 720 typename internal::ParamTraits<X5>::ForwardType x5, |
| 693 is_non_const_reference<X4>::value || | 721 typename internal::ParamTraits<X6>::ForwardType x6) { |
| 694 is_non_const_reference<X5>::value || | |
| 695 is_non_const_reference<X6>::value ), | |
| 696 do_not_bind_functions_with_nonconst_ref); | |
| 697 | |
| 698 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, | |
| 699 const X5& x5, const X6& x6) { | |
| 700 StorageType* invoker = static_cast<StorageType*>(base); | 722 StorageType* invoker = static_cast<StorageType*>(base); |
| 701 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4, x5, | 723 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), x3, x4, x5, |
| 702 x6); | 724 x6); |
| 703 } | 725 } |
| 704 }; | 726 }; |
| 705 | 727 |
| 706 // Method: Arity 5 -> 4. | 728 // Method: Arity 5 -> 4. |
| 707 template <typename StorageType, typename R, typename T, typename X1, | 729 template <typename StorageType, typename R, typename T, typename X1, |
| 708 typename X2, typename X3, typename X4, typename X5> | 730 typename X2, typename X3, typename X4, typename X5> |
| 709 struct Invoker2<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 731 struct Invoker2<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 710 COMPILE_ASSERT( | 732 static R DoInvoke(InvokerStorageBase* base, |
| 711 !( is_non_const_reference<X1>::value || | 733 typename internal::ParamTraits<X2>::ForwardType x2, |
| 712 is_non_const_reference<X2>::value || | 734 typename internal::ParamTraits<X3>::ForwardType x3, |
| 713 is_non_const_reference<X3>::value || | 735 typename internal::ParamTraits<X4>::ForwardType x4, |
| 714 is_non_const_reference<X4>::value || | 736 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 715 is_non_const_reference<X5>::value ), | |
| 716 do_not_bind_functions_with_nonconst_ref); | |
| 717 | |
| 718 static R DoInvoke(InvokerStorageBase* base, const X2& x2, const X3& x3, | |
| 719 const X4& x4, const X5& x5) { | |
| 720 StorageType* invoker = static_cast<StorageType*>(base); | 737 StorageType* invoker = static_cast<StorageType*>(base); |
| 721 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, | 738 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), x2, x3, |
| 722 x4, x5); | 739 x4, x5); |
| 723 } | 740 } |
| 724 }; | 741 }; |
| 725 | 742 |
| 726 template <typename StorageType, typename NormalizedSig> | 743 template <typename StorageType, typename NormalizedSig> |
| 727 struct Invoker3; | 744 struct Invoker3; |
| 728 | 745 |
| 729 // Function: Arity 3 -> 0. | 746 // Function: Arity 3 -> 0. |
| 730 template <typename StorageType, typename R,typename X1, typename X2, | 747 template <typename StorageType, typename R,typename X1, typename X2, |
| 731 typename X3> | 748 typename X3> |
| 732 struct Invoker3<StorageType, R(*)(X1, X2, X3)> { | 749 struct Invoker3<StorageType, R(*)(X1, X2, X3)> { |
| 733 COMPILE_ASSERT( | |
| 734 !( is_non_const_reference<X1>::value || | |
| 735 is_non_const_reference<X2>::value || | |
| 736 is_non_const_reference<X3>::value ), | |
| 737 do_not_bind_functions_with_nonconst_ref); | |
| 738 | |
| 739 static R DoInvoke(InvokerStorageBase* base) { | 750 static R DoInvoke(InvokerStorageBase* base) { |
| 740 StorageType* invoker = static_cast<StorageType*>(base); | 751 StorageType* invoker = static_cast<StorageType*>(base); |
| 741 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 752 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 742 Unwrap(invoker->p3_)); | 753 Unwrap(invoker->p3_)); |
| 743 } | 754 } |
| 744 }; | 755 }; |
| 745 | 756 |
| 746 // Method: Arity 2 -> 0. | 757 // Method: Arity 2 -> 0. |
| 747 template <typename StorageType, typename R, typename T, typename X1, | 758 template <typename StorageType, typename R, typename T, typename X1, |
| 748 typename X2> | 759 typename X2> |
| 749 struct Invoker3<StorageType, R(T::*)(X1, X2)> { | 760 struct Invoker3<StorageType, R(T::*)(X1, X2)> { |
| 750 COMPILE_ASSERT( | |
| 751 !( is_non_const_reference<X1>::value || | |
| 752 is_non_const_reference<X2>::value ), | |
| 753 do_not_bind_functions_with_nonconst_ref); | |
| 754 | |
| 755 static R DoInvoke(InvokerStorageBase* base) { | 761 static R DoInvoke(InvokerStorageBase* base) { |
| 756 StorageType* invoker = static_cast<StorageType*>(base); | 762 StorageType* invoker = static_cast<StorageType*>(base); |
| 757 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 763 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 758 Unwrap(invoker->p3_)); | 764 Unwrap(invoker->p3_)); |
| 759 } | 765 } |
| 760 }; | 766 }; |
| 761 | 767 |
| 762 // Function: Arity 4 -> 1. | 768 // Function: Arity 4 -> 1. |
| 763 template <typename StorageType, typename R,typename X1, typename X2, | 769 template <typename StorageType, typename R,typename X1, typename X2, |
| 764 typename X3, typename X4> | 770 typename X3, typename X4> |
| 765 struct Invoker3<StorageType, R(*)(X1, X2, X3, X4)> { | 771 struct Invoker3<StorageType, R(*)(X1, X2, X3, X4)> { |
| 766 COMPILE_ASSERT( | 772 static R DoInvoke(InvokerStorageBase* base, |
| 767 !( is_non_const_reference<X1>::value || | 773 typename internal::ParamTraits<X4>::ForwardType x4) { |
| 768 is_non_const_reference<X2>::value || | |
| 769 is_non_const_reference<X3>::value || | |
| 770 is_non_const_reference<X4>::value ), | |
| 771 do_not_bind_functions_with_nonconst_ref); | |
| 772 | |
| 773 static R DoInvoke(InvokerStorageBase* base, const X4& x4) { | |
| 774 StorageType* invoker = static_cast<StorageType*>(base); | 774 StorageType* invoker = static_cast<StorageType*>(base); |
| 775 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 775 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 776 Unwrap(invoker->p3_), x4); | 776 Unwrap(invoker->p3_), x4); |
| 777 } | 777 } |
| 778 }; | 778 }; |
| 779 | 779 |
| 780 // Method: Arity 3 -> 1. | 780 // Method: Arity 3 -> 1. |
| 781 template <typename StorageType, typename R, typename T, typename X1, | 781 template <typename StorageType, typename R, typename T, typename X1, |
| 782 typename X2, typename X3> | 782 typename X2, typename X3> |
| 783 struct Invoker3<StorageType, R(T::*)(X1, X2, X3)> { | 783 struct Invoker3<StorageType, R(T::*)(X1, X2, X3)> { |
| 784 COMPILE_ASSERT( | 784 static R DoInvoke(InvokerStorageBase* base, |
| 785 !( is_non_const_reference<X1>::value || | 785 typename internal::ParamTraits<X3>::ForwardType x3) { |
| 786 is_non_const_reference<X2>::value || | |
| 787 is_non_const_reference<X3>::value ), | |
| 788 do_not_bind_functions_with_nonconst_ref); | |
| 789 | |
| 790 static R DoInvoke(InvokerStorageBase* base, const X3& x3) { | |
| 791 StorageType* invoker = static_cast<StorageType*>(base); | 786 StorageType* invoker = static_cast<StorageType*>(base); |
| 792 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 787 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 793 Unwrap(invoker->p3_), x3); | 788 Unwrap(invoker->p3_), x3); |
| 794 } | 789 } |
| 795 }; | 790 }; |
| 796 | 791 |
| 797 // Function: Arity 5 -> 2. | 792 // Function: Arity 5 -> 2. |
| 798 template <typename StorageType, typename R,typename X1, typename X2, | 793 template <typename StorageType, typename R,typename X1, typename X2, |
| 799 typename X3, typename X4, typename X5> | 794 typename X3, typename X4, typename X5> |
| 800 struct Invoker3<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 795 struct Invoker3<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 801 COMPILE_ASSERT( | 796 static R DoInvoke(InvokerStorageBase* base, |
| 802 !( is_non_const_reference<X1>::value || | 797 typename internal::ParamTraits<X4>::ForwardType x4, |
| 803 is_non_const_reference<X2>::value || | 798 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 804 is_non_const_reference<X3>::value || | |
| 805 is_non_const_reference<X4>::value || | |
| 806 is_non_const_reference<X5>::value ), | |
| 807 do_not_bind_functions_with_nonconst_ref); | |
| 808 | |
| 809 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5) { | |
| 810 StorageType* invoker = static_cast<StorageType*>(base); | 799 StorageType* invoker = static_cast<StorageType*>(base); |
| 811 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 800 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 812 Unwrap(invoker->p3_), x4, x5); | 801 Unwrap(invoker->p3_), x4, x5); |
| 813 } | 802 } |
| 814 }; | 803 }; |
| 815 | 804 |
| 816 // Method: Arity 4 -> 2. | 805 // Method: Arity 4 -> 2. |
| 817 template <typename StorageType, typename R, typename T, typename X1, | 806 template <typename StorageType, typename R, typename T, typename X1, |
| 818 typename X2, typename X3, typename X4> | 807 typename X2, typename X3, typename X4> |
| 819 struct Invoker3<StorageType, R(T::*)(X1, X2, X3, X4)> { | 808 struct Invoker3<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 820 COMPILE_ASSERT( | 809 static R DoInvoke(InvokerStorageBase* base, |
| 821 !( is_non_const_reference<X1>::value || | 810 typename internal::ParamTraits<X3>::ForwardType x3, |
| 822 is_non_const_reference<X2>::value || | 811 typename internal::ParamTraits<X4>::ForwardType x4) { |
| 823 is_non_const_reference<X3>::value || | |
| 824 is_non_const_reference<X4>::value ), | |
| 825 do_not_bind_functions_with_nonconst_ref); | |
| 826 | |
| 827 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4) { | |
| 828 StorageType* invoker = static_cast<StorageType*>(base); | 812 StorageType* invoker = static_cast<StorageType*>(base); |
| 829 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 813 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 830 Unwrap(invoker->p3_), x3, x4); | 814 Unwrap(invoker->p3_), x3, x4); |
| 831 } | 815 } |
| 832 }; | 816 }; |
| 833 | 817 |
| 834 // Function: Arity 6 -> 3. | 818 // Function: Arity 6 -> 3. |
| 835 template <typename StorageType, typename R,typename X1, typename X2, | 819 template <typename StorageType, typename R,typename X1, typename X2, |
| 836 typename X3, typename X4, typename X5, typename X6> | 820 typename X3, typename X4, typename X5, typename X6> |
| 837 struct Invoker3<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 821 struct Invoker3<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 838 COMPILE_ASSERT( | 822 static R DoInvoke(InvokerStorageBase* base, |
| 839 !( is_non_const_reference<X1>::value || | 823 typename internal::ParamTraits<X4>::ForwardType x4, |
| 840 is_non_const_reference<X2>::value || | 824 typename internal::ParamTraits<X5>::ForwardType x5, |
| 841 is_non_const_reference<X3>::value || | 825 typename internal::ParamTraits<X6>::ForwardType x6) { |
| 842 is_non_const_reference<X4>::value || | |
| 843 is_non_const_reference<X5>::value || | |
| 844 is_non_const_reference<X6>::value ), | |
| 845 do_not_bind_functions_with_nonconst_ref); | |
| 846 | |
| 847 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5, | |
| 848 const X6& x6) { | |
| 849 StorageType* invoker = static_cast<StorageType*>(base); | 826 StorageType* invoker = static_cast<StorageType*>(base); |
| 850 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 827 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 851 Unwrap(invoker->p3_), x4, x5, x6); | 828 Unwrap(invoker->p3_), x4, x5, x6); |
| 852 } | 829 } |
| 853 }; | 830 }; |
| 854 | 831 |
| 855 // Method: Arity 5 -> 3. | 832 // Method: Arity 5 -> 3. |
| 856 template <typename StorageType, typename R, typename T, typename X1, | 833 template <typename StorageType, typename R, typename T, typename X1, |
| 857 typename X2, typename X3, typename X4, typename X5> | 834 typename X2, typename X3, typename X4, typename X5> |
| 858 struct Invoker3<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 835 struct Invoker3<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 859 COMPILE_ASSERT( | 836 static R DoInvoke(InvokerStorageBase* base, |
| 860 !( is_non_const_reference<X1>::value || | 837 typename internal::ParamTraits<X3>::ForwardType x3, |
| 861 is_non_const_reference<X2>::value || | 838 typename internal::ParamTraits<X4>::ForwardType x4, |
| 862 is_non_const_reference<X3>::value || | 839 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 863 is_non_const_reference<X4>::value || | |
| 864 is_non_const_reference<X5>::value ), | |
| 865 do_not_bind_functions_with_nonconst_ref); | |
| 866 | |
| 867 static R DoInvoke(InvokerStorageBase* base, const X3& x3, const X4& x4, | |
| 868 const X5& x5) { | |
| 869 StorageType* invoker = static_cast<StorageType*>(base); | 840 StorageType* invoker = static_cast<StorageType*>(base); |
| 870 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 841 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 871 Unwrap(invoker->p3_), x3, x4, x5); | 842 Unwrap(invoker->p3_), x3, x4, x5); |
| 872 } | 843 } |
| 873 }; | 844 }; |
| 874 | 845 |
| 875 template <typename StorageType, typename NormalizedSig> | 846 template <typename StorageType, typename NormalizedSig> |
| 876 struct Invoker4; | 847 struct Invoker4; |
| 877 | 848 |
| 878 // Function: Arity 4 -> 0. | 849 // Function: Arity 4 -> 0. |
| 879 template <typename StorageType, typename R,typename X1, typename X2, | 850 template <typename StorageType, typename R,typename X1, typename X2, |
| 880 typename X3, typename X4> | 851 typename X3, typename X4> |
| 881 struct Invoker4<StorageType, R(*)(X1, X2, X3, X4)> { | 852 struct Invoker4<StorageType, R(*)(X1, X2, X3, X4)> { |
| 882 COMPILE_ASSERT( | |
| 883 !( is_non_const_reference<X1>::value || | |
| 884 is_non_const_reference<X2>::value || | |
| 885 is_non_const_reference<X3>::value || | |
| 886 is_non_const_reference<X4>::value ), | |
| 887 do_not_bind_functions_with_nonconst_ref); | |
| 888 | |
| 889 static R DoInvoke(InvokerStorageBase* base) { | 853 static R DoInvoke(InvokerStorageBase* base) { |
| 890 StorageType* invoker = static_cast<StorageType*>(base); | 854 StorageType* invoker = static_cast<StorageType*>(base); |
| 891 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 855 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 892 Unwrap(invoker->p3_), Unwrap(invoker->p4_)); | 856 Unwrap(invoker->p3_), Unwrap(invoker->p4_)); |
| 893 } | 857 } |
| 894 }; | 858 }; |
| 895 | 859 |
| 896 // Method: Arity 3 -> 0. | 860 // Method: Arity 3 -> 0. |
| 897 template <typename StorageType, typename R, typename T, typename X1, | 861 template <typename StorageType, typename R, typename T, typename X1, |
| 898 typename X2, typename X3> | 862 typename X2, typename X3> |
| 899 struct Invoker4<StorageType, R(T::*)(X1, X2, X3)> { | 863 struct Invoker4<StorageType, R(T::*)(X1, X2, X3)> { |
| 900 COMPILE_ASSERT( | |
| 901 !( is_non_const_reference<X1>::value || | |
| 902 is_non_const_reference<X2>::value || | |
| 903 is_non_const_reference<X3>::value ), | |
| 904 do_not_bind_functions_with_nonconst_ref); | |
| 905 | |
| 906 static R DoInvoke(InvokerStorageBase* base) { | 864 static R DoInvoke(InvokerStorageBase* base) { |
| 907 StorageType* invoker = static_cast<StorageType*>(base); | 865 StorageType* invoker = static_cast<StorageType*>(base); |
| 908 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 866 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 909 Unwrap(invoker->p3_), Unwrap(invoker->p4_)); | 867 Unwrap(invoker->p3_), Unwrap(invoker->p4_)); |
| 910 } | 868 } |
| 911 }; | 869 }; |
| 912 | 870 |
| 913 // Function: Arity 5 -> 1. | 871 // Function: Arity 5 -> 1. |
| 914 template <typename StorageType, typename R,typename X1, typename X2, | 872 template <typename StorageType, typename R,typename X1, typename X2, |
| 915 typename X3, typename X4, typename X5> | 873 typename X3, typename X4, typename X5> |
| 916 struct Invoker4<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 874 struct Invoker4<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 917 COMPILE_ASSERT( | 875 static R DoInvoke(InvokerStorageBase* base, |
| 918 !( is_non_const_reference<X1>::value || | 876 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 919 is_non_const_reference<X2>::value || | |
| 920 is_non_const_reference<X3>::value || | |
| 921 is_non_const_reference<X4>::value || | |
| 922 is_non_const_reference<X5>::value ), | |
| 923 do_not_bind_functions_with_nonconst_ref); | |
| 924 | |
| 925 static R DoInvoke(InvokerStorageBase* base, const X5& x5) { | |
| 926 StorageType* invoker = static_cast<StorageType*>(base); | 877 StorageType* invoker = static_cast<StorageType*>(base); |
| 927 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 878 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 928 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x5); | 879 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x5); |
| 929 } | 880 } |
| 930 }; | 881 }; |
| 931 | 882 |
| 932 // Method: Arity 4 -> 1. | 883 // Method: Arity 4 -> 1. |
| 933 template <typename StorageType, typename R, typename T, typename X1, | 884 template <typename StorageType, typename R, typename T, typename X1, |
| 934 typename X2, typename X3, typename X4> | 885 typename X2, typename X3, typename X4> |
| 935 struct Invoker4<StorageType, R(T::*)(X1, X2, X3, X4)> { | 886 struct Invoker4<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 936 COMPILE_ASSERT( | 887 static R DoInvoke(InvokerStorageBase* base, |
| 937 !( is_non_const_reference<X1>::value || | 888 typename internal::ParamTraits<X4>::ForwardType x4) { |
| 938 is_non_const_reference<X2>::value || | |
| 939 is_non_const_reference<X3>::value || | |
| 940 is_non_const_reference<X4>::value ), | |
| 941 do_not_bind_functions_with_nonconst_ref); | |
| 942 | |
| 943 static R DoInvoke(InvokerStorageBase* base, const X4& x4) { | |
| 944 StorageType* invoker = static_cast<StorageType*>(base); | 889 StorageType* invoker = static_cast<StorageType*>(base); |
| 945 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 890 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 946 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4); | 891 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4); |
| 947 } | 892 } |
| 948 }; | 893 }; |
| 949 | 894 |
| 950 // Function: Arity 6 -> 2. | 895 // Function: Arity 6 -> 2. |
| 951 template <typename StorageType, typename R,typename X1, typename X2, | 896 template <typename StorageType, typename R,typename X1, typename X2, |
| 952 typename X3, typename X4, typename X5, typename X6> | 897 typename X3, typename X4, typename X5, typename X6> |
| 953 struct Invoker4<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 898 struct Invoker4<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 954 COMPILE_ASSERT( | 899 static R DoInvoke(InvokerStorageBase* base, |
| 955 !( is_non_const_reference<X1>::value || | 900 typename internal::ParamTraits<X5>::ForwardType x5, |
| 956 is_non_const_reference<X2>::value || | 901 typename internal::ParamTraits<X6>::ForwardType x6) { |
| 957 is_non_const_reference<X3>::value || | |
| 958 is_non_const_reference<X4>::value || | |
| 959 is_non_const_reference<X5>::value || | |
| 960 is_non_const_reference<X6>::value ), | |
| 961 do_not_bind_functions_with_nonconst_ref); | |
| 962 | |
| 963 static R DoInvoke(InvokerStorageBase* base, const X5& x5, const X6& x6) { | |
| 964 StorageType* invoker = static_cast<StorageType*>(base); | 902 StorageType* invoker = static_cast<StorageType*>(base); |
| 965 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 903 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 966 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x5, x6); | 904 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x5, x6); |
| 967 } | 905 } |
| 968 }; | 906 }; |
| 969 | 907 |
| 970 // Method: Arity 5 -> 2. | 908 // Method: Arity 5 -> 2. |
| 971 template <typename StorageType, typename R, typename T, typename X1, | 909 template <typename StorageType, typename R, typename T, typename X1, |
| 972 typename X2, typename X3, typename X4, typename X5> | 910 typename X2, typename X3, typename X4, typename X5> |
| 973 struct Invoker4<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 911 struct Invoker4<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 974 COMPILE_ASSERT( | 912 static R DoInvoke(InvokerStorageBase* base, |
| 975 !( is_non_const_reference<X1>::value || | 913 typename internal::ParamTraits<X4>::ForwardType x4, |
| 976 is_non_const_reference<X2>::value || | 914 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 977 is_non_const_reference<X3>::value || | |
| 978 is_non_const_reference<X4>::value || | |
| 979 is_non_const_reference<X5>::value ), | |
| 980 do_not_bind_functions_with_nonconst_ref); | |
| 981 | |
| 982 static R DoInvoke(InvokerStorageBase* base, const X4& x4, const X5& x5) { | |
| 983 StorageType* invoker = static_cast<StorageType*>(base); | 915 StorageType* invoker = static_cast<StorageType*>(base); |
| 984 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 916 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 985 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4, x5); | 917 Unwrap(invoker->p3_), Unwrap(invoker->p4_), x4, x5); |
| 986 } | 918 } |
| 987 }; | 919 }; |
| 988 | 920 |
| 989 template <typename StorageType, typename NormalizedSig> | 921 template <typename StorageType, typename NormalizedSig> |
| 990 struct Invoker5; | 922 struct Invoker5; |
| 991 | 923 |
| 992 // Function: Arity 5 -> 0. | 924 // Function: Arity 5 -> 0. |
| 993 template <typename StorageType, typename R,typename X1, typename X2, | 925 template <typename StorageType, typename R,typename X1, typename X2, |
| 994 typename X3, typename X4, typename X5> | 926 typename X3, typename X4, typename X5> |
| 995 struct Invoker5<StorageType, R(*)(X1, X2, X3, X4, X5)> { | 927 struct Invoker5<StorageType, R(*)(X1, X2, X3, X4, X5)> { |
| 996 COMPILE_ASSERT( | |
| 997 !( is_non_const_reference<X1>::value || | |
| 998 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 static R DoInvoke(InvokerStorageBase* base) { | 928 static R DoInvoke(InvokerStorageBase* base) { |
| 1005 StorageType* invoker = static_cast<StorageType*>(base); | 929 StorageType* invoker = static_cast<StorageType*>(base); |
| 1006 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 930 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 1007 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_)); | 931 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_)); |
| 1008 } | 932 } |
| 1009 }; | 933 }; |
| 1010 | 934 |
| 1011 // Method: Arity 4 -> 0. | 935 // Method: Arity 4 -> 0. |
| 1012 template <typename StorageType, typename R, typename T, typename X1, | 936 template <typename StorageType, typename R, typename T, typename X1, |
| 1013 typename X2, typename X3, typename X4> | 937 typename X2, typename X3, typename X4> |
| 1014 struct Invoker5<StorageType, R(T::*)(X1, X2, X3, X4)> { | 938 struct Invoker5<StorageType, R(T::*)(X1, X2, X3, X4)> { |
| 1015 COMPILE_ASSERT( | |
| 1016 !( is_non_const_reference<X1>::value || | |
| 1017 is_non_const_reference<X2>::value || | |
| 1018 is_non_const_reference<X3>::value || | |
| 1019 is_non_const_reference<X4>::value ), | |
| 1020 do_not_bind_functions_with_nonconst_ref); | |
| 1021 | |
| 1022 static R DoInvoke(InvokerStorageBase* base) { | 939 static R DoInvoke(InvokerStorageBase* base) { |
| 1023 StorageType* invoker = static_cast<StorageType*>(base); | 940 StorageType* invoker = static_cast<StorageType*>(base); |
| 1024 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 941 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 1025 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_)); | 942 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_)); |
| 1026 } | 943 } |
| 1027 }; | 944 }; |
| 1028 | 945 |
| 1029 // Function: Arity 6 -> 1. | 946 // Function: Arity 6 -> 1. |
| 1030 template <typename StorageType, typename R,typename X1, typename X2, | 947 template <typename StorageType, typename R,typename X1, typename X2, |
| 1031 typename X3, typename X4, typename X5, typename X6> | 948 typename X3, typename X4, typename X5, typename X6> |
| 1032 struct Invoker5<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 949 struct Invoker5<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 1033 COMPILE_ASSERT( | 950 static R DoInvoke(InvokerStorageBase* base, |
| 1034 !( is_non_const_reference<X1>::value || | 951 typename internal::ParamTraits<X6>::ForwardType x6) { |
| 1035 is_non_const_reference<X2>::value || | |
| 1036 is_non_const_reference<X3>::value || | |
| 1037 is_non_const_reference<X4>::value || | |
| 1038 is_non_const_reference<X5>::value || | |
| 1039 is_non_const_reference<X6>::value ), | |
| 1040 do_not_bind_functions_with_nonconst_ref); | |
| 1041 | |
| 1042 static R DoInvoke(InvokerStorageBase* base, const X6& x6) { | |
| 1043 StorageType* invoker = static_cast<StorageType*>(base); | 952 StorageType* invoker = static_cast<StorageType*>(base); |
| 1044 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 953 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 1045 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), x6); | 954 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), x6); |
| 1046 } | 955 } |
| 1047 }; | 956 }; |
| 1048 | 957 |
| 1049 // Method: Arity 5 -> 1. | 958 // Method: Arity 5 -> 1. |
| 1050 template <typename StorageType, typename R, typename T, typename X1, | 959 template <typename StorageType, typename R, typename T, typename X1, |
| 1051 typename X2, typename X3, typename X4, typename X5> | 960 typename X2, typename X3, typename X4, typename X5> |
| 1052 struct Invoker5<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 961 struct Invoker5<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 1053 COMPILE_ASSERT( | 962 static R DoInvoke(InvokerStorageBase* base, |
| 1054 !( is_non_const_reference<X1>::value || | 963 typename internal::ParamTraits<X5>::ForwardType x5) { |
| 1055 is_non_const_reference<X2>::value || | |
| 1056 is_non_const_reference<X3>::value || | |
| 1057 is_non_const_reference<X4>::value || | |
| 1058 is_non_const_reference<X5>::value ), | |
| 1059 do_not_bind_functions_with_nonconst_ref); | |
| 1060 | |
| 1061 static R DoInvoke(InvokerStorageBase* base, const X5& x5) { | |
| 1062 StorageType* invoker = static_cast<StorageType*>(base); | 964 StorageType* invoker = static_cast<StorageType*>(base); |
| 1063 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 965 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 1064 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), x5); | 966 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), x5); |
| 1065 } | 967 } |
| 1066 }; | 968 }; |
| 1067 | 969 |
| 1068 template <typename StorageType, typename NormalizedSig> | 970 template <typename StorageType, typename NormalizedSig> |
| 1069 struct Invoker6; | 971 struct Invoker6; |
| 1070 | 972 |
| 1071 // Function: Arity 6 -> 0. | 973 // Function: Arity 6 -> 0. |
| 1072 template <typename StorageType, typename R,typename X1, typename X2, | 974 template <typename StorageType, typename R,typename X1, typename X2, |
| 1073 typename X3, typename X4, typename X5, typename X6> | 975 typename X3, typename X4, typename X5, typename X6> |
| 1074 struct Invoker6<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { | 976 struct Invoker6<StorageType, R(*)(X1, X2, X3, X4, X5, X6)> { |
| 1075 COMPILE_ASSERT( | |
| 1076 !( is_non_const_reference<X1>::value || | |
| 1077 is_non_const_reference<X2>::value || | |
| 1078 is_non_const_reference<X3>::value || | |
| 1079 is_non_const_reference<X4>::value || | |
| 1080 is_non_const_reference<X5>::value || | |
| 1081 is_non_const_reference<X6>::value ), | |
| 1082 do_not_bind_functions_with_nonconst_ref); | |
| 1083 | |
| 1084 static R DoInvoke(InvokerStorageBase* base) { | 977 static R DoInvoke(InvokerStorageBase* base) { |
| 1085 StorageType* invoker = static_cast<StorageType*>(base); | 978 StorageType* invoker = static_cast<StorageType*>(base); |
| 1086 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), | 979 return invoker->f_(Unwrap(invoker->p1_), Unwrap(invoker->p2_), |
| 1087 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), | 980 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), |
| 1088 Unwrap(invoker->p6_)); | 981 Unwrap(invoker->p6_)); |
| 1089 } | 982 } |
| 1090 }; | 983 }; |
| 1091 | 984 |
| 1092 // Method: Arity 5 -> 0. | 985 // Method: Arity 5 -> 0. |
| 1093 template <typename StorageType, typename R, typename T, typename X1, | 986 template <typename StorageType, typename R, typename T, typename X1, |
| 1094 typename X2, typename X3, typename X4, typename X5> | 987 typename X2, typename X3, typename X4, typename X5> |
| 1095 struct Invoker6<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { | 988 struct Invoker6<StorageType, R(T::*)(X1, X2, X3, X4, X5)> { |
| 1096 COMPILE_ASSERT( | |
| 1097 !( is_non_const_reference<X1>::value || | |
| 1098 is_non_const_reference<X2>::value || | |
| 1099 is_non_const_reference<X3>::value || | |
| 1100 is_non_const_reference<X4>::value || | |
| 1101 is_non_const_reference<X5>::value ), | |
| 1102 do_not_bind_functions_with_nonconst_ref); | |
| 1103 | |
| 1104 static R DoInvoke(InvokerStorageBase* base) { | 989 static R DoInvoke(InvokerStorageBase* base) { |
| 1105 StorageType* invoker = static_cast<StorageType*>(base); | 990 StorageType* invoker = static_cast<StorageType*>(base); |
| 1106 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), | 991 return (Unwrap(invoker->p1_)->*invoker->f_)(Unwrap(invoker->p2_), |
| 1107 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), | 992 Unwrap(invoker->p3_), Unwrap(invoker->p4_), Unwrap(invoker->p5_), |
| 1108 Unwrap(invoker->p6_)); | 993 Unwrap(invoker->p6_)); |
| 1109 } | 994 } |
| 1110 }; | 995 }; |
| 1111 | 996 |
| 1112 | 997 |
| 1113 // InvokerStorageN<> | 998 // InvokerStorageN<> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1126 | 1011 |
| 1127 template <typename Sig> | 1012 template <typename Sig> |
| 1128 class InvokerStorage0 : public InvokerStorageBase { | 1013 class InvokerStorage0 : public InvokerStorageBase { |
| 1129 public: | 1014 public: |
| 1130 typedef InvokerStorage0 StorageType; | 1015 typedef InvokerStorage0 StorageType; |
| 1131 typedef FunctionTraits<Sig> TargetTraits; | 1016 typedef FunctionTraits<Sig> TargetTraits; |
| 1132 typedef Invoker0<StorageType, typename TargetTraits::NormalizedSig> Invoker; | 1017 typedef Invoker0<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1133 typedef typename TargetTraits::IsMethod IsMethod; | 1018 typedef typename TargetTraits::IsMethod IsMethod; |
| 1134 | 1019 |
| 1135 | 1020 |
| 1021 |
| 1136 InvokerStorage0(Sig f) | 1022 InvokerStorage0(Sig f) |
| 1137 : f_(f) { | 1023 : f_(f) { |
| 1138 } | 1024 } |
| 1139 | 1025 |
| 1140 virtual ~InvokerStorage0() { } | 1026 virtual ~InvokerStorage0() { } |
| 1141 | 1027 |
| 1142 Sig f_; | 1028 Sig f_; |
| 1143 }; | 1029 }; |
| 1144 | 1030 |
| 1145 template <typename Sig, typename P1> | 1031 template <typename Sig, typename P1> |
| 1146 class InvokerStorage1 : public InvokerStorageBase { | 1032 class InvokerStorage1 : public InvokerStorageBase { |
| 1147 public: | 1033 public: |
| 1148 typedef InvokerStorage1 StorageType; | 1034 typedef InvokerStorage1 StorageType; |
| 1149 typedef FunctionTraits<Sig> TargetTraits; | 1035 typedef FunctionTraits<Sig> TargetTraits; |
| 1150 typedef Invoker1<StorageType, typename TargetTraits::NormalizedSig> Invoker; | 1036 typedef Invoker1<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1151 typedef typename TargetTraits::IsMethod IsMethod; | 1037 typedef typename TargetTraits::IsMethod IsMethod; |
| 1038 |
| 1152 // For methods, we need to be careful for parameter 1. We skip the | 1039 // For methods, we need to be careful for parameter 1. We skip the |
| 1153 // scoped_refptr check because the binder itself takes care of this. We also | 1040 // scoped_refptr check because the binder itself takes care of this. We also |
| 1154 // disallow binding of an array as the method's target object. | 1041 // disallow binding of an array as the method's target object. |
| 1155 COMPILE_ASSERT(IsMethod::value || | 1042 COMPILE_ASSERT(IsMethod::value || |
| 1156 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1043 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1157 p1_is_refcounted_type_and_needs_scoped_refptr); | 1044 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1158 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1045 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1159 first_bound_argument_to_method_cannot_be_array); | 1046 first_bound_argument_to_method_cannot_be_array); |
| 1160 | 1047 |
| 1048 // Do not allow binding a non-const reference parameter. Non-const reference |
| 1049 // parameters are disallowed by the Google style guide. Also, binding a |
| 1050 // non-const reference parameter can make for subtle bugs because the |
| 1051 // invoked function will receive a reference to the stored copy of the |
| 1052 // argument and not the original. |
| 1053 COMPILE_ASSERT( |
| 1054 !( is_non_const_reference<typename TargetTraits::B1>::value ), |
| 1055 do_not_bind_functions_with_nonconst_ref); |
| 1056 |
| 1161 | 1057 |
| 1162 InvokerStorage1(Sig f, const P1& p1) | 1058 InvokerStorage1(Sig f, const P1& p1) |
| 1163 : f_(f), p1_(static_cast<typename BindType<P1>::StorageType>(p1)) { | 1059 : f_(f), p1_(static_cast<typename ParamTraits<P1>::StorageType>(p1)) { |
| 1164 MaybeRefcount<IsMethod, P1>::AddRef(p1_); | 1060 MaybeRefcount<IsMethod, P1>::AddRef(p1_); |
| 1165 } | 1061 } |
| 1166 | 1062 |
| 1167 virtual ~InvokerStorage1() { | 1063 virtual ~InvokerStorage1() { |
| 1168 MaybeRefcount<IsMethod, P1>::Release(p1_); | 1064 MaybeRefcount<IsMethod, P1>::Release(p1_); |
| 1169 } | 1065 } |
| 1170 | 1066 |
| 1171 Sig f_; | 1067 Sig f_; |
| 1172 typename BindType<P1>::StorageType p1_; | 1068 typename ParamTraits<P1>::StorageType p1_; |
| 1173 }; | 1069 }; |
| 1174 | 1070 |
| 1175 template <typename Sig, typename P1, typename P2> | 1071 template <typename Sig, typename P1, typename P2> |
| 1176 class InvokerStorage2 : public InvokerStorageBase { | 1072 class InvokerStorage2 : public InvokerStorageBase { |
| 1177 public: | 1073 public: |
| 1178 typedef InvokerStorage2 StorageType; | 1074 typedef InvokerStorage2 StorageType; |
| 1179 typedef FunctionTraits<Sig> TargetTraits; | 1075 typedef FunctionTraits<Sig> TargetTraits; |
| 1180 typedef Invoker2<StorageType, typename TargetTraits::NormalizedSig> Invoker; | 1076 typedef Invoker2<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1181 typedef typename TargetTraits::IsMethod IsMethod; | 1077 typedef typename TargetTraits::IsMethod IsMethod; |
| 1078 |
| 1182 // For methods, we need to be careful for parameter 1. We skip the | 1079 // For methods, we need to be careful for parameter 1. We skip the |
| 1183 // scoped_refptr check because the binder itself takes care of this. We also | 1080 // scoped_refptr check because the binder itself takes care of this. We also |
| 1184 // disallow binding of an array as the method's target object. | 1081 // disallow binding of an array as the method's target object. |
| 1185 COMPILE_ASSERT(IsMethod::value || | 1082 COMPILE_ASSERT(IsMethod::value || |
| 1186 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1083 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1187 p1_is_refcounted_type_and_needs_scoped_refptr); | 1084 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1188 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1085 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1189 first_bound_argument_to_method_cannot_be_array); | 1086 first_bound_argument_to_method_cannot_be_array); |
| 1190 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1087 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1191 p2_is_refcounted_type_and_needs_scoped_refptr); | 1088 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 1192 | 1089 |
| 1090 // Do not allow binding a non-const reference parameter. Non-const reference |
| 1091 // parameters are disallowed by the Google style guide. Also, binding a |
| 1092 // non-const reference parameter can make for subtle bugs because the |
| 1093 // invoked function will receive a reference to the stored copy of the |
| 1094 // argument and not the original. |
| 1095 COMPILE_ASSERT( |
| 1096 !( is_non_const_reference<typename TargetTraits::B1>::value || |
| 1097 is_non_const_reference<typename TargetTraits::B2>::value ), |
| 1098 do_not_bind_functions_with_nonconst_ref); |
| 1099 |
| 1193 | 1100 |
| 1194 InvokerStorage2(Sig f, const P1& p1, const P2& p2) | 1101 InvokerStorage2(Sig f, const P1& p1, const P2& p2) |
| 1195 : f_(f), p1_(static_cast<typename BindType<P1>::StorageType>(p1)), | 1102 : f_(f), p1_(static_cast<typename ParamTraits<P1>::StorageType>(p1)), |
| 1196 p2_(static_cast<typename BindType<P2>::StorageType>(p2)) { | 1103 p2_(static_cast<typename ParamTraits<P2>::StorageType>(p2)) { |
| 1197 MaybeRefcount<IsMethod, P1>::AddRef(p1_); | 1104 MaybeRefcount<IsMethod, P1>::AddRef(p1_); |
| 1198 } | 1105 } |
| 1199 | 1106 |
| 1200 virtual ~InvokerStorage2() { | 1107 virtual ~InvokerStorage2() { |
| 1201 MaybeRefcount<IsMethod, P1>::Release(p1_); | 1108 MaybeRefcount<IsMethod, P1>::Release(p1_); |
| 1202 } | 1109 } |
| 1203 | 1110 |
| 1204 Sig f_; | 1111 Sig f_; |
| 1205 typename BindType<P1>::StorageType p1_; | 1112 typename ParamTraits<P1>::StorageType p1_; |
| 1206 typename BindType<P2>::StorageType p2_; | 1113 typename ParamTraits<P2>::StorageType p2_; |
| 1207 }; | 1114 }; |
| 1208 | 1115 |
| 1209 template <typename Sig, typename P1, typename P2, typename P3> | 1116 template <typename Sig, typename P1, typename P2, typename P3> |
| 1210 class InvokerStorage3 : public InvokerStorageBase { | 1117 class InvokerStorage3 : public InvokerStorageBase { |
| 1211 public: | 1118 public: |
| 1212 typedef InvokerStorage3 StorageType; | 1119 typedef InvokerStorage3 StorageType; |
| 1213 typedef FunctionTraits<Sig> TargetTraits; | 1120 typedef FunctionTraits<Sig> TargetTraits; |
| 1214 typedef Invoker3<StorageType, typename TargetTraits::NormalizedSig> Invoker; | 1121 typedef Invoker3<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1215 typedef typename TargetTraits::IsMethod IsMethod; | 1122 typedef typename TargetTraits::IsMethod IsMethod; |
| 1123 |
| 1216 // For methods, we need to be careful for parameter 1. We skip the | 1124 // For methods, we need to be careful for parameter 1. We skip the |
| 1217 // scoped_refptr check because the binder itself takes care of this. We also | 1125 // scoped_refptr check because the binder itself takes care of this. We also |
| 1218 // disallow binding of an array as the method's target object. | 1126 // disallow binding of an array as the method's target object. |
| 1219 COMPILE_ASSERT(IsMethod::value || | 1127 COMPILE_ASSERT(IsMethod::value || |
| 1220 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1128 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1221 p1_is_refcounted_type_and_needs_scoped_refptr); | 1129 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1222 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1130 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1223 first_bound_argument_to_method_cannot_be_array); | 1131 first_bound_argument_to_method_cannot_be_array); |
| 1224 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1132 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1225 p2_is_refcounted_type_and_needs_scoped_refptr); | 1133 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 1226 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P3>::value, | 1134 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P3>::value, |
| 1227 p3_is_refcounted_type_and_needs_scoped_refptr); | 1135 p3_is_refcounted_type_and_needs_scoped_refptr); |
| 1228 | 1136 |
| 1137 // Do not allow binding a non-const reference parameter. Non-const reference |
| 1138 // parameters are disallowed by the Google style guide. Also, binding a |
| 1139 // non-const reference parameter can make for subtle bugs because the |
| 1140 // invoked function will receive a reference to the stored copy of the |
| 1141 // argument and not the original. |
| 1142 COMPILE_ASSERT( |
| 1143 !( is_non_const_reference<typename TargetTraits::B1>::value || |
| 1144 is_non_const_reference<typename TargetTraits::B2>::value || |
| 1145 is_non_const_reference<typename TargetTraits::B3>::value ), |
| 1146 do_not_bind_functions_with_nonconst_ref); |
| 1147 |
| 1229 | 1148 |
| 1230 InvokerStorage3(Sig f, const P1& p1, const P2& p2, const P3& p3) | 1149 InvokerStorage3(Sig f, const P1& p1, const P2& p2, const P3& p3) |
| 1231 : f_(f), p1_(static_cast<typename BindType<P1>::StorageType>(p1)), | 1150 : f_(f), p1_(static_cast<typename ParamTraits<P1>::StorageType>(p1)), |
| 1232 p2_(static_cast<typename BindType<P2>::StorageType>(p2)), | 1151 p2_(static_cast<typename ParamTraits<P2>::StorageType>(p2)), |
| 1233 p3_(static_cast<typename BindType<P3>::StorageType>(p3)) { | 1152 p3_(static_cast<typename ParamTraits<P3>::StorageType>(p3)) { |
| 1234 MaybeRefcount<IsMethod, P1>::AddRef(p1_); | 1153 MaybeRefcount<IsMethod, P1>::AddRef(p1_); |
| 1235 } | 1154 } |
| 1236 | 1155 |
| 1237 virtual ~InvokerStorage3() { | 1156 virtual ~InvokerStorage3() { |
| 1238 MaybeRefcount<IsMethod, P1>::Release(p1_); | 1157 MaybeRefcount<IsMethod, P1>::Release(p1_); |
| 1239 } | 1158 } |
| 1240 | 1159 |
| 1241 Sig f_; | 1160 Sig f_; |
| 1242 typename BindType<P1>::StorageType p1_; | 1161 typename ParamTraits<P1>::StorageType p1_; |
| 1243 typename BindType<P2>::StorageType p2_; | 1162 typename ParamTraits<P2>::StorageType p2_; |
| 1244 typename BindType<P3>::StorageType p3_; | 1163 typename ParamTraits<P3>::StorageType p3_; |
| 1245 }; | 1164 }; |
| 1246 | 1165 |
| 1247 template <typename Sig, typename P1, typename P2, typename P3, typename P4> | 1166 template <typename Sig, typename P1, typename P2, typename P3, typename P4> |
| 1248 class InvokerStorage4 : public InvokerStorageBase { | 1167 class InvokerStorage4 : public InvokerStorageBase { |
| 1249 public: | 1168 public: |
| 1250 typedef InvokerStorage4 StorageType; | 1169 typedef InvokerStorage4 StorageType; |
| 1251 typedef FunctionTraits<Sig> TargetTraits; | 1170 typedef FunctionTraits<Sig> TargetTraits; |
| 1252 typedef Invoker4<StorageType, typename TargetTraits::NormalizedSig> Invoker; | 1171 typedef Invoker4<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1253 typedef typename TargetTraits::IsMethod IsMethod; | 1172 typedef typename TargetTraits::IsMethod IsMethod; |
| 1173 |
| 1254 // For methods, we need to be careful for parameter 1. We skip the | 1174 // For methods, we need to be careful for parameter 1. We skip the |
| 1255 // scoped_refptr check because the binder itself takes care of this. We also | 1175 // scoped_refptr check because the binder itself takes care of this. We also |
| 1256 // disallow binding of an array as the method's target object. | 1176 // disallow binding of an array as the method's target object. |
| 1257 COMPILE_ASSERT(IsMethod::value || | 1177 COMPILE_ASSERT(IsMethod::value || |
| 1258 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1178 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1259 p1_is_refcounted_type_and_needs_scoped_refptr); | 1179 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1260 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1180 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1261 first_bound_argument_to_method_cannot_be_array); | 1181 first_bound_argument_to_method_cannot_be_array); |
| 1262 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1182 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1263 p2_is_refcounted_type_and_needs_scoped_refptr); | 1183 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 1264 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P3>::value, | 1184 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P3>::value, |
| 1265 p3_is_refcounted_type_and_needs_scoped_refptr); | 1185 p3_is_refcounted_type_and_needs_scoped_refptr); |
| 1266 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P4>::value, | 1186 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P4>::value, |
| 1267 p4_is_refcounted_type_and_needs_scoped_refptr); | 1187 p4_is_refcounted_type_and_needs_scoped_refptr); |
| 1268 | 1188 |
| 1189 // Do not allow binding a non-const reference parameter. Non-const reference |
| 1190 // parameters are disallowed by the Google style guide. Also, binding a |
| 1191 // non-const reference parameter can make for subtle bugs because the |
| 1192 // invoked function will receive a reference to the stored copy of the |
| 1193 // argument and not the original. |
| 1194 COMPILE_ASSERT( |
| 1195 !( is_non_const_reference<typename TargetTraits::B1>::value || |
| 1196 is_non_const_reference<typename TargetTraits::B2>::value || |
| 1197 is_non_const_reference<typename TargetTraits::B3>::value || |
| 1198 is_non_const_reference<typename TargetTraits::B4>::value ), |
| 1199 do_not_bind_functions_with_nonconst_ref); |
| 1200 |
| 1269 | 1201 |
| 1270 InvokerStorage4(Sig f, const P1& p1, const P2& p2, const P3& p3, const P4& p4) | 1202 InvokerStorage4(Sig f, const P1& p1, const P2& p2, const P3& p3, const P4& p4) |
| 1271 : f_(f), p1_(static_cast<typename BindType<P1>::StorageType>(p1)), | 1203 : f_(f), p1_(static_cast<typename ParamTraits<P1>::StorageType>(p1)), |
| 1272 p2_(static_cast<typename BindType<P2>::StorageType>(p2)), | 1204 p2_(static_cast<typename ParamTraits<P2>::StorageType>(p2)), |
| 1273 p3_(static_cast<typename BindType<P3>::StorageType>(p3)), | 1205 p3_(static_cast<typename ParamTraits<P3>::StorageType>(p3)), |
| 1274 p4_(static_cast<typename BindType<P4>::StorageType>(p4)) { | 1206 p4_(static_cast<typename ParamTraits<P4>::StorageType>(p4)) { |
| 1275 MaybeRefcount<IsMethod, P1>::AddRef(p1_); | 1207 MaybeRefcount<IsMethod, P1>::AddRef(p1_); |
| 1276 } | 1208 } |
| 1277 | 1209 |
| 1278 virtual ~InvokerStorage4() { | 1210 virtual ~InvokerStorage4() { |
| 1279 MaybeRefcount<IsMethod, P1>::Release(p1_); | 1211 MaybeRefcount<IsMethod, P1>::Release(p1_); |
| 1280 } | 1212 } |
| 1281 | 1213 |
| 1282 Sig f_; | 1214 Sig f_; |
| 1283 typename BindType<P1>::StorageType p1_; | 1215 typename ParamTraits<P1>::StorageType p1_; |
| 1284 typename BindType<P2>::StorageType p2_; | 1216 typename ParamTraits<P2>::StorageType p2_; |
| 1285 typename BindType<P3>::StorageType p3_; | 1217 typename ParamTraits<P3>::StorageType p3_; |
| 1286 typename BindType<P4>::StorageType p4_; | 1218 typename ParamTraits<P4>::StorageType p4_; |
| 1287 }; | 1219 }; |
| 1288 | 1220 |
| 1289 template <typename Sig, typename P1, typename P2, typename P3, typename P4, | 1221 template <typename Sig, typename P1, typename P2, typename P3, typename P4, |
| 1290 typename P5> | 1222 typename P5> |
| 1291 class InvokerStorage5 : public InvokerStorageBase { | 1223 class InvokerStorage5 : public InvokerStorageBase { |
| 1292 public: | 1224 public: |
| 1293 typedef InvokerStorage5 StorageType; | 1225 typedef InvokerStorage5 StorageType; |
| 1294 typedef FunctionTraits<Sig> TargetTraits; | 1226 typedef FunctionTraits<Sig> TargetTraits; |
| 1295 typedef Invoker5<StorageType, typename TargetTraits::NormalizedSig> Invoker; | 1227 typedef Invoker5<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1296 typedef typename TargetTraits::IsMethod IsMethod; | 1228 typedef typename TargetTraits::IsMethod IsMethod; |
| 1229 |
| 1297 // For methods, we need to be careful for parameter 1. We skip the | 1230 // For methods, we need to be careful for parameter 1. We skip the |
| 1298 // scoped_refptr check because the binder itself takes care of this. We also | 1231 // scoped_refptr check because the binder itself takes care of this. We also |
| 1299 // disallow binding of an array as the method's target object. | 1232 // disallow binding of an array as the method's target object. |
| 1300 COMPILE_ASSERT(IsMethod::value || | 1233 COMPILE_ASSERT(IsMethod::value || |
| 1301 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1234 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1302 p1_is_refcounted_type_and_needs_scoped_refptr); | 1235 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1303 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1236 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1304 first_bound_argument_to_method_cannot_be_array); | 1237 first_bound_argument_to_method_cannot_be_array); |
| 1305 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1238 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1306 p2_is_refcounted_type_and_needs_scoped_refptr); | 1239 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 1307 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P3>::value, | 1240 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P3>::value, |
| 1308 p3_is_refcounted_type_and_needs_scoped_refptr); | 1241 p3_is_refcounted_type_and_needs_scoped_refptr); |
| 1309 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P4>::value, | 1242 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P4>::value, |
| 1310 p4_is_refcounted_type_and_needs_scoped_refptr); | 1243 p4_is_refcounted_type_and_needs_scoped_refptr); |
| 1311 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P5>::value, | 1244 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P5>::value, |
| 1312 p5_is_refcounted_type_and_needs_scoped_refptr); | 1245 p5_is_refcounted_type_and_needs_scoped_refptr); |
| 1313 | 1246 |
| 1247 // Do not allow binding a non-const reference parameter. Non-const reference |
| 1248 // parameters are disallowed by the Google style guide. Also, binding a |
| 1249 // non-const reference parameter can make for subtle bugs because the |
| 1250 // invoked function will receive a reference to the stored copy of the |
| 1251 // argument and not the original. |
| 1252 COMPILE_ASSERT( |
| 1253 !( is_non_const_reference<typename TargetTraits::B1>::value || |
| 1254 is_non_const_reference<typename TargetTraits::B2>::value || |
| 1255 is_non_const_reference<typename TargetTraits::B3>::value || |
| 1256 is_non_const_reference<typename TargetTraits::B4>::value || |
| 1257 is_non_const_reference<typename TargetTraits::B5>::value ), |
| 1258 do_not_bind_functions_with_nonconst_ref); |
| 1259 |
| 1314 | 1260 |
| 1315 InvokerStorage5(Sig f, const P1& p1, const P2& p2, const P3& p3, | 1261 InvokerStorage5(Sig f, const P1& p1, const P2& p2, const P3& p3, |
| 1316 const P4& p4, const P5& p5) | 1262 const P4& p4, const P5& p5) |
| 1317 : f_(f), p1_(static_cast<typename BindType<P1>::StorageType>(p1)), | 1263 : f_(f), p1_(static_cast<typename ParamTraits<P1>::StorageType>(p1)), |
| 1318 p2_(static_cast<typename BindType<P2>::StorageType>(p2)), | 1264 p2_(static_cast<typename ParamTraits<P2>::StorageType>(p2)), |
| 1319 p3_(static_cast<typename BindType<P3>::StorageType>(p3)), | 1265 p3_(static_cast<typename ParamTraits<P3>::StorageType>(p3)), |
| 1320 p4_(static_cast<typename BindType<P4>::StorageType>(p4)), | 1266 p4_(static_cast<typename ParamTraits<P4>::StorageType>(p4)), |
| 1321 p5_(static_cast<typename BindType<P5>::StorageType>(p5)) { | 1267 p5_(static_cast<typename ParamTraits<P5>::StorageType>(p5)) { |
| 1322 MaybeRefcount<IsMethod, P1>::AddRef(p1_); | 1268 MaybeRefcount<IsMethod, P1>::AddRef(p1_); |
| 1323 } | 1269 } |
| 1324 | 1270 |
| 1325 virtual ~InvokerStorage5() { | 1271 virtual ~InvokerStorage5() { |
| 1326 MaybeRefcount<IsMethod, P1>::Release(p1_); | 1272 MaybeRefcount<IsMethod, P1>::Release(p1_); |
| 1327 } | 1273 } |
| 1328 | 1274 |
| 1329 Sig f_; | 1275 Sig f_; |
| 1330 typename BindType<P1>::StorageType p1_; | 1276 typename ParamTraits<P1>::StorageType p1_; |
| 1331 typename BindType<P2>::StorageType p2_; | 1277 typename ParamTraits<P2>::StorageType p2_; |
| 1332 typename BindType<P3>::StorageType p3_; | 1278 typename ParamTraits<P3>::StorageType p3_; |
| 1333 typename BindType<P4>::StorageType p4_; | 1279 typename ParamTraits<P4>::StorageType p4_; |
| 1334 typename BindType<P5>::StorageType p5_; | 1280 typename ParamTraits<P5>::StorageType p5_; |
| 1335 }; | 1281 }; |
| 1336 | 1282 |
| 1337 template <typename Sig, typename P1, typename P2, typename P3, typename P4, | 1283 template <typename Sig, typename P1, typename P2, typename P3, typename P4, |
| 1338 typename P5, typename P6> | 1284 typename P5, typename P6> |
| 1339 class InvokerStorage6 : public InvokerStorageBase { | 1285 class InvokerStorage6 : public InvokerStorageBase { |
| 1340 public: | 1286 public: |
| 1341 typedef InvokerStorage6 StorageType; | 1287 typedef InvokerStorage6 StorageType; |
| 1342 typedef FunctionTraits<Sig> TargetTraits; | 1288 typedef FunctionTraits<Sig> TargetTraits; |
| 1343 typedef Invoker6<StorageType, typename TargetTraits::NormalizedSig> Invoker; | 1289 typedef Invoker6<StorageType, typename TargetTraits::NormalizedSig> Invoker; |
| 1344 typedef typename TargetTraits::IsMethod IsMethod; | 1290 typedef typename TargetTraits::IsMethod IsMethod; |
| 1291 |
| 1345 // 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 |
| 1346 // 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 |
| 1347 // disallow binding of an array as the method's target object. | 1294 // disallow binding of an array as the method's target object. |
| 1348 COMPILE_ASSERT(IsMethod::value || | 1295 COMPILE_ASSERT(IsMethod::value || |
| 1349 !internal::UnsafeBindtoRefCountedArg<P1>::value, | 1296 !internal::UnsafeBindtoRefCountedArg<P1>::value, |
| 1350 p1_is_refcounted_type_and_needs_scoped_refptr); | 1297 p1_is_refcounted_type_and_needs_scoped_refptr); |
| 1351 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, | 1298 COMPILE_ASSERT(!IsMethod::value || !is_array<P1>::value, |
| 1352 first_bound_argument_to_method_cannot_be_array); | 1299 first_bound_argument_to_method_cannot_be_array); |
| 1353 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, | 1300 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P2>::value, |
| 1354 p2_is_refcounted_type_and_needs_scoped_refptr); | 1301 p2_is_refcounted_type_and_needs_scoped_refptr); |
| 1355 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P3>::value, | 1302 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P3>::value, |
| 1356 p3_is_refcounted_type_and_needs_scoped_refptr); | 1303 p3_is_refcounted_type_and_needs_scoped_refptr); |
| 1357 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P4>::value, | 1304 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P4>::value, |
| 1358 p4_is_refcounted_type_and_needs_scoped_refptr); | 1305 p4_is_refcounted_type_and_needs_scoped_refptr); |
| 1359 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P5>::value, | 1306 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P5>::value, |
| 1360 p5_is_refcounted_type_and_needs_scoped_refptr); | 1307 p5_is_refcounted_type_and_needs_scoped_refptr); |
| 1361 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P6>::value, | 1308 COMPILE_ASSERT(!internal::UnsafeBindtoRefCountedArg<P6>::value, |
| 1362 p6_is_refcounted_type_and_needs_scoped_refptr); | 1309 p6_is_refcounted_type_and_needs_scoped_refptr); |
| 1363 | 1310 |
| 1311 // Do not allow binding a non-const reference parameter. Non-const reference |
| 1312 // parameters are disallowed by the Google style guide. Also, binding a |
| 1313 // non-const reference parameter can make for subtle bugs because the |
| 1314 // invoked function will receive a reference to the stored copy of the |
| 1315 // argument and not the original. |
| 1316 COMPILE_ASSERT( |
| 1317 !( is_non_const_reference<typename TargetTraits::B1>::value || |
| 1318 is_non_const_reference<typename TargetTraits::B2>::value || |
| 1319 is_non_const_reference<typename TargetTraits::B3>::value || |
| 1320 is_non_const_reference<typename TargetTraits::B4>::value || |
| 1321 is_non_const_reference<typename TargetTraits::B5>::value || |
| 1322 is_non_const_reference<typename TargetTraits::B6>::value ), |
| 1323 do_not_bind_functions_with_nonconst_ref); |
| 1324 |
| 1364 | 1325 |
| 1365 InvokerStorage6(Sig f, const P1& p1, const P2& p2, const P3& p3, | 1326 InvokerStorage6(Sig f, const P1& p1, const P2& p2, const P3& p3, |
| 1366 const P4& p4, const P5& p5, const P6& p6) | 1327 const P4& p4, const P5& p5, const P6& p6) |
| 1367 : f_(f), p1_(static_cast<typename BindType<P1>::StorageType>(p1)), | 1328 : f_(f), p1_(static_cast<typename ParamTraits<P1>::StorageType>(p1)), |
| 1368 p2_(static_cast<typename BindType<P2>::StorageType>(p2)), | 1329 p2_(static_cast<typename ParamTraits<P2>::StorageType>(p2)), |
| 1369 p3_(static_cast<typename BindType<P3>::StorageType>(p3)), | 1330 p3_(static_cast<typename ParamTraits<P3>::StorageType>(p3)), |
| 1370 p4_(static_cast<typename BindType<P4>::StorageType>(p4)), | 1331 p4_(static_cast<typename ParamTraits<P4>::StorageType>(p4)), |
| 1371 p5_(static_cast<typename BindType<P5>::StorageType>(p5)), | 1332 p5_(static_cast<typename ParamTraits<P5>::StorageType>(p5)), |
| 1372 p6_(static_cast<typename BindType<P6>::StorageType>(p6)) { | 1333 p6_(static_cast<typename ParamTraits<P6>::StorageType>(p6)) { |
| 1373 MaybeRefcount<IsMethod, P1>::AddRef(p1_); | 1334 MaybeRefcount<IsMethod, P1>::AddRef(p1_); |
| 1374 } | 1335 } |
| 1375 | 1336 |
| 1376 virtual ~InvokerStorage6() { | 1337 virtual ~InvokerStorage6() { |
| 1377 MaybeRefcount<IsMethod, P1>::Release(p1_); | 1338 MaybeRefcount<IsMethod, P1>::Release(p1_); |
| 1378 } | 1339 } |
| 1379 | 1340 |
| 1380 Sig f_; | 1341 Sig f_; |
| 1381 typename BindType<P1>::StorageType p1_; | 1342 typename ParamTraits<P1>::StorageType p1_; |
| 1382 typename BindType<P2>::StorageType p2_; | 1343 typename ParamTraits<P2>::StorageType p2_; |
| 1383 typename BindType<P3>::StorageType p3_; | 1344 typename ParamTraits<P3>::StorageType p3_; |
| 1384 typename BindType<P4>::StorageType p4_; | 1345 typename ParamTraits<P4>::StorageType p4_; |
| 1385 typename BindType<P5>::StorageType p5_; | 1346 typename ParamTraits<P5>::StorageType p5_; |
| 1386 typename BindType<P6>::StorageType p6_; | 1347 typename ParamTraits<P6>::StorageType p6_; |
| 1387 }; | 1348 }; |
| 1388 | 1349 |
| 1389 } // namespace internal | 1350 } // namespace internal |
| 1390 } // namespace base | 1351 } // namespace base |
| 1391 | 1352 |
| 1392 #endif // BASE_BIND_INTERNAL_H_ | 1353 #endif // BASE_BIND_INTERNAL_H_ |
| OLD | NEW |