This question refers to v0.7.
I have an ex ante known number n of integers 0 \le \ldots \le 127, which are computed from something (I can make an iterator). They represent a string (of ASCII characters).
The number of characters is small (1 to 8). I am looking for a fast way to construct a String
.
I can build up a Vector{UInt8}
, but I am unsure if String(::Vector{UInt8})
copies, or if I need to do something special to make it not copy, eg somehow guarantee that the vector does not share structure.
Example:
# imagine I have an iterator with HasLength() and HasEltype(), latter is UInt8
iter = (i for i in UInt8.(97:99))
# does this copy the result of collect? it is unclear to me.
String(collect(iter))```