[C++-sig] Re: Re: sub module support in V2
Dave Hawkes
daveh at cadlink.com
Mon Jun 10 21:53:12 CEST 2002
"David Abrahams" <david.abrahams at rcn.com> wrote in message
news:01ee01c210ae$83206f10$6601a8c0 at boostconsulting.com...
>
> 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)
> ;
>
>
> which nicely enforces the existence of c before ctest2 is declared.
>
This is probably straight forward as well, maybe I'll code it and see if
there are in wrinkles when I do a few tests.
> > This could be achieved as once a particular class has been registered we
> can
> > find its object from the typeinfo, rather than by name.
>
> Why do you prefer your second approach? Seems messier than the first to
me.
It just seemed to be consistent with defining other attributes of a class
such as member functions and member variables.
More information about the Cplusplus-sig
mailing list