-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #1790: Respect the allocator's .destroy method in ~InlinedVector
Imported from GitHub PR #1790 InlinedVector goes out of its way to use `A::construct` to construct new elements, so it should not skip the `A::destroy` call for those elements, either. Most codepaths seem fine (I didn't exhaustively explore this), but `DestroyAdapter` specifically failed to check whether the allocator had a non-trivial `destroy` method: it checked only whether the element type was trivially destructible in the absence of any `destroy` method. Use the same condition in `DestroyAdapter` as we already use in the special short-circuit case on line 357 and in the conditions for the relocation optimizations on lines 304 and 324. Unit test updated by @derekmauro Merging this change closes #1790 COPYBARA_INTEGRATE_REVIEW=#1790 from Quuxplusone:inlined-vector-destroy 2c52d75 PiperOrigin-RevId: 705581176 Change-Id: Ic728747c41401863f8c01083e22b1d1e536347db
- Loading branch information
1 parent
c935131
commit 940e0ec
Showing
2 changed files
with
50 additions
and
29 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
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