[C++-sig] Delete objects, remove from dict

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Mon Oct 25 19:07:18 CEST 2010


Oh, at second glance...



> >             object obj = mMainNamespace[ name.c_str()  ];
> >            obj.del();

This cannot work!
You need to do it the way I showed before.

mMainNamespace[ name.c_str()  ].del();

The [] operator returns a proxy object which supports the del since
it still knows what the target object is. Once you've assigned the
proxy object to boost::python::object the target information is lost.

Ralf


More information about the Cplusplus-sig mailing list