[libcxx-commits] [libcxx] adc0f5b - [libc++] Remove dead code and unneeded C++03 specializations from type_traits
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 30 07:49:22 PDT 2022
Author: Nikolas Klauser
Date: 2022-06-30T16:49:17+02:00
New Revision: adc0f5b3a6a1908a0ca7a26a87cf9e1a989cd185
URL: https://github.com/llvm/llvm-project/commit/adc0f5b3a6a1908a0ca7a26a87cf9e1a989cd185
DIFF: https://github.com/llvm/llvm-project/commit/adc0f5b3a6a1908a0ca7a26a87cf9e1a989cd185.diff
LOG: [libc++] Remove dead code and unneeded C++03 specializations from type_traits
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D128906
Added:
Modified:
libcxx/include/type_traits
Removed:
################################################################################
diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index f4d89235ad64..f7d81e65dd8e 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -529,28 +529,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair;
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
-template <bool> struct _MetaBase;
-template <>
-struct _MetaBase<true> {
- template <template <class...> class _FirstFn, template <class...> class, class ..._Args>
- using _SelectApplyImpl _LIBCPP_NODEBUG = _FirstFn<_Args...>;
- template <class _First, class...>
- using _FirstImpl _LIBCPP_NODEBUG = _First;
- template <class, class _Second, class...>
- using _SecondImpl _LIBCPP_NODEBUG = _Second;
-};
-
-template <>
-struct _MetaBase<false> {
- template <template <class...> class, template <class...> class _SecondFn, class ..._Args>
- using _SelectApplyImpl _LIBCPP_NODEBUG = _SecondFn<_Args...>;
-};
-
-template <class ..._Args>
-using _FirstType _LIBCPP_NODEBUG = typename _MetaBase<(sizeof...(_Args) >= 1)>::template _FirstImpl<_Args...>;
-template <class ..._Args>
-using _SecondType _LIBCPP_NODEBUG = typename _MetaBase<(sizeof...(_Args) >= 2)>::template _SecondImpl<_Args...>;
-
template <template <class...> class _Func, class ..._Args>
struct _Lazy : _Func<_Args...> {};
@@ -1372,91 +1350,12 @@ struct __is_implicitly_default_constructible<_Tp, decltype(__test_implicit_defau
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
template <class _Callable> class _LIBCPP_DEPRECATED_IN_CXX17 result_of;
-#ifndef _LIBCPP_CXX03_LANG
-
template <class _Fp, class ..._Args>
class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)>
: public __invoke_of<_Fp, _Args...>
{
};
-#else // C++03
-
-template <class _Fn, bool, bool>
-class __result_of
-{
-};
-
-template <class _Fn, class ..._Args>
-class __result_of<_Fn(_Args...), true, false>
-{
-public:
- typedef decltype(declval<_Fn>()(declval<_Args>()...)) type;
-};
-
-template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
-struct __result_of_mp;
-
-// member function pointer
-
-template <class _MP, class _Tp>
-struct __result_of_mp<_MP, _Tp, true>
-{
- using type = typename __member_pointer_traits<_MP>::_ReturnType;
-};
-
-// member data pointer
-
-template <class _MP, class _Tp, bool>
-struct __result_of_mdp;
-
-template <class _Rp, class _Class, class _Tp>
-struct __result_of_mdp<_Rp _Class::*, _Tp, false>
-{
- using type = typename __apply_cv<decltype(*declval<_Tp>()), _Rp>::type&;
-};
-
-template <class _Rp, class _Class, class _Tp>
-struct __result_of_mdp<_Rp _Class::*, _Tp, true>
-{
- using type = typename __apply_cv<_Tp, _Rp>::type&;
-};
-
-template <class _Rp, class _Class, class _Tp>
-struct __result_of_mp<_Rp _Class::*, _Tp, false>
- : public __result_of_mdp<_Rp _Class::*, _Tp,
- is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
-{
-};
-
-template <class _Fn, class _Tp>
-class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer
- : public __result_of_mp<typename remove_reference<_Fn>::type,
- _Tp,
- is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
-{
-};
-
-template <class _Fn, class _Tp, class ..._Args>
-class __result_of<_Fn(_Tp, _Args...), false, true> // _Fn must be member pointer
- : public __result_of_mp<typename remove_reference<_Fn>::type,
- _Tp,
- is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
-{
-};
-
-template <class _Fn, class ..._Args>
-class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_Args...)>
- : public __result_of<_Fn(_Args...),
- is_class<typename remove_reference<_Fn>::type>::value ||
- is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
- is_member_pointer<typename remove_reference<_Fn>::type>::value
- >
-{
-};
-
-#endif // C++03
-
#if _LIBCPP_STD_VER > 11
template <class _Tp> using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type;
#endif // _LIBCPP_STD_VER > 11
More information about the libcxx-commits
mailing list