Skip to content

Commit 8ce0fb8

Browse files
[libc++][NFC] Reduce use of __add_lvalue_reference_t (#112497)
Currently, the occurrences of `__add_lvalue_reference_t` in `__split_buffer` and `__assoc_state` are probably meaningless. * In `__split_buffer`, the `__alloc_ref` and `__alloc_const_ref` member typedefs are no longer used. * In `__assoc_state`, we should simply use `_Rp&`, which must be well-formed since it's already required that `sizeof(_Rp)` is well-formed. This PR removes the meaningless usages. The remaining occurrences in `shared_ptr`, `unique_ptr`, and several type traits are meaningful.
1 parent fa5d3f6 commit 8ce0fb8

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

libcxx/include/__split_buffer

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ public:
8080
pointer __end_;
8181
_LIBCPP_COMPRESSED_PAIR(pointer, __end_cap_, allocator_type, __alloc_);
8282

83-
using __alloc_ref = __add_lvalue_reference_t<allocator_type>;
84-
using __alloc_const_ref = __add_lvalue_reference_t<allocator_type>;
85-
8683
__split_buffer(const __split_buffer&) = delete;
8784
__split_buffer& operator=(const __split_buffer&) = delete;
8885

libcxx/include/future

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ public:
594594
_LIBCPP_HIDE_FROM_ABI void set_value_at_thread_exit(_Arg&& __arg);
595595

596596
_LIBCPP_HIDE_FROM_ABI _Rp move();
597-
_LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<_Rp> copy();
597+
_LIBCPP_HIDE_FROM_ABI _Rp& copy();
598598
};
599599

600600
template <class _Rp>
@@ -636,7 +636,7 @@ _Rp __assoc_state<_Rp>::move() {
636636
}
637637

638638
template <class _Rp>
639-
__add_lvalue_reference_t<_Rp> __assoc_state<_Rp>::copy() {
639+
_Rp& __assoc_state<_Rp>::copy() {
640640
unique_lock<mutex> __lk(this->__mut_);
641641
this->__sub_wait(__lk);
642642
if (this->__exception_ != nullptr)

0 commit comments

Comments
 (0)