C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Attaching and detaching memory from std::vector or std::string

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 02 Jan 2024 09:07:15 -0300
On Monday, 1 January 2024 20:52:43 -03 Tom Honermann via Std-Proposals wrote:
> The ability to transfer allocated memory between std::vector,
> std::string, and other contiguous container/string types was discussed
> in LEWG and SG16 back in 2018 in the context of P1072
> (basic_string::resize_and_overwrite) <https://wg21.link/p1072>. No
> consensus for a design emerged at that time but I think a well
> researched paper that includes motivation based on real world use cases
> would have a good chance of being adopted. Any such paper would ideally
> compare and contrast the proposed design with the existing node handle
> support added for associative containers in C++17 (I tend to think of
> std::vector and std::string as being single-node containers; which
> differs from other random-access containers like std::deque).

FYI, we have not implemented sharing of memory between QByteArray, QString and
QVector (a.k.a. QList), but one thing we have implemented is that QString can
"gift" its memory to QByteArray upon conversion in toLatin1() &&.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2024-01-02 12:07:18