How is this code supposed to work?
AndreasDavour
andreas.davour at protonmail.ch
Fri Jan 25 12:09:34 UTC 2019
On Friday, 25 January 2019 at 09:36:24 UTC, rikki cattermole
wrote:
> On 25/01/2019 10:34 PM, AndreasDavour wrote:
>> How am I supposed to use that??
>>
>> auto point3 = getResponse!Point!int("What's the point? ");
>
> auto point3 = getResponse!(Point!int)("What's the point? ");
>
>> auto point4 = getResponse!Point!int("What's the point? ");
>> writeln("Distance: ", point3.distanceTo(point4));
>>
>> generates the error:
>>
>> struct_templates.d(48): Error: multiple ! arguments are not
>> allowed
>> struct_templates.d(49): Error: multiple ! arguments are not
>> allowed
>>
>> Which makes me wonder about the syntax.
I thought about that option, if it was unclear to the parser that
Point!int was the type to instantiate upon. Changing to the other
syntax made me wonder what would happen when getResponse is
calling itself, which in self was something I am a bit unsure of
how to understand. Because we get the same syntax issue there and
it does not seem to work.
More information about the Digitalmars-d-learn
mailing list