Fix template parameter

Steven Schveighoffer schveiguy at gmail.com
Mon Aug 8 13:32:44 UTC 2022


On 8/8/22 8:02 AM, Dom Disc wrote:
> Hello.
> I found in the documentation functions declared like this:
> 
> ```D
> pure @nogc @safe BigInt opAssign(T : BigInt)(T x);
> ```
> 
> What is the difference to declaring it like:
> 
> ```D
> pure @nogc @safe BigInt opAssign(BigInt x);
> ```
> 
> To me the first declaration seems to be unnecessarily bloated, so I ask 
> myself: does it provide any kind of advantage? I can't see it.
> 

Just a guess, but there was a time in the distant past when you could 
not overload template functions with regular functions. Perhaps that's why?

Otherwise, no there really isn't a difference in this case.

-Steve


More information about the Digitalmars-d-learn mailing list