1 // This file was GENERATED by command:
3 // DO NOT EDIT BY HAND!!!
6 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file.
14 #include "base/bind_internal.h"
15 #include "base/callback_internal.h"
17 // See base/callback.h for how to use these functions.
19 // IMPLEMENTATION NOTE
20 // Though Bind()'s result is meant to be stored in a Callback<> type, it
21 // cannot actually return the exact type without requiring a large amount
22 // of extra template specializations. The problem is that in order to
23 // discern the correct specialization of Callback<>, Bind would need to
24 // unwrap the function signature to determine the signature's arity, and
25 // whether or not it is a method.
27 // Each unique combination of (arity, function_type, num_prebound) where
28 // function_type is one of {function, method, const_method} would require
29 // one specialization. We eventually have to do a similar number of
30 // specializations anyways in the implementation (see the FunctionTraitsN,
31 // classes). However, it is avoidable in Bind if we return the result
32 // via an indirection like we do below.
36 template <typename Sig
>
37 internal::InvokerStorageHolder
<internal::InvokerStorage0
<Sig
> >
39 return internal::MakeInvokerStorageHolder(
40 new internal::InvokerStorage0
<Sig
>(f
));
43 template <typename Sig
, typename P1
>
44 internal::InvokerStorageHolder
<internal::InvokerStorage1
<Sig
,P1
> >
45 Bind(Sig f
, const P1
& p1
) {
46 return internal::MakeInvokerStorageHolder(
47 new internal::InvokerStorage1
<Sig
, P1
>(
51 template <typename Sig
, typename P1
, typename P2
>
52 internal::InvokerStorageHolder
<internal::InvokerStorage2
<Sig
,P1
, P2
> >
53 Bind(Sig f
, const P1
& p1
, const P2
& p2
) {
54 return internal::MakeInvokerStorageHolder(
55 new internal::InvokerStorage2
<Sig
, P1
, P2
>(
59 template <typename Sig
, typename P1
, typename P2
, typename P3
>
60 internal::InvokerStorageHolder
<internal::InvokerStorage3
<Sig
,P1
, P2
, P3
> >
61 Bind(Sig f
, const P1
& p1
, const P2
& p2
, const P3
& p3
) {
62 return internal::MakeInvokerStorageHolder(
63 new internal::InvokerStorage3
<Sig
, P1
, P2
, P3
>(
67 template <typename Sig
, typename P1
, typename P2
, typename P3
, typename P4
>
68 internal::InvokerStorageHolder
<internal::InvokerStorage4
<Sig
,P1
, P2
, P3
, P4
> >
69 Bind(Sig f
, const P1
& p1
, const P2
& p2
, const P3
& p3
, const P4
& p4
) {
70 return internal::MakeInvokerStorageHolder(
71 new internal::InvokerStorage4
<Sig
, P1
, P2
, P3
, P4
>(
75 template <typename Sig
, typename P1
, typename P2
, typename P3
, typename P4
,
77 internal::InvokerStorageHolder
<internal::InvokerStorage5
<Sig
,P1
, P2
, P3
, P4
,
79 Bind(Sig f
, const P1
& p1
, const P2
& p2
, const P3
& p3
, const P4
& p4
,
81 return internal::MakeInvokerStorageHolder(
82 new internal::InvokerStorage5
<Sig
, P1
, P2
, P3
, P4
, P5
>(
83 f
, p1
, p2
, p3
, p4
, p5
));
86 template <typename Sig
, typename P1
, typename P2
, typename P3
, typename P4
,
87 typename P5
, typename P6
>
88 internal::InvokerStorageHolder
<internal::InvokerStorage6
<Sig
,P1
, P2
, P3
, P4
,
90 Bind(Sig f
, const P1
& p1
, const P2
& p2
, const P3
& p3
, const P4
& p4
,
91 const P5
& p5
, const P6
& p6
) {
92 return internal::MakeInvokerStorageHolder(
93 new internal::InvokerStorage6
<Sig
, P1
, P2
, P3
, P4
, P5
, P6
>(
94 f
, p1
, p2
, p3
, p4
, p5
, p6
));
99 #endif // BASE_BIND_H_