[C++-sig] Re: Re: sub module support in V2

Dave Hawkes daveh at cadlink.com
Tue Jun 11 03:48:46 CEST 2002


"David Abrahams" <david.abrahams at rcn.com> wrote in message
news:01ee01c210ae$83206f10$6601a8c0 at boostconsulting.com...
> >     class_<ctest::ctest2>()
> >         .def_init()
> >         .def_readwrite("n", &ctest::ctest2::n);
>
> I guess I didn't make myself clear earlier. I was suggesting
>
>     class_<ctest> c("ctest")
>         .def_init()
>         .def("set_v", &ctest::set_v);
>         ;
>
>     class_<ctest::ctest2>("ctest2", c)
>         .def_init()
>         .def_readwrite("n", &ctest::ctest2::n)
>         ;
>
I was just taking a deeper look at this and realised one slight problem. The
class_ constructor that takes no arguments and attempts to find its name
from the typeid will be unfortunate when it is extended in this way.

ie

    class_(class_<...>& c);

Of course this will look like a duck, walk like a duck and bark like a
dog...

This probably means putting in some superfluous argument so it doesn't look
like a copy constrctor.

Dave Hawkes










More information about the Cplusplus-sig mailing list