[libcxx-commits] [libcxx] 1f8e2a4 - [libc++][NFC] Remove __remove_uncvref (#140531)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 4 02:16:50 PDT 2025
Author: Nikolas Klauser
Date: 2025-07-04T11:16:47+02:00
New Revision: 1f8e2a4b1068e28d04fd17c076f15e88b2e0d7d9
URL: https://github.com/llvm/llvm-project/commit/1f8e2a4b1068e28d04fd17c076f15e88b2e0d7d9
DIFF: https://github.com/llvm/llvm-project/commit/1f8e2a4b1068e28d04fd17c076f15e88b2e0d7d9.diff
LOG: [libc++][NFC] Remove __remove_uncvref (#140531)
The use-case for `__is_same_uncvref` seems rather dubious, since not a
single use-cases needed the `remove_cvref_t` to be applied to both of
the arguments. Removing the alias makes it clearer what actually
happens, since we're not using an internal name anymore and it's clear
what the `remove_cvref_t` should apply to.
Added:
Modified:
libcxx/include/__functional/boyer_moore_searcher.h
libcxx/include/__functional/reference_wrapper.h
libcxx/include/__hash_table
libcxx/include/__type_traits/remove_cvref.h
libcxx/include/string
libcxx/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/__functional/boyer_moore_searcher.h b/libcxx/include/__functional/boyer_moore_searcher.h
index 88c6577f04dee..6c51c32d2f89b 100644
--- a/libcxx/include/__functional/boyer_moore_searcher.h
+++ b/libcxx/include/__functional/boyer_moore_searcher.h
@@ -123,8 +123,8 @@ class boyer_moore_searcher {
template <class _RandomAccessIterator2>
_LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const {
- static_assert(__is_same_uncvref<typename iterator_traits<_RandomAccessIterator1>::value_type,
- typename iterator_traits<_RandomAccessIterator2>::value_type>::value,
+ static_assert(is_same_v<__remove_cvref_t<typename iterator_traits<_RandomAccessIterator1>::value_type>,
+ __remove_cvref_t<typename iterator_traits<_RandomAccessIterator2>::value_type>>,
"Corpus and Pattern iterators must point to the same type");
if (__first == __last)
return std::make_pair(__last, __last);
@@ -254,8 +254,8 @@ class boyer_moore_horspool_searcher {
template <class _RandomAccessIterator2>
_LIBCPP_HIDE_FROM_ABI pair<_RandomAccessIterator2, _RandomAccessIterator2>
operator()(_RandomAccessIterator2 __first, _RandomAccessIterator2 __last) const {
- static_assert(__is_same_uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type,
- typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value,
+ static_assert(is_same_v<__remove_cvref_t<typename std::iterator_traits<_RandomAccessIterator1>::value_type>,
+ __remove_cvref_t<typename std::iterator_traits<_RandomAccessIterator2>::value_type>>,
"Corpus and Pattern iterators must point to the same type");
if (__first == __last)
return std::make_pair(__last, __last);
diff --git a/libcxx/include/__functional/reference_wrapper.h b/libcxx/include/__functional/reference_wrapper.h
index c46203a4ca9a4..11ba364369428 100644
--- a/libcxx/include/__functional/reference_wrapper.h
+++ b/libcxx/include/__functional/reference_wrapper.h
@@ -19,6 +19,7 @@
#include <__type_traits/invoke.h>
#include <__type_traits/is_const.h>
#include <__type_traits/is_core_convertible.h>
+#include <__type_traits/is_same.h>
#include <__type_traits/remove_cvref.h>
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
@@ -45,7 +46,7 @@ class reference_wrapper : public __weak_result_type<_Tp> {
public:
template <class _Up,
class = __void_t<decltype(__fun(std::declval<_Up>()))>,
- __enable_if_t<!__is_same_uncvref<_Up, reference_wrapper>::value, int> = 0>
+ __enable_if_t<!is_same<__remove_cvref_t<_Up>, reference_wrapper>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference_wrapper(_Up&& __u)
_NOEXCEPT_(noexcept(__fun(std::declval<_Up>()))) {
type& __f = static_cast<_Up&&>(__u);
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 539ee33a2583e..c59d8d5bf383a 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -207,12 +207,12 @@ struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
_LIBCPP_HIDE_FROM_ABI static key_type const& __get_key(__container_value_type const& __v) { return __v.first; }
- template <class _Up, __enable_if_t<__is_same_uncvref<_Up, __node_value_type>::value, int> = 0>
+ template <class _Up, __enable_if_t<is_same<__remove_cvref_t<_Up>, __node_value_type>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(_Up& __t) {
return __t.__get_value();
}
- template <class _Up, __enable_if_t<__is_same_uncvref<_Up, __container_value_type>::value, int> = 0>
+ template <class _Up, __enable_if_t<is_same<__remove_cvref_t<_Up>, __container_value_type>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI static __container_value_type const& __get_value(_Up& __t) {
return __t;
}
@@ -856,7 +856,7 @@ public:
return __emplace_unique_key_args(_NodeTypes::__get_key(__x), std::move(__x));
}
- template <class _Pp, __enable_if_t<!__is_same_uncvref<_Pp, __container_value_type>::value, int> = 0>
+ template <class _Pp, __enable_if_t<!is_same<__remove_cvref_t<_Pp>, __container_value_type>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI pair<iterator, bool> __insert_unique(_Pp&& __x) {
return __emplace_unique(std::forward<_Pp>(__x));
}
diff --git a/libcxx/include/__type_traits/remove_cvref.h b/libcxx/include/__type_traits/remove_cvref.h
index 760deddca946d..c568e8df3099d 100644
--- a/libcxx/include/__type_traits/remove_cvref.h
+++ b/libcxx/include/__type_traits/remove_cvref.h
@@ -10,7 +10,6 @@
#define _LIBCPP___TYPE_TRAITS_REMOVE_CVREF_H
#include <__config>
-#include <__type_traits/is_same.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -31,9 +30,6 @@ template <class _Tp>
using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp);
#endif // __has_builtin(__remove_cvref)
-template <class _Tp, class _Up>
-using __is_same_uncvref _LIBCPP_NODEBUG = _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> >;
-
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct _LIBCPP_NO_SPECIALIZATIONS remove_cvref {
diff --git a/libcxx/include/string b/libcxx/include/string
index c450ddcb41914..514dd91c7c172 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1126,7 +1126,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
basic_string(const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a = allocator_type())
@@ -1138,7 +1138,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t) {
__self_view __sv = __t;
@@ -1147,7 +1147,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t, const allocator_type& __a)
: __alloc_(__a) {
@@ -1206,7 +1206,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) {
__self_view __sv = __t;
@@ -1343,7 +1343,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string >::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string >::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const _Tp& __t) {
__self_view __sv = __t;
@@ -1372,7 +1372,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const _Tp& __t) {
__self_view __sv = __t;
@@ -1383,7 +1383,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
append(const _Tp& __t, size_type __pos, size_type __n = npos) {
@@ -1510,7 +1510,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
assign(const _Tp& __t, size_type __pos, size_type __n = npos) {
@@ -1580,7 +1580,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n = npos) {
@@ -1661,7 +1661,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
replace(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos) {
@@ -2006,7 +2006,7 @@ public:
template <class _Tp,
__enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value &&
- !__is_same_uncvref<_Tp, basic_string>::value,
+ !is_same<__remove_cvref_t<_Tp>, basic_string>::value,
int> = 0>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int
compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos) const {
diff --git a/libcxx/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp b/libcxx/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
index 48460d1488fd7..32f8d45fbbc95 100644
--- a/libcxx/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
+++ b/libcxx/test/libcxx/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
@@ -254,8 +254,9 @@ struct ReferenceWrapper {
static void fun(Type&) noexcept;
static void fun(Type&&) = delete;
- template <class Type2,
- class = typename std::enable_if<!std::__is_same_uncvref<Type2, ReferenceWrapper>::value>::type>
+ template <
+ class Type2,
+ class = typename std::enable_if<!std::is_same<std::__remove_cvref_t<Type2>, ReferenceWrapper>::value>::type>
constexpr ReferenceWrapper(Type2&& t) noexcept : ptr(&t) {}
constexpr Type& get() const noexcept { return *ptr; }
More information about the libcxx-commits
mailing list