[C++-sig] class registration - bug or feature?

David Abrahams dave at boost-consulting.com
Fri Jul 7 18:04:45 CEST 2006


"Roman Yakovenko" <roman.yakovenko at gmail.com> writes:

> On 7/7/06, David Abrahams <dave at boost-consulting.com> wrote:
>> "Roman Yakovenko" <roman.yakovenko at gmail.com> writes:
>>
>> > Hi. Please take a look on next code
>> >
>> > struct X{
>> >     void do_smth();
>> > };
>> >
>> > class_<X>("X");
>> >
>> > class_<X>("X")
>> >     .def( "do_smth", &X::do_smth );
>> >
>> > Boost.Python reports a warning while registering class X second time:
>> > "to-Python converter for struct X already registered; second
>> > conversion method ignored."
>> > But, indeed Boost.Python continues to register the class - I mean,
>> > that Boost.Python adds functions to the already registered class.
>>
>> That's not the same as registering it again.
>>
>> > My question: is this a bug or it is a desired behaviour?
>>
>> Desired.  Or at least, expected.  There's been nothing better
>> proposed.
>
> I just wanted to know whether I can write program that uses this feature or not.

Oh, I suppose that you can, but I don't know why you'd want to.  Why
not just apply ".def" to the same object?

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




More information about the Cplusplus-sig mailing list