From d399df88358c6c578ac017ef927d32336358f868 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Tue, 21 Jan 2025 10:28:05 +0100 Subject: [PATCH] [libc++] Avoid unnecessary instantiations for __copy_cvref_t --- libcxx/include/__type_traits/copy_cvref.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libcxx/include/__type_traits/copy_cvref.h b/libcxx/include/__type_traits/copy_cvref.h index 511d4e0776d60..158e5a5d78bb3 100644 --- a/libcxx/include/__type_traits/copy_cvref.h +++ b/libcxx/include/__type_traits/copy_cvref.h @@ -20,23 +20,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD -template +template struct __copy_cvref { - using type = __copy_cv_t<_From, _To>; + template + using __apply _LIBCPP_NODEBUG = __copy_cv_t<_From, _To>; }; -template -struct __copy_cvref<_From&, _To> { - using type = __add_lvalue_reference_t<__copy_cv_t<_From, _To> >; +template +struct __copy_cvref<_From&> { + template + using __apply _LIBCPP_NODEBUG = __add_lvalue_reference_t<__copy_cv_t<_From, _To> >; }; -template -struct __copy_cvref<_From&&, _To> { - using type = __add_rvalue_reference_t<__copy_cv_t<_From, _To> >; +template +struct __copy_cvref<_From&&> { + template + using __apply _LIBCPP_NODEBUG = __add_rvalue_reference_t<__copy_cv_t<_From, _To> >; }; template -using __copy_cvref_t _LIBCPP_NODEBUG = typename __copy_cvref<_From, _To>::type; +using __copy_cvref_t _LIBCPP_NODEBUG = typename __copy_cvref<_From>::template __apply<_To>; _LIBCPP_END_NAMESPACE_STD