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

David Abrahams dave at boost-consulting.com
Fri Jul 7 21:06:11 CEST 2006


"Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> writes:

> --- Roman Yakovenko <roman.yakovenko at gmail.com> wrote:
>
>> Boost.Python already provides the mechanism, that resolves the problem
>> - def_visitor, but the changes I have to make to code generator are
>> too big.
>> I can not commit my self to this task :-(. So, I just searched for work
>> around.
>> This one seems to be the perfect one, and I need only few hours to implement
>> it.
>
> David, would it be feasible to formalize this approach? I had situations, too,
> in which it was quite inconvenient to drag around the class_<X> object. It
> would be nice to be able to do something like this:
>
> file1.cpp
>
>   class_<X, bases<Y>, shared_ptr<X>, noncopyable>("X");
>
> file2.cpp
>
>   registered_class<X>()
>     .def("foo", &X::foo)
>   ;
>
> I.e. the new thing here would be registered_class<>, where I don't have to
> repeat bases, holder, etc. It would be my responsibility to make sure the
> primary class_<> is processed (at runtime) before registered_class<>.

Yes, I think that's feasible.

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




More information about the Cplusplus-sig mailing list