You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
com_ptr has one nullptr_t type param constuctor and two params constructor which is void* and take_ownership_from_abi_t
static void init_holder(detail::instance *inst, detail::value_and_holder &v_h,
const holder_type *holder_ptr, const void * /* dummy -- not enable_shared_from_this<T>) */) {
if (holder_ptr) {
init_holder_from_existing(v_h, holder_ptr, std::is_copy_constructible<holder_type>());
v_h.set_holder_constructed();
} else if (inst->owned || detail::always_construct_holder<holder_type>::value) {
new (std::addressof(v_h.holder<holder_type>())) holder_type(v_h.value_ptr<type>());
v_h.set_holder_constructed();
}
}
new (std::addressof(v_h.holder<holder_type>())) holder_type(v_h.value_ptr<type>()); the pybind new operator alway call the one param with type T * pointer , init_holder is not a template functon, this will cause an error at compile time.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
PYBIND11_DECLARE_HOLDER_TYPE(T, winrt::com_ptr);
com_ptr
has onenullptr_t
type param constuctor and two params constructor which isvoid*
andtake_ownership_from_abi_t
new (std::addressof(v_h.holder<holder_type>())) holder_type(v_h.value_ptr<type>());
the pybindnew operator
alway call the one param with typeT *
pointer ,init_holder
is not a template functon, this will cause an error at compile time.how to resolove this question? thanks.
Beta Was this translation helpful? Give feedback.
All reactions