Hello,
I need to store some user data in an object, but I don't know what is the
object's type at compile time. I need to store those wrappers in a `seq`, but I
don't know a wrapper's generic type, as it's specified by the user.
What would be the best, safest solution to achieve this? I'd like to point out
that I know what kind of user data is stored in the wrapper, so the user won't
even notice the wrapper – plain data will be passed to them.
Example:
type
Wrapper[T] = object
userData: T
# this won't work, as ``Wrapper`` has to have a generic type annotation
var wrappers: seq[Wrapper]
Run
Should a `pointer` be used in this situation? Or is there a safer alternative?