diff options
author | Arthur O'Dwyer <arthur.j.odwyer@gmail.com> | 2024-02-17 09:32:01 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-02-17 09:33:19 -0800 |
commit | 14b8a4eac3e5a7b97ba4cc7b7dadf2a85aae8215 (patch) | |
tree | 53e0c8bbe0041bd92e08ea44bf5e658e676d26cc /absl/algorithm | |
parent | 8a3caf7dea955b513a6c1b572a2423c6b4213402 (diff) | |
download | abseil-14b8a4eac3e5a7b97ba4cc7b7dadf2a85aae8215.tar.gz abseil-14b8a4eac3e5a7b97ba4cc7b7dadf2a85aae8215.tar.bz2 abseil-14b8a4eac3e5a7b97ba4cc7b7dadf2a85aae8215.zip |
PR #1625: absl::is_trivially_relocatable now respects assignment operators
Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1625
Trivial relocatability also requires that the type not do anything weird with its assignment operator; update the type-trait to reflect this. (This is the definition used by BSL, Folly, HPX, Thrust, Parlay, Amadeus, and P1144.)
This is important if we want to use `absl::is_trivially_relocatable` as a gate for memcpy optimizations in `inlined_vector::erase` and/or `inlined_vector::swap`, because in those cases relocation is used to replace part of a sequence involving assignment; the optimization requires an assignment operator that behaves value-semantically.
Clang's builtin currently fails to check the assignment operator, so we stop using it entirely for now. We already refused to use it on Win32, Win64, and Apple, for various unrelated reasons. I'm working on giving Clang's builtin the behavior that would let us re-enable it here.
Assume that any compiler providing both `__cpp_impl_trivially_relocatable` and a builtin `__is_trivially_relocatable(T)` will use the appropriate (P1144) definition for its builtin. Right now there's only one such compiler (the P1144 reference implementation, which forks Clang), so this is largely a moot point, but I'm being optimistic.
Merge d943abdbabc1b7080aa5f0a2fff3e724135164dc into 34604d5b1f6ae14c65b3992478b59f7108051979
Merging this change closes #1625
COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1625 from Quuxplusone:trivially-relocatable d943abdbabc1b7080aa5f0a2fff3e724135164dc
PiperOrigin-RevId: 607977323
Change-Id: I6436a60326c6d1064bdd71ec2e15b86b7a29efd4
Diffstat (limited to 'absl/algorithm')
0 files changed, 0 insertions, 0 deletions