delegate as memeber
Timon Gehr
timon.gehr at gmx.ch
Sat Feb 25 10:29:55 PST 2012
On 02/25/2012 07:23 PM, Artur Skawina wrote:
> On 02/25/12 15:37, Timon Gehr wrote:
>> On 02/25/2012 03:32 PM, Stewart Gordon wrote:
>>> On 21/02/2012 17:46, Jacob Carlborg wrote:
>>>> On 2012-02-21 16:55, deadalnix wrote:
>>> <snip>
>>>> You can implement a static opCall and use that instead of the
>>>> constructor.
>>>
>>> But you don't have to call a static opCall. You can just declare a
>>> struct instance without any initialisation. Presumably half the point is
>>> to ensure that exceptionBuilder is still initialised in such cases.
>>>
>>> Stewart.
>>
>> struct exceptionBuilder{
>> @disable this();
>> @disable enum init=0;
>> static exceptionBuilder opCall(...){...}
>> }
>
> Too bad this doesn't work when opCall takes args.
>
> IOW, "S(2)" results in
>
> Error: constructor m.S.this () is not callable using argument types (int)
> Error: constructor m.S.this is not callable because it is annotated with @disable
> Error: expected 0 arguments, not 1 for non-variadic function type ref S()
>
> Removing the disabled 'this()' makes the error go away and the right
> opCall() gets called.
>
> artur
Well, that is a bug.
http://d.puremagic.com/issues/show_bug.cgi?id=6036
More information about the Digitalmars-d-learn
mailing list