Skip to content

Commit 9474baf

Browse files
committed
__p_ -> __ptr_
1 parent 2cb37e7 commit 9474baf

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

libcxx/include/__memory/indirect.h

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -67,69 +67,69 @@ class _LIBCPP_NO_SPECIALIZATIONS indirect {
6767
// [indirect.ctor], constructors
6868
_LIBCPP_HIDE_FROM_ABI constexpr explicit indirect()
6969
requires is_default_constructible_v<_Allocator>
70-
: __p_(__allocate_owned_object(__alloc_)) {}
70+
: __ptr_(__allocate_owned_object(__alloc_)) {}
7171

7272
_LIBCPP_HIDE_FROM_ABI constexpr explicit indirect(allocator_arg_t, const _Allocator& __a)
73-
: __alloc_(__a), __p_(__allocate_owned_object(__alloc_)) {}
73+
: __alloc_(__a), __ptr_(__allocate_owned_object(__alloc_)) {}
7474

7575
_LIBCPP_HIDE_FROM_ABI constexpr indirect(const indirect& __other)
7676
: __alloc_(allocator_traits<_Allocator>::select_on_container_copy_construction(__other.__alloc_)),
77-
__p_(__other.valueless_after_move() ? nullptr : __allocate_owned_object(__alloc_, *__other)) {}
77+
__ptr_(__other.valueless_after_move() ? nullptr : __allocate_owned_object(__alloc_, *__other)) {}
7878

7979
_LIBCPP_HIDE_FROM_ABI constexpr indirect(allocator_arg_t, const _Allocator& __a, const indirect& __other)
80-
: __alloc_(__a), __p_(__other.valueless_after_move() ? nullptr : __allocate_owned_object(__alloc_, *__other)) {}
80+
: __alloc_(__a), __ptr_(__other.valueless_after_move() ? nullptr : __allocate_owned_object(__alloc_, *__other)) {}
8181

8282
_LIBCPP_HIDE_FROM_ABI constexpr indirect(indirect&& __other) noexcept
83-
: __alloc_(std::move(__other.__alloc_)), __p_(std::exchange(__other.__p_, nullptr)) {}
83+
: __alloc_(std::move(__other.__alloc_)), __ptr_(std::exchange(__other.__ptr_, nullptr)) {}
8484

8585
_LIBCPP_HIDE_FROM_ABI constexpr indirect(allocator_arg_t, const _Allocator& __a, indirect&& __other) noexcept
8686
requires allocator_traits<_Allocator>::is_always_equal::value
87-
: __alloc_(__a), __p_(std::exchange(__other.__p_, nullptr)) {}
87+
: __alloc_(__a), __ptr_(std::exchange(__other.__ptr_, nullptr)) {}
8888

8989
_LIBCPP_HIDE_FROM_ABI constexpr indirect(allocator_arg_t, const _Allocator& __a, indirect&& __other) : __alloc_(__a) {
9090
if (__other.valueless_after_move()) {
91-
__p_ = nullptr;
91+
__ptr_ = nullptr;
9292
} else if (__alloc_ == __other.__alloc_) {
93-
__p_ = std::exchange(__other.__p_, nullptr);
93+
__ptr_ = std::exchange(__other.__ptr_, nullptr);
9494
} else {
95-
__p_ = __allocate_owned_object(__alloc_, *std::move(__other));
95+
__ptr_ = __allocate_owned_object(__alloc_, *std::move(__other));
9696
__other.__destroy_owned_object();
97-
__other.__p_ = nullptr;
97+
__other.__ptr_ = nullptr;
9898
}
9999
}
100100

101101
template <class _Up = _Tp>
102102
requires(!is_same_v<remove_cvref_t<_Up>, indirect> && !is_same_v<remove_cvref_t<_Up>, in_place_t> &&
103103
is_constructible_v<_Tp, _Up> && is_default_constructible_v<_Allocator>)
104104
_LIBCPP_HIDE_FROM_ABI constexpr explicit indirect(_Up&& __u)
105-
: __p_(__allocate_owned_object(__alloc_, std::forward<_Up>(__u))) {}
105+
: __ptr_(__allocate_owned_object(__alloc_, std::forward<_Up>(__u))) {}
106106

107107
template <class _Up = _Tp>
108108
requires(!is_same_v<remove_cvref_t<_Up>, indirect> && !is_same_v<remove_cvref_t<_Up>, in_place_t> &&
109109
is_constructible_v<_Tp, _Up>)
110110
_LIBCPP_HIDE_FROM_ABI constexpr explicit indirect(allocator_arg_t, const _Allocator& __a, _Up&& __u)
111-
: __alloc_(__a), __p_(__allocate_owned_object(__alloc_, std::forward<_Up>(__u))) {}
111+
: __alloc_(__a), __ptr_(__allocate_owned_object(__alloc_, std::forward<_Up>(__u))) {}
112112

113113
template <class... _Us>
114114
requires(is_constructible_v<_Tp, _Us...> && is_default_constructible_v<_Allocator>)
115115
_LIBCPP_HIDE_FROM_ABI constexpr explicit indirect(in_place_t, _Us&&... __us)
116-
: __p_(__allocate_owned_object(__alloc_, std::forward<_Us>(__us)...)) {}
116+
: __ptr_(__allocate_owned_object(__alloc_, std::forward<_Us>(__us)...)) {}
117117

118118
template <class... _Us>
119119
requires is_constructible_v<_Tp, _Us...>
120120
_LIBCPP_HIDE_FROM_ABI constexpr explicit indirect(allocator_arg_t, const _Allocator& __a, in_place_t, _Us&&... __us)
121-
: __alloc_(__a), __p_(__allocate_owned_object(__alloc_, std::forward<_Us>(__us)...)) {}
121+
: __alloc_(__a), __ptr_(__allocate_owned_object(__alloc_, std::forward<_Us>(__us)...)) {}
122122

123123
template <class _In, class... _Us>
124124
requires(is_constructible_v<_Tp, initializer_list<_In>&, _Us...> && is_default_constructible_v<_Allocator>)
125125
_LIBCPP_HIDE_FROM_ABI constexpr explicit indirect(in_place_t, initializer_list<_In> __ilist, _Us&&... __us)
126-
: __p_(__allocate_owned_object(__alloc_, __ilist, std::forward<_Us>(__us)...)) {}
126+
: __ptr_(__allocate_owned_object(__alloc_, __ilist, std::forward<_Us>(__us)...)) {}
127127

128128
template <class _In, class... _Us>
129129
requires is_constructible_v<_Tp, initializer_list<_In>&, _Us...>
130130
_LIBCPP_HIDE_FROM_ABI constexpr explicit indirect(
131131
allocator_arg_t, const _Allocator& __a, in_place_t, initializer_list<_In> __ilist, _Us&&... __us)
132-
: __alloc_(__a), __p_(__allocate_owned_object(__alloc_, __ilist, std::forward<_Us>(__us)...)) {}
132+
: __alloc_(__a), __ptr_(__allocate_owned_object(__alloc_, __ilist, std::forward<_Us>(__us)...)) {}
133133

134134
// [indirect.dtor], destructor
135135
_LIBCPP_HIDE_FROM_ABI constexpr ~indirect() { __destroy_owned_object(); }
@@ -143,20 +143,20 @@ class _LIBCPP_NO_SPECIALIZATIONS indirect {
143143
allocator_traits<_Allocator>::propagate_on_container_copy_assignment::value;
144144
if (__other.valueless_after_move()) {
145145
__destroy_owned_object();
146-
__p_ = nullptr;
146+
__ptr_ = nullptr;
147147
} else if (!valueless_after_move() && __alloc_ == __other.__alloc_) {
148-
*__p_ = *__other;
148+
*__ptr_ = *__other;
149149
} else {
150-
pointer __new_p;
150+
pointer __new_ptr;
151151
if constexpr (__propagate_allocator) {
152152
// We need a mutable instance of the allocator, so make a copy.
153153
_Allocator __alloc_copy = __other.__alloc_;
154-
__new_p = __allocate_owned_object(__alloc_copy, *__other);
154+
__new_ptr = __allocate_owned_object(__alloc_copy, *__other);
155155
} else {
156-
__new_p = __allocate_owned_object(__alloc_, *__other);
156+
__new_ptr = __allocate_owned_object(__alloc_, *__other);
157157
}
158158
__destroy_owned_object();
159-
__p_ = __new_p;
159+
__ptr_ = __new_ptr;
160160
}
161161

162162
if constexpr (__propagate_allocator)
@@ -174,20 +174,20 @@ class _LIBCPP_NO_SPECIALIZATIONS indirect {
174174
static constexpr bool __propagate_allocator =
175175
allocator_traits<_Allocator>::propagate_on_container_move_assignment::value;
176176

177-
pointer __new_p;
177+
pointer __new_ptr;
178178
if constexpr (__propagate_allocator || allocator_traits<_Allocator>::is_always_equal::value) {
179-
__new_p = __other.__p_;
179+
__new_ptr = __other.__ptr_;
180180
} else if (__other.valueless_after_move()) {
181-
__new_p = nullptr;
181+
__new_ptr = nullptr;
182182
} else if (__alloc_ == __other.__alloc_) {
183-
__new_p = __other.__p_;
183+
__new_ptr = __other.__ptr_;
184184
} else {
185-
__new_p = __allocate_owned_object(__alloc_, *std::move(__other));
185+
__new_ptr = __allocate_owned_object(__alloc_, *std::move(__other));
186186
__other.__destroy_owned_object();
187187
}
188-
__other.__p_ = nullptr;
188+
__other.__ptr_ = nullptr;
189189
__destroy_owned_object();
190-
__p_ = __new_p;
190+
__ptr_ = __new_ptr;
191191

192192
if constexpr (__propagate_allocator)
193193
__alloc_ = __other.__alloc_;
@@ -199,50 +199,50 @@ class _LIBCPP_NO_SPECIALIZATIONS indirect {
199199
requires(!is_same_v<remove_cvref_t<_Up>, indirect> && is_constructible_v<_Tp, _Up> && is_assignable_v<_Tp&, _Up>)
200200
_LIBCPP_HIDE_FROM_ABI constexpr indirect& operator=(_Up&& __u) {
201201
if (valueless_after_move())
202-
__p_ = __allocate_owned_object(__alloc_, std::forward<_Up>(__u));
202+
__ptr_ = __allocate_owned_object(__alloc_, std::forward<_Up>(__u));
203203
else
204-
*__p_ = std::forward<_Up>(__u);
204+
*__ptr_ = std::forward<_Up>(__u);
205205
return *this;
206206
}
207207

208208
// [indirect.obs], observers
209209
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept {
210210
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
211211
!valueless_after_move(), "operator* called on a valueless std::indirect object");
212-
return *__p_;
212+
return *__ptr_;
213213
}
214214

215215
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept {
216216
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
217217
!valueless_after_move(), "operator* called on a valueless std::indirect object");
218-
return *__p_;
218+
return *__ptr_;
219219
}
220220

221221
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept {
222222
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
223223
!valueless_after_move(), "operator* called on a valueless std::indirect object");
224-
return std::move(*__p_);
224+
return std::move(*__ptr_);
225225
}
226226

227227
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept {
228228
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
229229
!valueless_after_move(), "operator* called on a valueless std::indirect object");
230-
return std::move(*__p_);
230+
return std::move(*__ptr_);
231231
}
232232

233233
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr const_pointer operator->() const noexcept {
234234
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
235235
!valueless_after_move(), "operator-> called on a valueless std::indirect object");
236-
return __p_;
236+
return __ptr_;
237237
}
238238

239239
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr pointer operator->() noexcept {
240240
_LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(
241241
!valueless_after_move(), "operator-> called on a valueless std::indirect object");
242-
return __p_;
242+
return __ptr_;
243243
}
244244

245-
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_after_move() const noexcept { return !__p_; }
245+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool valueless_after_move() const noexcept { return !__ptr_; }
246246

247247
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocator_type get_allocator() const noexcept { return __alloc_; }
248248

@@ -253,7 +253,7 @@ class _LIBCPP_NO_SPECIALIZATIONS indirect {
253253
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
254254
allocator_traits<_Allocator>::propagate_on_container_swap::value || get_allocator() == __other.get_allocator(),
255255
"swapping std::indirect objects with different allocators");
256-
std::swap(__p_, __other.__p_);
256+
std::swap(__ptr_, __other.__ptr_);
257257
std::__swap_allocator(__alloc_, __other.__alloc_);
258258
}
259259

@@ -301,13 +301,13 @@ class _LIBCPP_NO_SPECIALIZATIONS indirect {
301301

302302
_LIBCPP_HIDE_FROM_ABI constexpr void __destroy_owned_object() noexcept {
303303
if (!valueless_after_move()) {
304-
allocator_traits<_Allocator>::destroy(__alloc_, __p_);
305-
allocator_traits<_Allocator>::deallocate(__alloc_, __p_, 1);
304+
allocator_traits<_Allocator>::destroy(__alloc_, __ptr_);
305+
allocator_traits<_Allocator>::deallocate(__alloc_, __ptr_, 1);
306306
}
307307
}
308308

309309
_LIBCPP_NO_UNIQUE_ADDRESS _Allocator __alloc_ = _Allocator();
310-
pointer __p_;
310+
pointer __ptr_;
311311
};
312312

313313
template <class _Value>

0 commit comments

Comments
 (0)