Skip to content

Commit 57b0a81

Browse files
committed
factor out common expression
1 parent 634724c commit 57b0a81

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

libcxx/include/vector

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,10 +1629,11 @@ vector<_Tp, _Allocator>::__move_range(pointer __from_s, pointer __from_e, pointe
16291629
#if _LIBCPP_STD_VER >= 26
16301630
if ! consteval {
16311631
if constexpr (is_trivially_relocatable_v<_Tp> || is_nothrow_move_constructible_v<_Tp>) {
1632-
_ConstructTransaction __tx(*this, __to - __from_s);
1633-
(void) relocate(std::__to_address(__from_s), std::__to_address(__from_e), std::__to_address(__to));
1634-
__tx.__pos_ += __to - __from_s;
1635-
return;
1632+
const size_t __numSpaces = __to - __from_s;
1633+
_ConstructTransaction __tx(*this, __numSpaces);
1634+
(void) relocate(std::__to_address(__from_s), std::__to_address(__from_e), std::__to_address(__to));
1635+
__tx.__pos_ += __numSpaces;
1636+
return;
16361637
}
16371638
}
16381639
#endif

0 commit comments

Comments
 (0)