Weird template error message
Paul Backus
snarwin at gmail.com
Fri May 15 21:55:16 UTC 2020
On Friday, 15 May 2020 at 21:40:20 UTC, NaN wrote:
> Stripped down example...
>
> module test;
>
> import std.traits;
>
> auto offsetBy(T,F)(T path, F x, F y)
> {
> alias PathFloat = TemplateArgsOf!T[0];
>
> struct Offseter(Q)
> {
> Q path;
> PathFloat x;
> PathFloat y;
> }
>
> return Offseter(path, cast(PathFloat) x, cast(PathFloat) y);
This line is the problem. Template argument deduction does not
work for constructors; you have to write `Offsetter!T(...)`.
More information about the Digitalmars-d
mailing list