Template functions, can we make it more simple?

SteveGuo steveguo at outlook.com
Fri Aug 2 16:20:02 PDT 2013


> 	class A
> 	{
> 		auto b(auto c) { ... }
> 	}
>
> What are the template parameters of A?

class A
{
      void foo(auto x) { ... }
}

int main()
{
     scope a = new A;

     a.foo(1); // this means A has a member function "void foo(int 
x) {...}"
     a.foo(1.1); // this means A has another member function "void 
foo(double x) {...}"
     // compiler will automatically build two versions of function 
"foo"
}


More information about the Digitalmars-d mailing list