C++ Logo

std-proposals

Advanced search

Re: [std-proposals] : std::views::slice

From: Zhihao Yuan <zy_at_[hidden]>
Date: Mon, 01 Apr 2024 22:11:54 +0000
On Monday, April 1st, 2024 at 8:35 AM, Arthur O'Dwyer via Std-Proposals <std-proposals_at_[hidden]> wrote:

> > What do you think? Would it make sense to provide two more variants for views::slice?
>

>

> If you do, they should certainly have "extent" not "end" semantics. This also matches `substr`.


Absolutely no. Paired, consecutive parameters of the same type but different meanings are hostile; we must not repeat this mistake. The consistency argument picked something similar out of context but missed the picture of a consistent expectation. I have no idea how to convince myself that views::indices(3, 10) means {3, 4, ..., 9} but views::slice(3, 10) takes {3, 4, ..., 10, 11, 12}.

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

Received on 2024-04-01 22:12:01