@@ -85,14 +85,14 @@ struct set_caster {
85
85
}
86
86
87
87
template <typename T>
88
- static handle cast (T &&src, return_value_policy policy , handle parent) {
88
+ static handle cast (T &&src, return_value_policy_pack rvpp , handle parent) {
89
89
if (!std::is_lvalue_reference<T>::value) {
90
- policy = return_value_policy_override<Key>::policy ( policy);
90
+ rvpp = rvpp. override_policy ( return_value_policy_override<Key>::policy);
91
91
}
92
92
pybind11::set s;
93
93
for (auto &&value : src) {
94
94
auto value_ = reinterpret_steal<object>(
95
- key_conv::cast (detail::forward_like<T>(value), policy , parent));
95
+ key_conv::cast (detail::forward_like<T>(value), rvpp , parent));
96
96
if (!value_ || !s.add (std::move (value_))) {
97
97
return handle ();
98
98
}
@@ -191,15 +191,15 @@ struct list_caster {
191
191
192
192
public:
193
193
template <typename T>
194
- static handle cast (T &&src, return_value_policy policy , handle parent) {
194
+ static handle cast (T &&src, return_value_policy_pack rvpp , handle parent) {
195
195
if (!std::is_lvalue_reference<T>::value) {
196
- policy = return_value_policy_override<Value>::policy ( policy);
196
+ rvpp = rvpp. override_policy ( return_value_policy_override<Value>::policy);
197
197
}
198
198
list l (src.size ());
199
199
ssize_t index = 0 ;
200
200
for (auto &&value : src) {
201
201
auto value_ = reinterpret_steal<object>(
202
- value_conv::cast (detail::forward_like<T>(value), policy , parent));
202
+ value_conv::cast (detail::forward_like<T>(value), rvpp , parent));
203
203
if (!value_) {
204
204
return handle ();
205
205
}
@@ -208,7 +208,7 @@ struct list_caster {
208
208
return l.release ();
209
209
}
210
210
211
- PYBIND11_TYPE_CASTER (Type, const_name(" List[" ) + value_conv::name + const_name(" ]" ));
211
+ PYBIND11_TYPE_CASTER_RVPP (Type, const_name(" List[" ) + value_conv::name + const_name(" ]" ));
212
212
};
213
213
214
214
template <typename Type, typename Alloc>
@@ -258,12 +258,12 @@ struct array_caster {
258
258
}
259
259
260
260
template <typename T>
261
- static handle cast (T &&src, return_value_policy policy , handle parent) {
261
+ static handle cast (T &&src, return_value_policy_pack rvpp , handle parent) {
262
262
list l (src.size ());
263
263
ssize_t index = 0 ;
264
264
for (auto &&value : src) {
265
265
auto value_ = reinterpret_steal<object>(
266
- value_conv::cast (detail::forward_like<T>(value), policy , parent));
266
+ value_conv::cast (detail::forward_like<T>(value), rvpp , parent));
267
267
if (!value_) {
268
268
return handle ();
269
269
}
@@ -272,12 +272,12 @@ struct array_caster {
272
272
return l.release ();
273
273
}
274
274
275
- PYBIND11_TYPE_CASTER (ArrayType,
276
- const_name (" List[" ) + value_conv::name
277
- + const_name<Resizable>(const_name(" " ),
278
- const_name(" [" ) + const_name<Size>()
279
- + const_name(" ]" ))
280
- + const_name(" ]" ));
275
+ PYBIND11_TYPE_CASTER_RVPP (ArrayType,
276
+ const_name (" List[" ) + value_conv::name
277
+ + const_name<Resizable>(const_name(" " ),
278
+ const_name(" [" ) + const_name<Size>()
279
+ + const_name(" ]" ))
280
+ + const_name(" ]" ));
281
281
};
282
282
283
283
template <typename Type, size_t Size >
@@ -309,15 +309,15 @@ struct optional_caster {
309
309
using value_conv = make_caster<Value>;
310
310
311
311
template <typename T>
312
- static handle cast (T &&src, return_value_policy policy , handle parent) {
312
+ static handle cast (T &&src, return_value_policy_pack rvpp , handle parent) {
313
313
if (!src) {
314
314
return none ().release ();
315
315
}
316
316
if (!std::is_lvalue_reference<T>::value) {
317
- policy = return_value_policy_override<Value>::policy ( policy);
317
+ rvpp = rvpp. override_policy ( return_value_policy_override<Value>::policy);
318
318
}
319
319
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
320
- return value_conv::cast (*std::forward<T>(src), policy , parent);
320
+ return value_conv::cast (*std::forward<T>(src), rvpp , parent);
321
321
}
322
322
323
323
bool load (handle src, bool convert) {
@@ -336,7 +336,7 @@ struct optional_caster {
336
336
return true ;
337
337
}
338
338
339
- PYBIND11_TYPE_CASTER (Type, const_name(" Optional[" ) + value_conv::name + const_name(" ]" ));
339
+ PYBIND11_TYPE_CASTER_RVPP (Type, const_name(" Optional[" ) + value_conv::name + const_name(" ]" ));
340
340
};
341
341
342
342
#if defined(PYBIND11_HAS_OPTIONAL)
@@ -359,14 +359,14 @@ struct type_caster<std::experimental::nullopt_t>
359
359
360
360
// / Visit a variant and cast any found type to Python
361
361
struct variant_caster_visitor {
362
- return_value_policy policy ;
362
+ return_value_policy_pack rvpp ;
363
363
handle parent;
364
364
365
365
using result_type = handle; // required by boost::variant in C++11
366
366
367
367
template <typename T>
368
368
result_type operator ()(T &&src) const {
369
- return make_caster<T>::cast (std::forward<T>(src), policy , parent);
369
+ return make_caster<T>::cast (std::forward<T>(src), rvpp , parent);
370
370
}
371
371
};
372
372
@@ -417,15 +417,15 @@ struct variant_caster<V<Ts...>> {
417
417
}
418
418
419
419
template <typename Variant>
420
- static handle cast (Variant &&src, return_value_policy policy , handle parent) {
421
- return visit_helper<V>::call (variant_caster_visitor{policy , parent},
420
+ static handle cast (Variant &&src, return_value_policy_pack rvpp , handle parent) {
421
+ return visit_helper<V>::call (variant_caster_visitor{rvpp , parent},
422
422
std::forward<Variant>(src));
423
423
}
424
424
425
425
using Type = V<Ts...>;
426
- PYBIND11_TYPE_CASTER (Type,
427
- const_name (" Union[" ) + detail::concat(make_caster<Ts>::name...)
428
- + const_name(" ]" ));
426
+ PYBIND11_TYPE_CASTER_RVPP (Type,
427
+ const_name (" Union[" ) + detail::concat(make_caster<Ts>::name...)
428
+ + const_name(" ]" ));
429
429
};
430
430
431
431
#if defined(PYBIND11_HAS_VARIANT)
0 commit comments