C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Adding a .slice() method to std::basic_string

From: David G. Pickett <dgpickett_at_[hidden]>
Date: Wed, 13 Mar 2024 20:47:33 +0000 (UTC)
What is wrong with std::string::substr()? Should substr() be changed to allow missing features like negative index for from-end?
I suppose it would just be extended syntax / alternative signature on the string.operator[]() taking a string with textual slicing operators. I am not fond of numbers passed in text, being a speed obsessed power user! Since Python is interpreted or JIT compiled, parse cost is less a concern there. Could the compiler digest the strings, when constant, to save parsing integers from ASCII at run time, maybe making it into a call to string::substr()?

Received on 2024-03-13 20:47:39