[C++-sig] Whats going on under the hood?

Roman Yakovenko roman.yakovenko at gmail.com
Thu Jan 18 14:58:18 CET 2007


On 1/18/07, David Sveningsson <ext at sidvind.com> wrote:
>
> void add(std::auto_ptr<Base> e){
>      list->add(e.get());
>      print(list);
>      e.release();
> }
> When I instance the class the second time and add it, it crashes when trying to print the content of the list. Most likely because the pointer is corrupt, which means python still did release the instance.
>

Please don't blame Python for your errors. The destructor of
std::auto_ptr<Base> is called
and it deletes the object.


-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list