https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #11)
> Maybe
>
> _GLIBCXX20_CONSTEXPR
> basic_string&
> assign(const _CharT* __s)
> {
> __glibcxx_requires_string(__s);
> return _M_replace(size_type(0), this->size(), __s,
> traits_type::length(__s));
> }
>
> isn't the most efficient way to assign a string (constant) looking at
For string constant sure, but unless we know that __s points to a string
literal, we need to do those overlap checks I'm afraid.
Or is something like:
void g (std::string& s)
{
s = s.c_str() + 16;
}
invalid if s is before known to contain a string longer than 16 chars?