Skip to content

Commit 9e2d9ec

Browse files
<vector>: Fix allocator types in reallocation guards (#5729)
1 parent 3effbb0 commit 9e2d9ec

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

stl/inc/vector

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -607,33 +607,33 @@ private:
607607
using _Scary_val = _Vector_val<conditional_t<_Is_simple_alloc_v<_Alty>, _Simple_types<_Ty>,
608608
_Vec_iter_types<_Ty, size_type, difference_type, pointer, const_pointer>>>;
609609

610-
struct _NODISCARD _Reallocation_guard {
611-
_Alloc& _Al;
610+
struct _NODISCARD _Reallocation_guard2 {
611+
_Alty& _Al;
612612
pointer _New_begin;
613613
size_type _New_capacity;
614614
pointer _Constructed_first;
615615
pointer _Constructed_last;
616616

617-
_Reallocation_guard& operator=(const _Reallocation_guard&) = delete;
618-
_Reallocation_guard& operator=(_Reallocation_guard&&) = delete;
617+
_Reallocation_guard2& operator=(const _Reallocation_guard2&) = delete;
618+
_Reallocation_guard2& operator=(_Reallocation_guard2&&) = delete;
619619

620-
_CONSTEXPR20 ~_Reallocation_guard() noexcept {
620+
_CONSTEXPR20 ~_Reallocation_guard2() noexcept {
621621
if (_New_begin != nullptr) {
622622
_STD _Destroy_range(_Constructed_first, _Constructed_last, _Al);
623623
_Al.deallocate(_New_begin, _New_capacity);
624624
}
625625
}
626626
};
627627

628-
struct _NODISCARD _Simple_reallocation_guard {
629-
_Alloc& _Al;
628+
struct _NODISCARD _Simple_reallocation_guard2 {
629+
_Alty& _Al;
630630
pointer _New_begin;
631631
size_type _New_capacity;
632632

633-
_Simple_reallocation_guard& operator=(const _Simple_reallocation_guard&) = delete;
634-
_Simple_reallocation_guard& operator=(_Simple_reallocation_guard&&) = delete;
633+
_Simple_reallocation_guard2& operator=(const _Simple_reallocation_guard2&) = delete;
634+
_Simple_reallocation_guard2& operator=(_Simple_reallocation_guard2&&) = delete;
635635

636-
_CONSTEXPR20 ~_Simple_reallocation_guard() noexcept {
636+
_CONSTEXPR20 ~_Simple_reallocation_guard2() noexcept {
637637
if (_New_begin != nullptr) {
638638
_Al.deallocate(_New_begin, _New_capacity);
639639
}
@@ -894,7 +894,7 @@ private:
894894
const pointer _Newvec = _STD _Allocate_at_least_helper(_Al, _Newcapacity);
895895
const pointer _Constructed_last = _Newvec + _Whereoff + 1;
896896

897-
_Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last};
897+
_Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last};
898898
auto& _Constructed_first = _Guard._Constructed_first;
899899

900900
_Alty_traits::construct(_Al, _STD _Unfancy(_Newvec + _Whereoff), _STD forward<_Valty>(_Val)...);
@@ -978,7 +978,7 @@ private:
978978
const pointer _Newvec = _Allocate_at_least_helper(_Al, _Newcapacity);
979979
const pointer _Constructed_last = _Newvec + _Oldsize + _Count;
980980

981-
_Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last};
981+
_Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last};
982982
auto& _Constructed_first = _Guard._Constructed_first;
983983

984984
_Uninitialized_copy_n(_STD move(_First), _Count, _Newvec + _Oldsize, _Al);
@@ -1096,7 +1096,7 @@ public:
10961096
const pointer _Newvec = _Allocate_at_least_helper(_Al, _Newcapacity);
10971097
const pointer _Constructed_last = _Newvec + _Whereoff + _Count;
10981098

1099-
_Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last};
1099+
_Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last};
11001100
auto& _Constructed_first = _Guard._Constructed_first;
11011101

11021102
_Uninitialized_fill_n(_Newvec + _Whereoff, _Count, _Val, _Al);
@@ -1189,7 +1189,7 @@ private:
11891189
const auto _Whereoff = static_cast<size_type>(_Whereptr - _Oldfirst);
11901190
const pointer _Constructed_last = _Newvec + _Whereoff + _Count;
11911191

1192-
_Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last};
1192+
_Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Constructed_last, _Constructed_last};
11931193
auto& _Constructed_first = _Guard._Constructed_first;
11941194

11951195
_STD _Uninitialized_copy_n(_STD move(_First), _Count, _Newvec + _Whereoff, _Al);
@@ -1565,7 +1565,7 @@ private:
15651565
const pointer _Newvec = _Allocate_at_least_helper(_Al, _Newcapacity);
15661566
const pointer _Appended_first = _Newvec + _Oldsize;
15671567

1568-
_Reallocation_guard _Guard{_Al, _Newvec, _Newcapacity, _Appended_first, _Appended_first};
1568+
_Reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity, _Appended_first, _Appended_first};
15691569
auto& _Appended_last = _Guard._Constructed_last;
15701570

15711571
if constexpr (is_same_v<_Ty2, _Ty>) {
@@ -1656,7 +1656,7 @@ private:
16561656
_Newvec = _Al.allocate(_Newcapacity);
16571657
}
16581658

1659-
_Simple_reallocation_guard _Guard{_Al, _Newvec, _Newcapacity};
1659+
_Simple_reallocation_guard2 _Guard{_Al, _Newvec, _Newcapacity};
16601660

16611661
if constexpr (is_nothrow_move_constructible_v<_Ty> || !is_copy_constructible_v<_Ty>) {
16621662
_Uninitialized_move(_Myfirst, _Mylast, _Newvec, _Al);

0 commit comments

Comments
 (0)