[C++-sig] Pyste for class with private destructor

David Abrahams dave at boost-consulting.com
Sun Jun 12 21:27:29 CEST 2005


Ult Mundane <ult at mundane.org> writes:

> Hi there,
>
> I'm just learning to use Boost.Python and Pyste, so I thank you for your 
> patience. I just upgraded Pyste to the current CVS sources (from Boost 
> 1.32).
>
> In 1.32, Pyste would not export a copy constructor if the class didn't 
> declare one, even though the compiler would create an "artificial" copy 
> constructor. Using the current CVS version, Pyste will export the copy 
> constructor. This solves the problem I was having with a simple class 
> that I wanted to be able to copy in Python.
>
> However, it uncovered a new issue for me. In the case that the class's 
> constructors or destructor are private, exporting the class causes an 
> error in value_holder.hpp when compiling the generated cpp file.
>
> My intention is to create a class that is instantiated on the c++ side, 
> and referenced (but never copied or destroyed) on the Python side. 
> Perhaps I'm using the wrong approach. Should I be using a shared_ptr, or 
> wrapping the class?

Did you read the thread entitled "wrapping a Singleton class" from
today?  Does following that example help?

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




More information about the Cplusplus-sig mailing list