Exclamation symbol "!" within functions syntax
pascal111
judas.the.messiah.111 at gmail.com
Mon Aug 1 11:35:25 UTC 2022
On Wednesday, 27 July 2022 at 11:09:19 UTC, Ali Çehreli wrote:
> On 7/27/22 04:00, pascal111 wrote:
>> I noticed more than once that the exclamation "!" is used
>> within functions typing, and it seems like an operator with
>> new use, for example "to!int()", ".tee!(l => sum +=
>> l.length)", "enforce!MissingArguments...", so what dose it
>> means?
>>
>
> The binary ! operator is used for specifying template
> arguments. I have some explanation here:
>
>
> http://ddili.org/ders/d.en/templates.html#ix_templates.!,%20template%20instance
>
> Ali
I noticed that filter is using the concept of templates but this
time it's with a lambda function, not with a data type, how can
we explain this? isn't supposed to use a data type after the
exclamation mark: "auto r = chain(a, b).filter!(a => a > 0);"
https://dlang.org/phobos/std_algorithm_iteration.html#.filter.filter
More information about the Digitalmars-d-learn
mailing list