[C++-sig] set python attribute from C++

Gennadiy Rozental rogeeff at gmail.com
Thu Jul 17 20:31:37 CEST 2008


David Abrahams <dave <at> boostpro.com> writes:
> > Is there some some strong underlying reason why 
> > it's can't be designed to support it?
> 
> There are 2 "it"s in that sentence and I can't 
> tell what either one refers to.

Why can't intrusive_ptr be designed to support he 
same set of feature as shared_ptr?


> > What will happened with memory? 
> 
> I don't understand the question. Could you be specific?
> 
> > Or custom deleter will somehow make it right?
> 
> It will be right.  It Just Works (TM)

So you are saying that if I export my class like this:

class_<A,A*,...>

I can still write function foo like this:

void foo( shared_ptr<A> obj )
{
    bp::object pyobj( obj );
    ...
}

And it will not call A destructor at the end of 
function, right? Plus pyobj will be of correct 
python type if obj type is actually one derived
from A in python, right?


Gennadiy





More information about the Cplusplus-sig mailing list