mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 22:52:01 +00:00
Use argument-dependent-lookup for tuple_caster's get
Some libraries have custom container types and define their own `get`. They also extend the Pybind casters to bind their containers. This uses argument-dependent-lookup for using the correct "get" function
This commit is contained in:
parent
ab955f158c
commit
8869be19d8
@ -685,11 +685,11 @@ public:
|
||||
protected:
|
||||
template <size_t... Is>
|
||||
type implicit_cast(index_sequence<Is...>) & {
|
||||
return type(cast_op<Ts>(std::get<Is>(subcasters))...);
|
||||
return type(cast_op<Ts>(get<Is>(subcasters))...);
|
||||
}
|
||||
template <size_t... Is>
|
||||
type implicit_cast(index_sequence<Is...>) && {
|
||||
return type(cast_op<Ts>(std::move(std::get<Is>(subcasters)))...);
|
||||
return type(cast_op<Ts>(std::move(get<Is>(subcasters)))...);
|
||||
}
|
||||
|
||||
static constexpr bool load_impl(const sequence &, bool, index_sequence<>) { return true; }
|
||||
@ -697,11 +697,11 @@ protected:
|
||||
template <size_t... Is>
|
||||
bool load_impl(const sequence &seq, bool convert, index_sequence<Is...>) {
|
||||
#ifdef __cpp_fold_expressions
|
||||
if ((... || !std::get<Is>(subcasters).load(seq[Is], convert))) {
|
||||
if ((... || !get<Is>(subcasters).load(seq[Is], convert))) {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
for (bool r : {std::get<Is>(subcasters).load(seq[Is], convert)...}) {
|
||||
for (bool r : {get<Is>(subcasters).load(seq[Is], convert)...}) {
|
||||
if (!r) {
|
||||
return false;
|
||||
}
|
||||
@ -717,7 +717,7 @@ protected:
|
||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(src, policy, parent);
|
||||
PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(policy, parent);
|
||||
std::array<object, size> entries{{reinterpret_steal<object>(
|
||||
make_caster<Ts>::cast(std::get<Is>(std::forward<T>(src)), policy, parent))...}};
|
||||
make_caster<Ts>::cast(get<Is>(std::forward<T>(src)), policy, parent))...}};
|
||||
for (const auto &entry : entries) {
|
||||
if (!entry) {
|
||||
return handle();
|
||||
|
Loading…
Reference in New Issue
Block a user