OLD | NEW |
1 $$ This is a pump file for generating file templates. Pump is a python | 1 $$ This is a pump file for generating file templates. Pump is a python |
2 $$ script that is part of the Google Test suite of utilities. Description | 2 $$ script that is part of the Google Test suite of utilities. Description |
3 $$ can be found here: | 3 $$ can be found here: |
4 $$ | 4 $$ |
5 $$ http://code.google.com/p/googletest/wiki/PumpManual | 5 $$ http://code.google.com/p/googletest/wiki/PumpManual |
6 $$ | 6 $$ |
7 | 7 |
8 $$ | 8 $$ |
9 $$ MAX_ARITY controls the number of arguments that Bind() supports. | 9 $$ MAX_ARITY controls the number of arguments that Bind() supports. |
10 $$ The amount of code, and more importantly, the number of template types | 10 $$ The amount of code, and more importantly, the number of template types |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Use of this source code is governed by a BSD-style license that can be | 29 // Use of this source code is governed by a BSD-style license that can be |
30 // found in the LICENSE file. | 30 // found in the LICENSE file. |
31 | 31 |
32 #ifndef BASE_BIND_H_ | 32 #ifndef BASE_BIND_H_ |
33 #define BASE_BIND_H_ | 33 #define BASE_BIND_H_ |
34 #pragma once | 34 #pragma once |
35 | 35 |
36 #include "base/bind_internal.h" | 36 #include "base/bind_internal.h" |
37 #include "base/callback_internal.h" | 37 #include "base/callback_internal.h" |
38 | 38 |
39 // See base/callback.h for how to use these functions. If reading the | 39 // ----------------------------------------------------------------------------- |
40 // implementation, before proceeding further, you should read the top | 40 // User documentation |
41 // comment of base/bind_internal.h for a definition of common terms and | 41 // ----------------------------------------------------------------------------- |
42 // concepts. | |
43 // | 42 // |
44 // IMPLEMENTATION NOTE | 43 // See base/callback.h for documentation. |
| 44 // |
| 45 // |
| 46 // ----------------------------------------------------------------------------- |
| 47 // Implementation notes |
| 48 // ----------------------------------------------------------------------------- |
| 49 // |
| 50 // If you're reading the implementation, before proceeding further, you should |
| 51 // read the top comment of base/bind_internal.h for a definition of common |
| 52 // terms and concepts. |
| 53 // |
| 54 // RETURN TYPES |
| 55 // |
45 // Though Bind()'s result is meant to be stored in a Callback<> type, it | 56 // Though Bind()'s result is meant to be stored in a Callback<> type, it |
46 // cannot actually return the exact type without requiring a large amount | 57 // cannot actually return the exact type without requiring a large amount |
47 // of extra template specializations. The problem is that in order to | 58 // of extra template specializations. The problem is that in order to |
48 // discern the correct specialization of Callback<>, Bind would need to | 59 // discern the correct specialization of Callback<>, Bind would need to |
49 // unwrap the function signature to determine the signature's arity, and | 60 // unwrap the function signature to determine the signature's arity, and |
50 // whether or not it is a method. | 61 // whether or not it is a method. |
51 // | 62 // |
52 // Each unique combination of (arity, function_type, num_prebound) where | 63 // Each unique combination of (arity, function_type, num_prebound) where |
53 // function_type is one of {function, method, const_method} would require | 64 // function_type is one of {function, method, const_method} would require |
54 // one specialization. We eventually have to do a similar number of | 65 // one specialization. We eventually have to do a similar number of |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return Callback<typename BindState::UnboundRunType>( | 145 return Callback<typename BindState::UnboundRunType>( |
135 new BindState(internal::MakeRunnable(functor)[[]] | 146 new BindState(internal::MakeRunnable(functor)[[]] |
136 $if ARITY > 0 [[, ]] $for ARG , [[p$(ARG)]])); | 147 $if ARITY > 0 [[, ]] $for ARG , [[p$(ARG)]])); |
137 } | 148 } |
138 | 149 |
139 ]] $$ for ARITY | 150 ]] $$ for ARITY |
140 | 151 |
141 } // namespace base | 152 } // namespace base |
142 | 153 |
143 #endif // BASE_BIND_H_ | 154 #endif // BASE_BIND_H_ |
OLD | NEW |