[C++-sig] Re: abstract templates and pyste question.

Nicodemus nicodemus at esss.com.br
Wed Feb 18 23:19:07 CET 2004


Hanz Meizer wrote:

> Hi,
>
> While investigating, I found something strange:
>
> I've got two classes, both are abstract, the base class is a regular 
> class, the derived class is a template. The base has a private copy 
> constructor (which is empty). The derived one has no copy constructor 
> declared. The whole construct didn't pythonize, since pyste declares a 
> wrapper for the derived class that calls the base copy constructor 
> (which is private). Obviously (?), C++ avoids calling the private base 
> copy constructor from the implicitly generated derived copy 
> constructor (that's my explanation, maybe this is not true. Who 
> knows?). Maybe this only holds true for templates. Anyways, I solved 
> this special issue by inserting a private copy constructor (that is 
> defined empty) in the derived template.
>
> Is this a known thing? What if the include files were write only fo me 
> and I couldn't modify them? After all, in C++ this kind of setup is 
> working, just th generated wrapper seems to make false assumptions.
>

Hmm... I couldn't reproduce the error. I tried this:

struct Abstract
{
private:
    Abstract(const Abstract&) {}
public:   
    virtual int getSize() = 0;
};


struct Derived
{
    virtual int getSize() = 0;
}; 

But this generates a wrapper that compiles fine. Perhaps you can post a 
working example?

Regards,
Nicodemus.





More information about the Cplusplus-sig mailing list