"Value class instance" pattern?
Benjamin Thaut
code at benjamin-thaut.de
Sun Jul 14 06:11:29 PDT 2013
Am 14.07.2013 14:03, schrieb bearophile:
> Benjamin Thaut:
>
>> I just noticed that this still does not work. Even with dmd 2.063 I
>> get the error message:
>>
>> main.d(28): Error: template
>> main.ComposeClass!(Object).ComposeClass.__ctor(Targs...)(Targs args)
>> conflicts with constructor
>> main.ComposeClass!(Object).ComposeClass.this at main.d(20)
>>
>> If you have a templated constructor you can't have any non templated
>> constructors. (http://d.puremagic.com/issues/show_bug.cgi?id=4749)
>> So a version with a templated constructor is still not doable at the
>> moment.
>
> Sorry, I forgot to say that I am using this:
>
> this()(UseDefaultCtor) {
> classInstanceBuf[] = typeid(T).init[];
> _instance.__ctor;
> }
>
> Bye,
> bearophile
This still doesn't work for me. The compiler (2.063.2) will tell me that
it conflicts with
@disable this();
Does this actually work for you?
Kind Regards
Benjamin Thaut
More information about the Digitalmars-d
mailing list