@@ -92,7 +92,7 @@ class cpp_function : public function {
92
92
// / Special internal constructor for functors, lambda functions, etc.
93
93
template <typename Func, typename Return, typename ... Args, typename ... Extra>
94
94
void initialize (Func &&f, Return (*)(Args...), const Extra&... extra) {
95
-
95
+ using namespace detail ;
96
96
struct capture { detail::remove_reference_t <Func> f; };
97
97
98
98
/* Store the function including any extra state it might have (e.g. a lambda capture object) */
@@ -112,58 +112,57 @@ class cpp_function : public function {
112
112
# pragma GCC diagnostic pop
113
113
#endif
114
114
if (!std::is_trivially_destructible<Func>::value)
115
- rec->free_data = [](detail:: function_record *r) { ((capture *) &r->data )->~capture (); };
115
+ rec->free_data = [](function_record *r) { ((capture *) &r->data )->~capture (); };
116
116
} else {
117
117
rec->data [0 ] = new capture { std::forward<Func>(f) };
118
- rec->free_data = [](detail:: function_record *r) { delete ((capture *) r->data [0 ]); };
118
+ rec->free_data = [](function_record *r) { delete ((capture *) r->data [0 ]); };
119
119
}
120
120
121
121
/* Type casters for the function arguments and return value */
122
- using cast_in = detail:: argument_loader<Args...>;
123
- using cast_out = detail:: make_caster<
124
- detail:: conditional_t <std::is_void<Return>::value, detail:: void_type, Return>
122
+ using cast_in = argument_loader<Args...>;
123
+ using cast_out = make_caster<
124
+ conditional_t <std::is_void<Return>::value, void_type, Return>
125
125
>;
126
126
127
- static_assert (detail:: expected_num_args<Extra...>(sizeof ...(Args), cast_in::has_args, cast_in::has_kwargs),
127
+ static_assert (expected_num_args<Extra...>(sizeof ...(Args), cast_in::has_args, cast_in::has_kwargs),
128
128
" The number of argument annotations does not match the number of function arguments" );
129
129
130
130
/* Dispatch code which converts function arguments and performs the actual function call */
131
- rec->impl = [](detail:: function_call &call) -> handle {
131
+ rec->impl = [](function_call &call) -> handle {
132
132
cast_in args_converter;
133
133
134
134
/* Try to cast the function arguments into the C++ domain */
135
135
if (!args_converter.load_args (call))
136
136
return PYBIND11_TRY_NEXT_OVERLOAD;
137
137
138
138
/* Invoke call policy pre-call hook */
139
- detail:: process_attributes<Extra...>::precall (call);
139
+ process_attributes<Extra...>::precall (call);
140
140
141
141
/* Get a pointer to the capture object */
142
142
auto data = (sizeof (capture) <= sizeof (call.func .data )
143
143
? &call.func .data : call.func .data [0 ]);
144
144
capture *cap = const_cast <capture *>(reinterpret_cast <const capture *>(data));
145
145
146
146
/* Override policy for rvalues -- usually to enforce rvp::move on an rvalue */
147
- const auto policy = detail:: return_value_policy_override<Return>::policy (call.func .policy );
147
+ const auto policy = return_value_policy_override<Return>::policy (call.func .policy );
148
148
149
149
/* Function scope guard -- defaults to the compile-to-nothing `void_type` */
150
- using Guard = detail:: extract_guard_t <Extra...>;
150
+ using Guard = extract_guard_t <Extra...>;
151
151
152
152
/* Perform the function call */
153
153
handle result = cast_out::cast (
154
154
std::move (args_converter).template call <Return, Guard>(cap->f ), policy, call.parent );
155
155
156
156
/* Invoke call policy post-call hook */
157
- detail:: process_attributes<Extra...>::postcall (call, result);
157
+ process_attributes<Extra...>::postcall (call, result);
158
158
159
159
return result;
160
160
};
161
161
162
162
/* Process any user-provided function attributes */
163
- detail:: process_attributes<Extra...>::init (extra..., rec);
163
+ process_attributes<Extra...>::init (extra..., rec);
164
164
165
165
/* Generate a readable signature describing the function's arguments and return value types */
166
- using detail::descr; using detail::_;
167
166
PYBIND11_DESCR signature = _ (" (" ) + cast_in::arg_names () + _ (" ) -> " ) + cast_out::name ();
168
167
169
168
/* Register the function with Python from generic (non-templated) code */
0 commit comments