https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87106

--- 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?
> 
> https://quuxplusone.github.io/blog/2018/07/18/announcing-trivially-
> relocatable/
> https://github.com/Quuxplusone/libcxx/tree/trivially-relocatable/include

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
missing piece).

> 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
bug report.

> Complete tangent: I'm confused how vector.tcc is allowed to use "if
> constexpr" in C++11 mode.
> https://github.com/gcc-mirror/gcc/commit/e9f84d4c#diff-
> 05b068171cedf9d0176bada75d7dd112R76

It is enabled as an extension and produces a warning which is disabled in
system headers.

Reply via email to