C++ Logo

std-proposals

Advanced search

Re: [std-proposals] .first() and .last() in strings

From: Rhidian De Wit <rhidiandewit_at_[hidden]>
Date: Tue, 14 May 2024 08:43:37 +0200
Thank you for your useful insights! The proposal on *substr() &&* was an
interesting read!
I've now updated the proposal.

Sincerely,


Op ma 13 mei 2024 om 11:06 schreef Giuseppe D'Angelo via Std-Proposals <
std-proposals_at_[hidden]>:

> Hi,
>
> Il 13/05/24 09:29, Rhidian De Wit via Std-Proposals ha scritto:
> > Hi,
> > Here is the latest version of my proposal, and I wonder, how do I now
> > continue with this proposal? Do I email for an official number?
>
> Couple of minor comments:
>
> * first/last for basic_string can't be noexcept (they need to allocate);
>
> * just like basic_string::substr, first/last need an overload for rvalue
> *this (see P2438R2);
>
> * I'm actually a bit surprised that the existing `substr() &&` overload
> is not noexcept. Is there any reason for that? Yes, it calls the
> `basic_string(basic_string &&, size_t pos, Allocator)` constructor which
> isn't noexcept, but this just raises the question as of why there isn't
> a `basic_string(basic_string &&, size_t pos) noexcept` constructor.
>
> * in the wording there is no need of spelling out the template
> parameters for the return type. Instead of
>
> > constexpr basic_string_view<charT, traits> first(size_t count) const
> noexcept
>
> use
>
> > constexpr basic_string_view first(size_t count) const noexcept
>
> (mut.mut. for the rest)
>
>
> My 2 c,
>
> --
> Giuseppe D'Angelo
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>


-- 
Rhidian De Wit
Software Engineer - Barco

Received on 2024-05-14 06:43:52