I deal with giant (up to 2 GB) strings and their slices in a C ++ program. C-style lines seem unreliable under such circumstances, but can be cut trivially (without "\ 0" at the end). On the other hand, as I understand it, std :: string :: substr copies the slice, so I have to perform at least one additional add operation (index + base) for indexing, so that rational use of memory.
source share