mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-01 17:37:15 +00:00
fix build failure by introducing init_instance() specialization for smart_holder (test fails)
This commit is contained in:
parent
97a3a49678
commit
00a91571fb
@ -1954,6 +1954,9 @@ private:
|
|||||||
/// instance. Should be called as soon as the `type` value_ptr is set for an instance. Takes
|
/// instance. Should be called as soon as the `type` value_ptr is set for an instance. Takes
|
||||||
/// an optional pointer to an existing holder to use; if not specified and the instance is
|
/// an optional pointer to an existing holder to use; if not specified and the instance is
|
||||||
/// `.owned`, a new holder will be constructed to manage the value pointer.
|
/// `.owned`, a new holder will be constructed to manage the value pointer.
|
||||||
|
template <typename H = holder_type,
|
||||||
|
detail::enable_if_t<!std::is_same<H, pybindit::memory::smart_holder>::value, int>
|
||||||
|
= 0>
|
||||||
static void init_instance(detail::instance *inst, const void *holder_ptr) {
|
static void init_instance(detail::instance *inst, const void *holder_ptr) {
|
||||||
auto v_h = inst->get_value_and_holder(detail::get_type_info(typeid(type)));
|
auto v_h = inst->get_value_and_holder(detail::get_type_info(typeid(type)));
|
||||||
if (!v_h.instance_registered()) {
|
if (!v_h.instance_registered()) {
|
||||||
@ -1963,6 +1966,12 @@ private:
|
|||||||
init_holder(inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr<type>());
|
init_holder(inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr<type>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename H = holder_type,
|
||||||
|
detail::enable_if_t<std::is_same<H, pybindit::memory::smart_holder>::value, int> = 0>
|
||||||
|
static void init_instance(detail::instance * /*inst*/, const void * /*holder_ptr*/) {
|
||||||
|
// detail::type_caster<T>::template init_instance_for_type<T, A>(inst, holder_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
/// Deallocates an instance; via holder, if constructed; otherwise via operator delete.
|
/// Deallocates an instance; via holder, if constructed; otherwise via operator delete.
|
||||||
static void dealloc(detail::value_and_holder &v_h) {
|
static void dealloc(detail::value_and_holder &v_h) {
|
||||||
// We could be deallocating because we are cleaning up after a Python exception.
|
// We could be deallocating because we are cleaning up after a Python exception.
|
||||||
|
Loading…
Reference in New Issue
Block a user