Skip to content

Commit

Permalink
[libc++] Use a different smart ptr type alias
Browse files Browse the repository at this point in the history
The `_SP` type is used by some C libraries and this alias could conflict
with it.
  • Loading branch information
androm3da committed Aug 6, 2024
1 parent 1fb1a5d commit 270f2fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions libcxx/include/__memory/inout_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
}
}

using _SP = __pointer_of_or_t<_Smart, _Pointer>;
using _SmartPtr = __pointer_of_or_t<_Smart, _Pointer>;
if constexpr (is_pointer_v<_Smart>) {
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
} else if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) {
std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
} else {
static_assert(is_constructible_v<_Smart, _SP, _Args...>,
static_assert(is_constructible_v<_Smart, _SmartPtr, _Args...>,
"The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args...");
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
}
}
Expand Down
8 changes: 4 additions & 4 deletions libcxx/include/__memory/out_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ class _LIBCPP_TEMPLATE_VIS out_ptr_t {
return;
}

using _SP = __pointer_of_or_t<_Smart, _Pointer>;
using _SmartPtr = __pointer_of_or_t<_Smart, _Pointer>;
if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) {
std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
} else {
static_assert(is_constructible_v<_Smart, _SP, _Args...>,
static_assert(is_constructible_v<_Smart, _SmartPtr, _Args...>,
"The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args...");
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SmartPtr>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
}
}
Expand Down

0 comments on commit 270f2fd

Please sign in to comment.