These days it is possible that toOpenArray will also be handy to avoid copies.
It is untested idea.
The link was indeed very helpful, so I used the following:
>From T to string:
result = ""
var t: T
var fromTtoString = cast[ptr array[sizeof(T), char]](unsafeAddr(t))[]
for c in fromTtoString: result.add(c)
Run
>From string to T:
var
Thanks, that's exactly what I needed!
see: [https://forum.nim-lang.org/t/2626](https://forum.nim-lang.org/t/2626) for
a similar question.
Assuming I have a string
var x = ""
Run
of length 16. I want to read the chars "" as int32, the chars "" as
int64 and the chars "" as int32.
What would be the most performant way to read these 3 slices into the int types
if I know