[Bug libstdc++/87106] Group move and destruction of the source, where possible, for speed
glisse at gcc dot gnu.org
Thu Oct 25 16:37:00 GMT 2018
--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Arthur O'Dwyer from comment #4)
> Have you seen my libc++ patch on the same topic as yours?
I am not sure I should look too closely for copyright reasons. Maybe I can... I
did read the papers though.
> Specifically, the piece that I think is still missing from libstdc++'s
> implementation (besides all the cool stuff that you'd get from the
> attribute) is the trait `__has_trivial_construct<A, T, T&&>`.
I already filed Bug 87604 for that.
> This trait
> allows you to write your `__relocate_a_1` generically, instead of
> special-casing it for `std::allocator<T>` in particular. (So for example it
> could also get picked up for `std::pmr::polymorphic_allocator<T>`...
I am not particularly interested in polymorphic_allocator. The patch is still
missing more important pieces, like the ability to actually specialize
__is_trivially_relocatable (I already have another patch locally with the
> I hope we get P1144 so that you don't have to waste time and brain cells
> specializing `__is_trivially_relocatable<T>` for std::string and std::pair
> and so on.
std::string is not trivially relocatable in libstdc++, so I won't waste any
time there. IIRC, one difference with what you did is that I use relocation
even for some types that are not trivially relocatable (in particular
std::string), because it actually helps, as shown in the first message of this
> Complete tangent: I'm confused how vector.tcc is allowed to use "if
> constexpr" in C++11 mode.
It is enabled as an extension and produces a warning which is disabled in
More information about the Gcc-bugs