[libcxx-commits] [PATCH] D129716: [libc++][NFC] Use is_void instead of is_same<void, ...>

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 13 19:03:07 PDT 2022


philnik created this revision.
philnik added reviewers: ldionne, Mordante, var-const.
Herald added a project: All.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129716

Files:
  libcxx/include/__compare/strong_order.h
  libcxx/include/__format/formatter_integer.h
  libcxx/include/charconv
  libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
  libcxx/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp


Index: libcxx/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
===================================================================
--- libcxx/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
+++ libcxx/test/std/containers/container.adaptors/stack/stack.defn/emplace.pass.cpp
@@ -32,7 +32,7 @@
     typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
     static_assert(std::is_same<stack_return_type, container_return_type>::value, "");
 #else
-    static_assert(std::is_same<stack_return_type, void>::value, "");
+    static_assert(std::is_void<stack_return_type>::value, "");
 #endif
 }
 
Index: libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
===================================================================
--- libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
+++ libcxx/test/std/containers/container.adaptors/queue/queue.defn/emplace.pass.cpp
@@ -33,7 +33,7 @@
     typedef decltype(std::declval<Container>().emplace_back(std::declval<value_type>())) container_return_type;
     static_assert(std::is_same<queue_return_type, container_return_type>::value, "");
 #else
-    static_assert(std::is_same<queue_return_type, void>::value, "");
+    static_assert(std::is_void<queue_return_type>::value, "");
 #endif
 }
 
Index: libcxx/include/charconv
===================================================================
--- libcxx/include/charconv
+++ libcxx/include/charconv
@@ -559,7 +559,7 @@
 to_chars(char* __first, char* __last, _Tp __value)
 {
   using _Type = __make_32_64_or_128_bit_t<_Tp>;
-  static_assert(!is_same<_Type, void>::value, "unsupported integral type used in to_chars");
+  static_assert(!is_void<_Type>::value, "unsupported integral type used in to_chars");
   return std::__to_chars_itoa(__first, __last, static_cast<_Type>(__value), is_signed<_Tp>());
 }
 
Index: libcxx/include/__format/formatter_integer.h
===================================================================
--- libcxx/include/__format/formatter_integer.h
+++ libcxx/include/__format/formatter_integer.h
@@ -48,7 +48,7 @@
       return __formatter::__format_char(__value, __ctx.out(), __specs);
 
     using _Type = __make_32_64_or_128_bit_t<_Tp>;
-    static_assert(!is_same<_Type, void>::value, "unsupported integral type used in __formatter_integer::__format");
+    static_assert(!is_void_v<_Type>, "unsupported integral type used in __formatter_integer::__format");
 
     // Reduce the number of instantiation of the integer formatter
     return __formatter::__format_integer(static_cast<_Type>(__value), __ctx, __specs);
Index: libcxx/include/__compare/strong_order.h
===================================================================
--- libcxx/include/__compare/strong_order.h
+++ libcxx/include/__compare/strong_order.h
@@ -90,7 +90,7 @@
                     sizeof(__t) == sizeof(int32_t), int32_t, conditional_t<
                     sizeof(__t) == sizeof(int64_t), int64_t, void>
                 >;
-                if constexpr (is_same_v<_IntType, void>) {
+                if constexpr (is_void_v<_IntType>) {
                     static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type");
                 } else if (__t_is_nan && __u_is_nan) {
                     // Order by sign bit, then by "payload bits" (we'll just use bit_cast).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129716.444487.patch
Type: text/x-patch
Size: 3462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220714/25e39e0b/attachment.bin>


More information about the libcxx-commits mailing list