Static function template

Daniel Kozák via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 7 03:38:55 PDT 2015


On Thu, 07 May 2015 10:33:44 +0000
Vadim Lopatin via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:

> struct S
> {
>      int i;
> 
>      auto foo2(T)(int j) {
>          i=j;
>      }
> 
>      static S foo(T)(int j) {
>          S s;
>          s.foo2!T(j);
>          return s;
>      }
> }
> 
> void main()
> {
>      auto s = S.foo!bool(1);
> }

As I said, it is not bug. It is OK. There is no way how you can
distinguish between static and non static methods or even field in some
cases.


More information about the Digitalmars-d-learn mailing list