On Sunday, 18 June 2023 at 19:22:45 UTC, Paul Backus wrote:

No, there is no way to pass template arguments to a constructor without using `__ctor`.

My recommendation is to use a free function or a `static` method instead. For example:

```d
import std.stdio;

struct Test {}

Test makeTest(string type = "def")(string reg_arg)
{
    writeln("reg_arg: ", reg_arg);
    return Test();
}

void main()
{
    auto test = makeTest!"non_def"("Hello");
}
```

Thank you! This will make me change the design of my API a little bit but it will do ;)

Reply via email to