Date: Tue, 26 Mar 2024 13:03:25 +0100
Then perhaps focus in the naming on the different parameter instead of that it could be a view:
substr_fromto or substr_upto?
-----Ursprüngliche Nachricht-----
Von:Rhidian De Wit via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Di 26.03.2024 12:36
Betreff:Re: [std-proposals] String Slicing Draft Proposal
An:std-proposals_at_[hidden];
CC:Rhidian De Wit <rhidiandewit_at_[hidden]>; Giuseppe D‘Angelo <giuseppe.dangelo_at_[hidden]>;
Hi,
It returns a view in case it is called on a std::string_view, but a std::string returning a std::string_view could lead to far more confusion, since a string_view cannot be used in the same way as a string.
If the user wants a string_view, they can either explicitly construct a string_view from the returned std::string, or they can call .subview() from a string_view.
It is possible that someone uses subview() instead of substr() and might be confused by the displayed behaviour, but that is then on the end-user to check documentation and see what .subview() actually does.
Sincerely,
Op di 26 mrt 2024 om 11:46 schreef Giuseppe D'Angelo via Std-Proposals <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]> >:
Hi,
On 26/03/2024 09:57, Rhidian De Wit via Std-Proposals wrote:
> My apologies, I accidentally uploaded an older version, the correct
> version can be found in the attachments:
I'm really unsure about this last revision: now you have
std::string::subview which:
* does not return a view (so why is it called sub *view*?);
* has different parameters than the existing *sub*str() despite the very
similar name, so it has a huge surprise factor if one thinks it takes
pos+count (like substr does).
My 2 c,
--
Giuseppe D'Angelo
--
Std-Proposals mailing list
Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
--
Rhidian De Wit
Software Engineer - Barco
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2024-03-26 12:03:27