[libcxx-commits] [libcxx] [libc++] Make std::pair trivially copyable if its members are (PR #89652)

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 31 09:43:05 PDT 2024


cjdb wrote:

> Thanks for working on this. How is it materially different to #84811?

Ah, after a bit of reading, I think I see the difference. IIUC you're going for "make `pair<T, U>` trivially copyable if `T` and `U` are trivially copyable", whereas #84811 does "make `pair<T, U>` trivially copy constructible if `T` and `U` are trivially copy constructible", "make `pair<T, U>` trivially copy assignable if `T` and `U` are trivially copy assignable", etc.

Your approach is simpler, and probably covers the vast majority of cases. I _think_ that's why you can get away with not needing `is_object` (which is what tipped me off that we're going about this differently).

> It's not fundamentally different. The main change is that I use `__attribute__((enable_if))` to back-port this to C++03 with clang.

A C++03-friendly approach would be good. I think I was only able to get it back to C++11 before my attention was diverted elsewhere.

> If you don't mind I'd add you as a co-author, since I basically stole the idea.

Sure, that is appreciated :)

https://github.com/llvm/llvm-project/pull/89652


More information about the libcxx-commits mailing list