-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore size limitation for copying whole inline buffer in small_vector
Summary: D43401609, derived from [PR #1934](#1934), allows the move constructor to use `memcpy` to relocate the inline storage for relocatable types, but it copies the whole storage disregarding the previous limitation on size for trivial types (which are a subset of relocatable types). Furthermore, the same optimization is not applied to the move-assignment operator. This diff restores the size limitation (using a precise copy when relocating inline buffers that exceed it) and applies the same logic to move-assignment. Also, since now we can assume C++17 and thus `if constexpr`, I removed the unnecessary overload of `copyInlineTrivial()`, and I made the names less ambiguous. We might also benefit from special-casing relocatable types on reallocation in `makeSizeInternal()`, but that can be done separately. Reviewed By: Gownta Differential Revision: D53965673 fbshipit-source-id: 2939c03ada3b19d4fadfa11621a3e2f3afc5ccb7
- Loading branch information
1 parent
1f46b1c
commit 2459e17
Showing
1 changed file
with
42 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters