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

David Abrahams dave at boost-consulting.com
Tue Dec 14 21:41:02 CET 2004


Paul F. Kunz wrote:
>>>>>> 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.

No, that's wrong.  That line is supposed to call the exposed copy ctor.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com




More information about the Cplusplus-sig mailing list