C'tors from templates
dsimcha
dsimcha at yahoo.com
Sat Oct 31 13:27:36 PDT 2009
== Quote from grauzone (none at example.net)'s article
> dsimcha wrote:
> > Is there a way to run a class's c'tor on a block of memory from a template
> > function? For example:
> >
> > C newClass(C, CtorArgs...)(CtorArgs args) {
> > // Allocate, initialize.
> > // Want to call the c'tor that takes type CtorArgs.
> > }
> Deeply hidden on the Digitalmars homepage, it hints _ctor() and shows
> how to correctly construct an object (if you're using dmd):
> http://www.digitalmars.com/techtips/class_objects.html
Yeah, I had thought of this, but apparently it doesn't work anymore. This is
called excessive encapsulation--making things so opaque that, when someone really
knows what they're doing and has a good reason to mess around with the internals,
they still can't. I'll file an enhancement requesting that this be put back.
More information about the Digitalmars-d
mailing list