[libcxx-commits] [libcxx] [libc++][modules] Use inline variable instead of true_type (PR #106797)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Aug 30 14:02:36 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
This allows breaking up a dependency from __fwd/array.h onto __type_traits, which is a circular dependency once __type_traits becomes a module of its own. This is also a small consistency improvement since we've been using inline variables for traits like this elsewhere in the library.
---
Full diff: https://github.com/llvm/llvm-project/pull/106797.diff
2 Files Affected:
- (modified) libcxx/include/__fwd/array.h (+3-3)
- (modified) libcxx/include/span (+1-1)
``````````diff
diff --git a/libcxx/include/__fwd/array.h b/libcxx/include/__fwd/array.h
index b429d0c5a95427..6c6461e7276040 100644
--- a/libcxx/include/__fwd/array.h
+++ b/libcxx/include/__fwd/array.h
@@ -35,11 +35,11 @@ template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp&& get(const array<_Tp, _Size>&&) _NOEXCEPT;
#endif
-template <class>
-struct __is_std_array : false_type {};
+template <class _Tp>
+inline const bool __is_std_array_v = false;
template <class _Tp, size_t _Size>
-struct __is_std_array<array<_Tp, _Size> > : true_type {};
+inline const bool __is_std_array_v<array<_Tp, _Size> > = true;
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/span b/libcxx/include/span
index da631cdc3f90e6..a32f7a372e2ae1 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -210,7 +210,7 @@ concept __span_compatible_range =
ranges::contiguous_range<_Range> && //
ranges::sized_range<_Range> && //
(ranges::borrowed_range<_Range> || is_const_v<_ElementType>) && //
- !__is_std_array<remove_cvref_t<_Range>>::value && //
+ !__is_std_array_v<remove_cvref_t<_Range>> && //
!is_array_v<remove_cvref_t<_Range>> && //
is_convertible_v<remove_reference_t<ranges::range_reference_t<_Range>> (*)[], _ElementType (*)[]>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/106797
More information about the libcxx-commits
mailing list