Date: Fri, 20 Mar 2026 01:50:11 +0100
Hello,
I've drafted https://isocpp.org/files/papers/D4102R0.html which argues
that linear containers like `vector` or `deque` (that is, containers
that shift elements around on insertion and erasure) should be allowed
to relocate elements, instead of being forced to use assignments, when
an element is inserted in or erased from the middle.
This was a concern raised by several papers (at least P2959R0, P3278R0,
P3233R0) during the standardization of trivial relocation in the C++26
timeframe. This ultimately led to the "replaceable" keyword/trait, which
was deemed confusing.
In the paper I'm taking a much simpler approach by proposing that
implementations are free to use either assignments or relocations to
shift elements around. There's some complications related to exception
safety but I don't see any particular challenge. (Note that this paper
doesn't depend on any relocation proposal.)
Thank you for any feedbacks,
--
Giuseppe D'Angelo
I've drafted https://isocpp.org/files/papers/D4102R0.html which argues
that linear containers like `vector` or `deque` (that is, containers
that shift elements around on insertion and erasure) should be allowed
to relocate elements, instead of being forced to use assignments, when
an element is inserted in or erased from the middle.
This was a concern raised by several papers (at least P2959R0, P3278R0,
P3233R0) during the standardization of trivial relocation in the C++26
timeframe. This ultimately led to the "replaceable" keyword/trait, which
was deemed confusing.
In the paper I'm taking a much simpler approach by proposing that
implementations are free to use either assignments or relocations to
shift elements around. There's some complications related to exception
safety but I don't see any particular challenge. (Note that this paper
doesn't depend on any relocation proposal.)
Thank you for any feedbacks,
--
Giuseppe D'Angelo
Received on 2026-03-20 00:50:16
