C++ Logo

std-proposals

Advanced search

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

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Mon, 13 May 2024 11:06:14 +0200
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

Received on 2024-05-13 09:06:19