static void construct(PyObject* source, rvalue_from_python_stage1_data* data) { void* const storage = ((converter::rvalue_from_python_storage<shared_ptr<T> >*)data)->storage.bytes; // Deal with the "None" case. if (data->convertible == source) new (storage) shared_ptr<T>(); else { boost::shared_ptr<void> hold_convertible_ref_count( (void*)0, shared_ptr_deleter(handle<>(borrowed(source))) ); // use aliasing constructor new (storage) shared_ptr<T>( hold_convertible_ref_count, static_cast<T*>(data->convertible)); } data->convertible = storage; }
static void construct(PyObject* source, rvalue_from_python_stage1_data* data) { std::cout << __PRETTY_FUNCTION__ <<"\n"; void* const storage = ((converter::rvalue_from_python_storage<shared_ptr<T> >*)data)->storage.address(); // Deal with the "None" case. if (data->convertible == source) new (storage) shared_ptr<T>(); else { boost::shared_ptr<void> hold_convertible_ref_count( (void*)0, shared_ptr_deleter(handle<>(borrowed(source))) ); std::cout << "hold convertible: " << hold_convertible_ref_count; // use aliasing constructor // points to /* T */ data->convertible // share refcount with hold_convertible_ref_count (1) new (storage) shared_ptr<T>( hold_convertible_ref_count, static_cast<T*>(data->convertible)); } /* void */ data->convertible = storage; std::cout << "exit construct\n"; }