Skip to content

Commit cba856b

Browse files
philnik777yuxuanchen1997
authored andcommitted
[libc++] Simplify std::is_void (#99033)
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250963
1 parent a80f1f7 commit cba856b

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

libcxx/include/__type_traits/is_void.h

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,21 @@
1111

1212
#include <__config>
1313
#include <__type_traits/integral_constant.h>
14-
#include <__type_traits/is_same.h>
15-
#include <__type_traits/remove_cv.h>
1614

1715
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1816
# pragma GCC system_header
1917
#endif
2018

2119
_LIBCPP_BEGIN_NAMESPACE_STD
2220

23-
#if __has_builtin(__is_void)
24-
2521
template <class _Tp>
26-
struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> {};
22+
struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_same(__remove_cv(_Tp), void)> {};
2723

2824
# if _LIBCPP_STD_VER >= 17
2925
template <class _Tp>
30-
inline constexpr bool is_void_v = __is_void(_Tp);
26+
inline constexpr bool is_void_v = __is_same(__remove_cv(_Tp), void);
3127
# endif
3228

33-
#else
34-
35-
template <class _Tp>
36-
struct _LIBCPP_TEMPLATE_VIS is_void : public is_same<__remove_cv_t<_Tp>, void> {};
37-
38-
# if _LIBCPP_STD_VER >= 17
39-
template <class _Tp>
40-
inline constexpr bool is_void_v = is_void<_Tp>::value;
41-
# endif
42-
43-
#endif // __has_builtin(__is_void)
44-
4529
_LIBCPP_END_NAMESPACE_STD
4630

4731
#endif // _LIBCPP___TYPE_TRAITS_IS_VOID_H

0 commit comments

Comments
 (0)