On Friday, 17 June 2022 at 12:53:53 UTC, bauss wrote:
Just add a constructor to your type that takes the value of what you want to convert.Working example: ```d struct Foo { int value; this(int v) { value = v; } this(string v) { this(to!int(v)); } } void main() { auto foo = to!Foo("123"); writeln(foo.value); } ```
D is full of good surprises. Thanks.