My first reaction when I've read your comment was that it has to be because of sub-strings but as std::vector allocates memory again anyway that can't be too important. Can you elaborate a bit? I am not a C++ programmer but I am sometimes curious so maybe I am missing something obvious.