The place where using the std::string would be preferable, I'd say is where we don't make use of a memroot to automatically take care of memory allocations. This is indeed rare however.
Another interesting alternative is when we copy the string a few times. We talked about the move semantics in Germany. Using a std::string might allow the compiler to optimise such copies as it has optimisations specifically tailored for std::string.
Another problem with LEX_STRING and it's derivatives is that we do not actually enforce const-ness during compile time.
f(const LEX_STRING* s) {
s->str[1] = 'b';
}
This function compiles perfectly but the const parameter does not help in detecting this bug. I agree that this kind of code clearly "smells", but it is another thing we need to watch out for.
When considering ownership of a string, it is sometimes unclear if we own the string or not and you need to check the caller to understand where the string parameter actually comes from.
For the use-case I mentioned, we can do just fine without std::string, but I do think that std::string could potentially replace most of our in-house strings, with the added benefit of handling memory allocations, where memroot might not be an option and having the extra type safety that comes with using it.
Regards,
Vicentiu