mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-31 15:20:34 +00:00
Simplify cast_op return type (#532)
Using a complicated declval here was pointlessly complicated: we already know the type, because that's what cast_op_type<T> is in the first place. (The declval also broke MSVC).
This commit is contained in:
parent
db86f7f285
commit
14bfe622f8
@ -433,12 +433,10 @@ template <typename type, typename SFINAE = void> class type_caster : public type
|
|||||||
template <typename type> using make_caster = type_caster<intrinsic_t<type>>;
|
template <typename type> using make_caster = type_caster<intrinsic_t<type>>;
|
||||||
|
|
||||||
// Shortcut for calling a caster's `cast_op_type` cast operator for casting a type_caster to a T
|
// Shortcut for calling a caster's `cast_op_type` cast operator for casting a type_caster to a T
|
||||||
template <typename T>
|
template <typename T> typename make_caster<T>::template cast_op_type<T> cast_op(make_caster<T> &caster) {
|
||||||
auto cast_op(make_caster<T> &caster) -> decltype(caster.operator typename make_caster<T>::template cast_op_type<T>()) {
|
|
||||||
return caster.operator typename make_caster<T>::template cast_op_type<T>();
|
return caster.operator typename make_caster<T>::template cast_op_type<T>();
|
||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T> typename make_caster<T>::template cast_op_type<T> cast_op(make_caster<T> &&caster) {
|
||||||
auto cast_op(make_caster<T> &&caster) -> decltype(caster.operator typename make_caster<T>::template cast_op_type<T>()) {
|
|
||||||
return cast_op<T>(caster);
|
return cast_op<T>(caster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user