I have a class, which contains a string as a private member. The class has public member functions which all return a const ref to a std::wstring.
All of the const-ref strings being returned are substrings of the private member.
I could store each substring as members, then return const refs to those members, but this is not optimal as it duplicates memory.
Assume that I do store enough memory to know the start and end index of each substring.
How do I implement the above class without copying any of the member string?