Hi, i wanted to create a seq from my own buffer but copy is happening, even with cast which is not supposed to. so are there any other way to do it?
testing this on devel
var str = "abc"
prepareMutation(str)
var sequence = cast[seq[char]](str)
str[0] = 'x'
echo str , " : ", sequence
# xbc : @['a', 'b', 'c']
Thanks for help
The cast doesn't copy, the binding to the var does. See for yourself:
var str = "abc"
prepareMutation(str)
var sequence {.cursor.} = cast[seq[char]](str)
str[0] = 'x'
echo str , " : ", sequence