A look inside "filter" function defintion

frame frame86 at live.com
Wed Aug 3 03:10:25 UTC 2022


On Tuesday, 2 August 2022 at 14:58:52 UTC, pascal111 wrote:

>> Maybe this helps:
>>
>> A template can be seen as a static struct too, so you can 
>> access its members with the scope operator "." and if there is 
>> only one member of the same name as the template ifself, the 
>> compiler auto completes it to this member.
>>
>
> I guess you mean if we will understand the templates concept as 
> a static struct that the template is like the struct or - 
> "records" in Pascal - that preserve its members values each 
> time of calling through the runtime because they are "static". 
> Isn't like that or what do you mean?

I don't know anything about Pascal - I can only say that the 
template scope can be seen like that from a logical point of view.

A function defined in a template is a static member of that 
template but not necessarily static context in runtime. It 
depends on the usage and scope.

But most library functions in Phobos are very simple like that 
and you have just to know that most functions are templates. They 
just may not require template arguments to be supplied and others 
do.



More information about the Digitalmars-d-learn mailing list