Fix template parameter
Nick Treleaven
nick at geany.org
Wed Aug 10 09:20:49 UTC 2022
On Wednesday, 10 August 2022 at 06:15:39 UTC, Dom Disc wrote:
> Ok, then I consider this is a bug in Phobos that should be
> corrected.
>
> All instances of
>
> ```D
> foo(T : fixedType)(T x) { }
> ```
> should be replaced by
>
> ```D
> foo(fixedType x) { }
> ```
Perhaps, but not necessarily. The body of foo could do
introspection on T with static if or overloaded functions and
produce specialised code. Even if foo doesn't do that, perhaps
the author reserves the right to do that in future.
Or perhaps it needs to be a template to infer attributes. For
that case, using an empty template parameter list would be
clearer.
More information about the Digitalmars-d-learn
mailing list