[libcxx-commits] [libcxx] [libc++] P2944R3: Constrained comparisons - `optional` (PR #144249)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 13 09:14:30 PDT 2025
================
@@ -24,20 +24,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// and __is_core_convertible<immovable-type,immovable-type> is true in C++17 and later.
template <class _Tp, class _Up, class = void>
-struct __is_core_convertible : false_type {};
+inline const bool __is_core_convertible_v = false;
template <class _Tp, class _Up>
-struct __is_core_convertible<_Tp, _Up, decltype(static_cast<void (*)(_Up)>(0)(static_cast<_Tp (*)()>(0)()))>
- : true_type {};
+inline const bool
+ __is_core_convertible_v<_Tp, _Up, decltype(static_cast<void (*)(_Up)>(0)(static_cast<_Tp (*)()>(0)()))> = true;
+
+template <class _Tp, class _Up>
+using __is_core_convertible _LIBCPP_NODEBUG = integral_constant<bool, __is_core_convertible_v<_Tp, _Up> >;
----------------
frederick-vs-ja wrote:
Hmm, the difference between inheritance and aliasing seems to be laziness of instantiation. If it's confirmed that shortcut instantiation is not so that desired, we can even remove `__is_core_convertible` and consistently use `__is_core_convertible_v`. (The changes should belong to another PR, though.)
https://github.com/llvm/llvm-project/pull/144249
More information about the libcxx-commits
mailing list