C++ Logo

std-proposals

Advanced search

Re: [std-proposals] String Slicing Draft Proposal

From: Zhihao Yuan <zy_at_[hidden]>
Date: Tue, 19 Mar 2024 09:36:12 +0000
On Monday, March 18th, 2024 at 7:59 AM, Jonathan Wakely via Std-Proposals <std-proposals_at_[hidden]> wrote:

>

> I assume the suggestion is that it would be confusing for matrix[x,y]
> to return an element of the matrix, but str[i,j] to return a slice of
> the string. It would be using the same syntax for two different
> things.

I considered this syntax but did not suggest
it for the same reason. Moreover, unlike
Python or MATLAB, we don't have a syntax for
implied bounds (s[i:] and s[:j]), so s[i, j]
doesn't buy you much.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

Received on 2024-03-19 09:36:26