Feature request - simpler constructors

Christian Kamm kamm.incasoftware at shift-at-left-and-remove-this.de
Sat Sep 22 03:08:20 PDT 2007


Jarrett Billingsley wrote:
> class A
> {
>     int x, y, z;
>     float w;
> 
>     mixin AutoCtor;
> }
>
> Templates are just.. too cool.

Yes, but unfortunately template mixin constructors will not overload with
other constructors. With normal functions you can use alias to work around
it, but for constructors

mixin AutoCtor myautoctor;
alias myautoctor.this this;

fails. I think you will have to use string mixins to make this work right...

Christian



More information about the Digitalmars-d mailing list