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

Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arthur.j.odwyer at gmail dot 
com

--- Comment #4 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> ---
Hi, I'm the author of P1144 "Object relocation in terms of move plus destroy".
Awesome work you've done here!
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

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&&>`. 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>`... even though I guess I didn't
implement that part for my libc++ patch, because I'm still waiting on
<memory_resource> to get merged.)

Here's my `__has_trivial_construct`:
https://github.com/Quuxplusone/libcxx/blob/99d734b4/include/memory#L5790-L5800

And here's how std::vector uses it (which is significantly different from how
libstdc++'s std::vector is arranged, but I'm sure the trait would be the same):
https://github.com/Quuxplusone/libcxx/blob/99d734b4/include/vector#L587-L600

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.

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

Reply via email to