[libcxx-commits] [PATCH] D126469: [libc++] Use __enable_if_t and is_integral in cstddef

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 26 07:20:40 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/D126469

Files:
  libcxx/include/cstddef


Index: libcxx/include/cstddef
===================================================================
--- libcxx/include/cstddef
+++ libcxx/include/cstddef
@@ -35,6 +35,7 @@
 
 #include <__assert> // all public C++ headers provide the assertion handler
 #include <__config>
+#include <__type_traits/enable_if.h>
 #include <__type_traits/is_integral.h>
 #include <stddef.h>
 #include <version>
@@ -60,10 +61,7 @@
 {
 enum class byte : unsigned char {};
 
-
-template <bool> struct __enable_if_integral_imp {};
-template <> struct __enable_if_integral_imp<true> { using type = byte; };
-template <class _Tp> using _EnableByteOverload = typename __enable_if_integral_imp<__libcpp_is_integral<_Tp>::value>::type;
+template <class _Tp> using _EnableByteOverload = typename __enable_if_t<is_integral<_Tp>::value>::type;
 
 constexpr byte  operator| (byte  __lhs, byte __rhs) noexcept
 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126469.432278.patch
Type: text/x-patch
Size: 877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220526/af34102c/attachment.bin>


More information about the libcxx-commits mailing list