
On Thu, 25 Sept 2025 at 17:15, Peter Dimov via Boost <boost@lists.boost.org> wrote:
You need strlen for more than size(). It's also needed in end(), operator[], at(), remove_prefix, substr (both overloads), the find functions taking a start offset, back(), actually everything taking a start offset, ends_with, and probably others as well.
If the purpose of the class is to provide the functionality of a c string, then the only required methods are those available on a c string: - data - array indexing - length There is no need for any string manipulation. In C++,.the correct class for string manipulation operations is a std::string There is a reasonable argument that you may want begin() and end() iterators, maybe. But it's reasonable to write end() in terms of strlen(), because it's unlikely that a sane program will need to call end() more than once, and also unlikely that it will need to call both end() and size(), when dealing with a c string. Computing the length of a string with strlen() is very high performance for anything other than an extremely long string. I don't think this thing needs to be over-engineered. I am of the view that providing a full std::string interface is an utter waste of time and effort. R
_______________________________________________ Boost mailing list -- boost@lists.boost.org To unsubscribe send an email to boost-leave@lists.boost.org https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/boost@lists.boost.org/message/TFKGXSRI...