[C++-sig] Re: Making copy of function derived from C++ pure virtual function

Paul F. Kunz Paul_Kunz at slac.stanford.edu
Tue Dec 14 18:36:27 CET 2004


>>>>> On Sun, 12 Dec 2004 22:26:21 -0500, David Abrahams <dave at boost-consulting.com> said:

> Paul F. Kunz wrote:
>> This clone function doesn't quite work ...
>> 
>> FunctionBase* clone() { PyGILState_STATE state = PyGILState_Ensure
>> (); object py_result;
>> 
>> if (override clone = this->get_override("clone")) { // The Python
>> class author overrode clone; do // whatever she says py_result =
>> clone(); } else { object self = get_owner(this);
>> 
>> // Find its most-derived Python class object my_class =
>> self.attr("__class__");
>> 
>> // call the copy ctor through Python.  
>> py_result = my_class(self);

   The line above was the problem   It should be

   py_result = my_class();

i.e., no arguments.

Thanks Dave for your help and patience with me.



More information about the Cplusplus-sig mailing list