C'tors from templates

grauzone none at example.net
Sat Oct 31 13:10:39 PDT 2009


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



More information about the Digitalmars-d mailing list