[Issue 23610] std.typecons.Typedef doesn't forward constructors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 9 13:10:33 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23610

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
For anyone else who just wants to "get things done", I use this sort of
workaround:

-----
private struct Vec3(size_t line = __LINE__)
{
    ...
}

// Type aliases for Vec3
public alias Point3 = Vec3!();   // 3D point
public alias Color = Vec3!();    // RGB color
-----

So at least that gives you some type safety.

And that only works for your own user-defined types. But you could use alias
this tricks to wrap existing types. Maybe Typedef does something like this
under the hood. But it's so incomplete it's a pain to use.

--


More information about the Digitalmars-d-bugs mailing list