Casting from a string to a custom Typedef type is more complicated than it should be. To should actually care about the underlying typedef-type, and recognize that it has to parse a string to a long value:
alias QuestionId = Typedef!(long, long.init, "QuestionId");
QuestionId q = to!(TypedefType!QuestionId)("43"); // Compiles
QuestionId q2 = to!QuestionId("43"); // Error..
Forum:
http://forum.dlang.org/thread/[email protected]
togrue
Comment #1 by robert.schadek — 2024-12-01T16:25:45Z