go
go copied to clipboard
`ReadStringAsSlice` seems to copy the underlying slice.
I may misunderstand the idea behind iter.ReadStringAsSlice. The documentation states:
ReadStringAsSlice read string from iterator without copying into string form. The []byte can not be kept, as it will change after next iterator call.
However, the bytes are actually copied if I'm not mistaken. So I'm wondering why can the returned []byte not be kept longer? Also, would it be possible to have a read without any copying and allocation which returned iter.buf[iter.head:iter.tail]?