Commit 826048e
committed
inlined_vector: Use trivial relocation for
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.)
Clang's builtin currently fails to check the assignment operator,
but Abseil's type trait already refuses to use Clang's builtin.
I'm working on getting that fixed in Clang.
The reason this is important is that we want to be able to use memcpy
to speedily relocate elements also in vector::erase. Implement that
optimization for `absl::inlined_vector`.
Prior art for the `vector::erase` optimization:
https://github.com/bloomberg/bde/blob/e15f05be6/groups/bsl/bslalg/bslalg_arrayprimitives.h#L3787-L3799
https://github.com/facebook/folly/blob/main/folly/FBVector.h#L1254
https://github.com/qt/qtbase/blob/fbfee2d/src/corelib/tools/qarraydataops.h#L856-L861erase
1 parent 4358cb2 commit 826048e
2 files changed
+25
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
894 | 894 | | |
895 | 895 | | |
896 | 896 | | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
902 | 913 | | |
903 | | - | |
904 | | - | |
905 | | - | |
| 914 | + | |
| 915 | + | |
906 | 916 | | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
907 | 921 | | |
908 | 922 | | |
909 | 923 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
522 | | - | |
523 | | - | |
| 522 | + | |
| 523 | + | |
524 | 524 | | |
525 | 525 | | |
526 | | - | |
527 | | - | |
| 526 | + | |
528 | 527 | | |
529 | 528 | | |
530 | 529 | | |
| |||
0 commit comments