[libcxx-commits] [PATCH] D109075: [libc++][NFC] Move concepts to a subheader.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 1 10:47:05 PDT 2021


Mordante created this revision.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

D103357 <https://reviews.llvm.org/D103357> added some new concepts. Since the header `<concepts>` has moved
all its concepts to a separate header these new concepts feel out of
place. Move them to the appropriate header.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109075

Files:
  libcxx/include/__concepts/arithmetic.h
  libcxx/include/__format/format_arg.h
  libcxx/include/concepts
  libcxx/include/type_traits


Index: libcxx/include/type_traits
===================================================================
--- libcxx/include/type_traits
+++ libcxx/include/type_traits
@@ -790,7 +790,7 @@
 #endif // __has_keyword(__is_integral)
 
 // __libcpp_is_signed_integer, __libcpp_is_unsigned_integer
-// <concepts> implements __libcpp_signed_integer, __libcpp_unsigned_integer
+// <__concepts/arithmetic.h> implements __libcpp_signed_integer, __libcpp_unsigned_integer
 
 // [basic.fundamental] defines five standard signed integer types;
 // __int128_t is an extended signed integer type.
Index: libcxx/include/concepts
===================================================================
--- libcxx/include/concepts
+++ libcxx/include/concepts
@@ -152,28 +152,10 @@
 #include <__concepts/swappable.h>
 #include <__concepts/totally_ordered.h>
 #include <__config>
-#include <type_traits>
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
 
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
-
-// Concept helpers for the internal type traits for the fundamental types.
-
-template <class _Tp>
-concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value;
-template <class _Tp>
-concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value;
-template <class _Tp>
-concept __libcpp_floating_point = __libcpp_is_floating_point<_Tp>::value;
-
-#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
-
-_LIBCPP_END_NAMESPACE_STD
-
 #endif // _LIBCPP_CONCEPTS
Index: libcxx/include/__format/format_arg.h
===================================================================
--- libcxx/include/__format/format_arg.h
+++ libcxx/include/__format/format_arg.h
@@ -10,12 +10,12 @@
 #ifndef _LIBCPP___FORMAT_FORMAT_ARG_H
 #define _LIBCPP___FORMAT_FORMAT_ARG_H
 
+#include <__concepts/arithmetic.h>
 #include <__config>
 #include <__format/format_error.h>
 #include <__format/format_fwd.h>
 #include <__functional_base>
 #include <__variant/monostate.h>
-#include <concepts>
 #include <string>
 #include <string_view>
 
Index: libcxx/include/__concepts/arithmetic.h
===================================================================
--- libcxx/include/__concepts/arithmetic.h
+++ libcxx/include/__concepts/arithmetic.h
@@ -34,6 +34,15 @@
 template<class _Tp>
 concept floating_point = is_floating_point_v<_Tp>;
 
+// Concept helpers for the internal type traits for the fundamental types.
+
+template <class _Tp>
+concept __libcpp_unsigned_integer = __libcpp_is_unsigned_integer<_Tp>::value;
+template <class _Tp>
+concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value;
+template <class _Tp>
+concept __libcpp_floating_point = __libcpp_is_floating_point<_Tp>::value;
+
 #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CONCEPTS)
 
 _LIBCPP_END_NAMESPACE_STD


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109075.369987.patch
Type: text/x-patch
Size: 2902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210901/50453d15/attachment.bin>


More information about the libcxx-commits mailing list