On Tuesday, 13 September 2022 at 08:43:45 UTC, Nick Treleaven
On Tuesday, 13 September 2022 at 03:00:17 UTC, Kyle Ingraham
Any suggestions for being able to call one function for any
instance given but maintain flexible return types?
Not sure if it helps, but you can define final methods in an
interface, which can call virtual interface methods:
final T toD(T)()
import std.conv : to;
Not tested as AFK.
Thanks for the suggestion Nick. I solved this by storing structs
as `void*` in a wrapper struct with information about their
module and identifier saved elsewhere. I use that information to
setup casts to the appropriate type then call `toD`. That way I
can call the same method for functions that return different
types and store disparate structs to the same wrapper struct. The
wrapper struct gets used in function signatures.