This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 08/18] malloc: Add specialized dynarray for C strings
On 08/17/2017 11:12 AM, Florian Weimer wrote:
> There is a lot of complexity in this code to maintain the invariant that
> the stored array is NUL-terminated. It also means that the dynarray
> functions must not be used directly.
>
> std::string in C++ has a c_str() method which adds the null termination
> on demand.
Depends on what you mean by C++. std::string::c_str() must not throw
and must be constant time since C++11.
Thanks,
Pedro Alves