C++ Logo


Advanced search

Re: [std-proposals] String Slicing Draft Proposal

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Tue, 19 Mar 2024 19:05:53 +0100
What about   s[{i, j}]   ? It could be extended to   s[{i, j}, {k, l}]   for multi-dimensional arrays.     -----Ursprüngliche Nachricht----- Von:Breno Guimarães via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Di 19.03.2024 18:55 Betreff:Re: [std-proposals] String Slicing Draft Proposal An:std-proposals_at_[hidden]; CC:Breno Guimarães <brenorg_at_[hidden]>; For what it's worth, I strongly disagree with "s[i, j] seems actively bad". I think the level of confusion with this syntax will be minimal. I would be very surprised if developers try to "multi-index" into a string (which doesn't even make sense) and are surprised that it doesn't work.  Several operations in C++ have the same syntax and slightly different meanings. And several operations have drastically different meaning (like operator * and multiplication). Another example is operator/ for std::filesystem::path. I don't recall seeing angry developers complaining that / is not dividing their path but appending. It's all about the context.  Best Regards, Breno G.  

Received on 2024-03-19 18:05:55