[C++-sig] [Boost.Python] imports and callbacks

David Abrahams dave at boost-consulting.com
Fri Nov 17 16:04:37 CET 2006


Tanguy Fautre <tanguy.fautre at spaceapplications.com> writes:

> One little catch though, if you read Boost.Python doc (cf. URL below), 
> you would think that
>
> python::dict a;
> python::dict b(a);
>
> creates two separate dictionaries, while in fact b is still a reference 
> to a. To do it correctly, I had to do
>
> python::dict a;
> python::dict b(a.copy());

I think 

  python::dict b(object(a));

should also work.  I *think* the copy ctor is different from all the
other ctors.  Of course it must make such a copy in order to preserve
reference semantics when passing these objects around.

> This maybe needs to be clarified in Boost.Python documentation ?

Probably.  Joel?


> http://boost.org/libs/python/doc/tutorial/doc/html/python/object.html

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list