Update cast.h

This commit is contained in:
Megh Parikh 2024-06-12 15:09:21 -04:00 committed by GitHub
parent 8869be19d8
commit b8336a8bb7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -685,10 +685,12 @@ public:
protected: protected:
template <size_t... Is> template <size_t... Is>
type implicit_cast(index_sequence<Is...>) & { type implicit_cast(index_sequence<Is...>) & {
using std::get;
return type(cast_op<Ts>(get<Is>(subcasters))...); return type(cast_op<Ts>(get<Is>(subcasters))...);
} }
template <size_t... Is> template <size_t... Is>
type implicit_cast(index_sequence<Is...>) && { type implicit_cast(index_sequence<Is...>) && {
using std::get;
return type(cast_op<Ts>(std::move(get<Is>(subcasters)))...); return type(cast_op<Ts>(std::move(get<Is>(subcasters)))...);
} }
@ -696,6 +698,8 @@ protected:
template <size_t... Is> template <size_t... Is>
bool load_impl(const sequence &seq, bool convert, index_sequence<Is...>) { bool load_impl(const sequence &seq, bool convert, index_sequence<Is...>) {
using std::get;
#ifdef __cpp_fold_expressions #ifdef __cpp_fold_expressions
if ((... || !get<Is>(subcasters).load(seq[Is], convert))) { if ((... || !get<Is>(subcasters).load(seq[Is], convert))) {
return false; return false;
@ -714,6 +718,7 @@ protected:
template <typename T, size_t... Is> template <typename T, size_t... Is>
static handle static handle
cast_impl(T &&src, return_value_policy policy, handle parent, index_sequence<Is...>) { cast_impl(T &&src, return_value_policy policy, handle parent, index_sequence<Is...>) {
using std::get;
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(src, policy, parent); PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(src, policy, parent);
PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(policy, parent); PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(policy, parent);
std::array<object, size> entries{{reinterpret_steal<object>( std::array<object, size> entries{{reinterpret_steal<object>(