[C++-sig] Re: abstract base class

David Abrahams dave at boost-consulting.com
Sat Nov 23 00:09:10 CET 2002

"Mike Rovner" <mike at bindkey.com> writes:

> "Nicolas Lelong" <n_lelong at hotmail.com> wrote in message
> news:DAV39n1YcEBdyFj9ZYh00008290 at hotmail.com...
>> Hi
>> > [...]
>> > class_<LayerOperation>("Operation", no_init);  // line 169
>> You should try :
>>     class_<LayerOperation, boost::noncopyable>("Operation", no_init);
>> It works for me :)
>> Hope this helps,
> Thank you. That works for me too ;)
> But I'm curious
>  (a) why that happened?

Because if you don't tell it that LayerOperation is noncopyable,
Boost.Python tries to register a converter for handling wrapped
functions which handle function return values of type
LayerOperation. Naturally, this has to be able to copy construct the
returned LayerOperation object into storage that can be managed by a
Python object. Since your LayerOperation is an abstract class, that

>  (b) error message is inadequate.

I guess that's not a question. Well, I'm truly sorry, but the control
we poor C++ library writers get over the error messages emitted by
your C++ compiler is limited at best.

                       David Abrahams
   dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

More information about the Cplusplus-sig mailing list