as suggested by this post: Split a string in C++?
there are many ways to split a string, but whose performance is best ?
is there any benchmark on this test ?
as suggested by this post: Split a string in C++?
there are many ways to split a string, but whose performance is best ?
is there any benchmark on this test ?
To maximize your chance of a Very Fast Implementation™ you should use a substring creation operation that has constant time. One way to do that is to ensure that the original string exists and is not modified over the lifetime of the substring references. You can then represent each substring as e.g. two pointers, or as a pointer and a length, or as whatever suits the particular context.
For an unusual context example that allows a perhaps surprising substring representation, when the original string is discardable and the substrings can be C style zero-terminated strings,then you can replace substring delimiters in the original string with null bytes, and then a substring can be represented as e.g. a single pointer.
Anyway, in the end you will just have to MEASURE.