@@ -39,35 +39,21 @@ template <typename T> class is_integral_or_enum {
3939};
4040
4141// / If T is a pointer, just return it. If it is not, return T&.
42- template <typename T, typename Enable = void >
43- struct add_lvalue_reference_if_not_pointer {
44- using type = T &;
45- };
46-
47- template <typename T>
48- struct add_lvalue_reference_if_not_pointer <
49- T, std::enable_if_t <std::is_pointer_v<T>>> {
50- using type = T;
42+ template <typename T> struct add_lvalue_reference_if_not_pointer {
43+ using type = std::conditional_t <std::is_pointer_v<T>, T, T &>;
5144};
5245
5346// / If T is a pointer to X, return a pointer to const X. If it is not,
5447// / return const T.
55- template <typename T, typename Enable = void > struct add_const_past_pointer {
56- using type = const T;
48+ template <typename T> struct add_const_past_pointer {
49+ using type = std::conditional_t <std::is_pointer_v<T>,
50+ const std::remove_pointer_t <T> *, const T>;
5751};
5852
59- template <typename T>
60- struct add_const_past_pointer <T, std::enable_if_t <std::is_pointer_v<T>>> {
61- using type = const std::remove_pointer_t <T> *;
62- };
63-
64- template <typename T, typename Enable = void >
65- struct const_pointer_or_const_ref {
66- using type = const T &;
67- };
68- template <typename T>
69- struct const_pointer_or_const_ref <T, std::enable_if_t <std::is_pointer_v<T>>> {
70- using type = typename add_const_past_pointer<T>::type;
53+ template <typename T> struct const_pointer_or_const_ref {
54+ using type =
55+ std::conditional_t <std::is_pointer_v<T>,
56+ typename add_const_past_pointer<T>::type, const T &>;
7157};
7258
7359namespace detail {
0 commit comments