Skip to content

Commit 4ada903

Browse files
committed
[libc++] Simplify the implementation of remove_reference
1 parent a82ca39 commit 4ada903

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

libcxx/include/__type_traits/remove_reference.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#define _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_H
1111

1212
#include <__config>
13-
#include <cstddef>
1413

1514
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1615
# pragma GCC system_header
@@ -26,15 +25,16 @@ struct remove_reference {
2625

2726
template <class _Tp>
2827
using __libcpp_remove_reference_t = __remove_reference_t(_Tp);
29-
#else
30-
// clang-format off
31-
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG _Tp type;};
32-
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG _Tp type;};
33-
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG _Tp type;};
34-
// clang-format on
28+
#elif __has_builtin(__remove_reference)
29+
template <class _Tp>
30+
struct remove_reference {
31+
using type _LIBCPP_NODEBUG = __remove_reference(_Tp);
32+
};
3533

3634
template <class _Tp>
3735
using __libcpp_remove_reference_t = typename remove_reference<_Tp>::type;
36+
#else
37+
# error "remove_reference not implemented!"
3838
#endif // __has_builtin(__remove_reference_t)
3939

4040
#if _LIBCPP_STD_VER >= 14

0 commit comments

Comments
 (0)