Mine are similar, except I don't make any guarantees about null-terminators existing within my code. They may, inadvertently be copied in from cstring, but I never assume them.
Having functions that return views and ones that returns owned strings seems troublesome to keep track off.
I moved all ownership concerns to the caller and their provided allocator to avoid that and it's working quite well.
string literal are immutable if you edit it you get UB how do you solve that ?
Had the same issue.
What I did is that I stored positions where the string string started and the string length.
That way there is no way a string can access the memory directly.
Mine are similar, except I don't make any guarantees about null-terminators existing within my code. They may, inadvertently be copied in from cstring, but I never assume them.
Having functions that return views and ones that returns owned strings seems troublesome to keep track off.
I moved all ownership concerns to the caller and their provided allocator to avoid that and it's working quite well.