mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 16:13:53 +00:00
Pure clang-format change (applied to original type_caster_generic::cast).
This commit is contained in:
parent
ee6d15647d
commit
6294eb26e5
@ -190,8 +190,9 @@ struct type_caster<mpty> : smart_holder_type_caster_load<mpty> {
|
||||
// type_caster_base END
|
||||
|
||||
// Originally type_caster_generic::cast.
|
||||
// clang-format off
|
||||
PYBIND11_NOINLINE static handle cast(const void *_src, return_value_policy policy, handle parent,
|
||||
PYBIND11_NOINLINE static handle cast(const void *_src,
|
||||
return_value_policy policy,
|
||||
handle parent,
|
||||
const detail::type_info *tinfo,
|
||||
void *(*copy_constructor)(const void *),
|
||||
void *(*move_constructor)(const void *),
|
||||
@ -211,21 +212,21 @@ struct type_caster<mpty> : smart_holder_type_caster_load<mpty> {
|
||||
}
|
||||
}
|
||||
|
||||
auto inst = reinterpret_steal<object>(make_new_instance(tinfo->type));
|
||||
auto wrapper = reinterpret_cast<instance *>(inst.ptr());
|
||||
wrapper->owned = false;
|
||||
auto inst = reinterpret_steal<object>(make_new_instance(tinfo->type));
|
||||
auto wrapper = reinterpret_cast<instance *>(inst.ptr());
|
||||
wrapper->owned = false;
|
||||
void *&valueptr = values_and_holders(wrapper).begin()->value_ptr();
|
||||
|
||||
switch (policy) {
|
||||
case return_value_policy::automatic:
|
||||
case return_value_policy::take_ownership:
|
||||
valueptr = src;
|
||||
valueptr = src;
|
||||
wrapper->owned = true;
|
||||
break;
|
||||
|
||||
case return_value_policy::automatic_reference:
|
||||
case return_value_policy::reference:
|
||||
valueptr = src;
|
||||
valueptr = src;
|
||||
wrapper->owned = false;
|
||||
break;
|
||||
|
||||
@ -239,8 +240,8 @@ struct type_caster<mpty> : smart_holder_type_caster_load<mpty> {
|
||||
#else
|
||||
std::string type_name(tinfo->cpptype->name());
|
||||
detail::clean_type_id(type_name);
|
||||
throw cast_error("return_value_policy = copy, but type " +
|
||||
type_name + " is non-copyable!");
|
||||
throw cast_error("return_value_policy = copy, but type " + type_name
|
||||
+ " is non-copyable!");
|
||||
#endif
|
||||
}
|
||||
wrapper->owned = true;
|
||||
@ -259,15 +260,15 @@ struct type_caster<mpty> : smart_holder_type_caster_load<mpty> {
|
||||
#else
|
||||
std::string type_name(tinfo->cpptype->name());
|
||||
detail::clean_type_id(type_name);
|
||||
throw cast_error("return_value_policy = move, but type " +
|
||||
type_name + " is neither movable nor copyable!");
|
||||
throw cast_error("return_value_policy = move, but type " + type_name
|
||||
+ " is neither movable nor copyable!");
|
||||
#endif
|
||||
}
|
||||
wrapper->owned = true;
|
||||
break;
|
||||
|
||||
case return_value_policy::reference_internal:
|
||||
valueptr = src;
|
||||
valueptr = src;
|
||||
wrapper->owned = false;
|
||||
keep_alive_impl(inst, parent);
|
||||
break;
|
||||
@ -280,7 +281,6 @@ struct type_caster<mpty> : smart_holder_type_caster_load<mpty> {
|
||||
|
||||
return inst.release();
|
||||
}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
template <>
|
||||
|
Loading…
Reference in New Issue
Block a user