[C++-sig] Injected constructors

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Wed Jul 23 18:47:50 CEST 2003


--- David Abrahams <dave at boost-consulting.com> wrote:
>           .def("__init__", init_factory(x_factory))

I don't like the "init" duplication. Would this be possible?

.def(init_factory(x_factory))

This would also make sense to me:

.def("__init__", factory(x_factory))

But I like the first alternative better because it is more formal
and prevents frustrating debugging sessions due to stupid typos
like .def("_init__", factory(x_factory)).

Yet another idea:

.def_factory(x_factory)

It means expanding the class_<> interface, but I think the purpose
is unique enough to warrant the additional member function.

Ralf


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com




More information about the Cplusplus-sig mailing list