Skip to content

Commit a27334a

Browse files
committed
🔥 Remove remove_cvref_t
Problem: - `remove_cvref_t` is a C++20 feature that has long since been available in supported toolchains. - See https://cppstat.dev/?search=remove_cvref Solution: - Remove `remove_cvref_t`. Note: - Many places were already using `std::remove_cvref_t`.
1 parent 821ff9a commit a27334a

20 files changed

Lines changed: 44 additions & 70 deletions

docs/header_graph.mmd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ flowchart BT
2424
concepts(<a href="https://github.com/intel/cpp-std-extensions/tree/main/include/stdx/concepts.hpp">concepts.hpp</a>)
2525
concepts --> type_traits
2626
udls(<a href="https://github.com/intel/cpp-std-extensions/tree/main/include/stdx/udls.hpp">udls.hpp</a>)
27-
udls --> type_traits
2827
function_traits(<a href="https://github.com/intel/cpp-std-extensions/tree/main/include/stdx/function_traits.hpp">function_traits.hpp</a>)
2928
function_traits --> type_traits
3029

docs/type_traits.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ contains a few things from the standard:
1010
* https://en.cppreference.com/w/cpp/types/is_constant_evaluated[`is_constant_evaluated`] (from C++20)
1111
* https://en.cppreference.com/w/cpp/types/is_function[`is_function_v`] (implemented with Walter Brown's method)
1212
* https://en.cppreference.com/w/cpp/types/is_scoped_enum[`is_scoped_enum_v`] (from C++23)
13-
* https://en.cppreference.com/w/cpp/types/remove_cvref[`remove_cvref_t`] (from C++20)
1413
* https://en.cppreference.com/w/cpp/utility/to_underlying[`to_underlying`] (from C++23)
1514
* https://en.cppreference.com/w/cpp/types/type_identity[`type_identity`] (from C++20)
1615

include/stdx/byterator.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ template <typename T> class byterator {
163163
}
164164

165165
template <typename V>
166-
requires std::is_trivially_copyable_v<remove_cvref_t<V>>
166+
requires std::is_trivially_copyable_v<std::remove_cvref_t<V>>
167167
auto write(V &&v) -> void {
168-
using R = remove_cvref_t<V>;
168+
using R = std::remove_cvref_t<V>;
169169
std::memcpy(ptr, std::addressof(v), sizeof(R));
170170
advance<R>();
171171
}

include/stdx/cached.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include <stdx/compiler.hpp>
44
#include <stdx/latched.hpp>
5-
#include <stdx/type_traits.hpp>
65

76
namespace stdx {
87
inline namespace v1 {
@@ -17,7 +16,7 @@ template <typename F> struct cached : latched<F> {
1716
}
1817
};
1918

20-
template <typename F> cached(F) -> cached<remove_cvref_t<F>>;
19+
template <typename F> cached(F) -> cached<std::remove_cvref_t<F>>;
2120

2221
template <typename C> using cached_value_t = latched_value_t<C>;
2322
} // namespace v1

include/stdx/call_by_need.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ constexpr auto call_by_need(Fs &&fs, Args &&args) {
156156
std::forward<Fs>(fs)))...>::
157157
template compute_call_info<decltype(get<Js>(
158158
std::forward<Args>(args)))...>();
159-
}(std::make_index_sequence<tuple_size_v<remove_cvref_t<Fs>>>{},
160-
std::make_index_sequence<tuple_size_v<remove_cvref_t<Args>>>{});
159+
}(std::make_index_sequence<tuple_size_v<std::remove_cvref_t<Fs>>>{},
160+
std::make_index_sequence<tuple_size_v<std::remove_cvref_t<Args>>>{});
161161

162162
auto new_fs = [&]<std::size_t... Is>(std::index_sequence<Is...>) {
163163
return tuple{get<Is>(std::forward<Fs>(fs))...,

include/stdx/concepts.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ template <typename T, typename... Us>
5050
constexpr auto same_none = not same_any<T, Us...>;
5151

5252
template <typename T, typename U>
53-
concept same_as_unqualified = same_as<remove_cvref_t<T>, remove_cvref_t<U>>;
53+
concept same_as_unqualified =
54+
same_as<std::remove_cvref_t<T>, std::remove_cvref_t<U>>;
5455

5556
template <typename T>
5657
concept equality_comparable = requires(T const &t) {
@@ -137,7 +138,8 @@ template <typename T, template <typename> typename TypeTrait>
137138
concept has_trait = TypeTrait<T>::value;
138139

139140
template <typename T, typename U>
140-
concept same_as_unqualified = same_as<remove_cvref_t<T>, remove_cvref_t<U>>;
141+
concept same_as_unqualified =
142+
same_as<std::remove_cvref_t<T>, std::remove_cvref_t<U>>;
141143

142144
template <typename T>
143145
concept structural = is_structural_v<T>;

include/stdx/function_traits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ template <typename F, typename = void> struct detect_call_operator {
128128
};
129129
template <typename F>
130130
struct detect_call_operator<
131-
F, std::void_t<decltype(&remove_cvref_t<F>::operator())>>
132-
: function_traits<decltype(&remove_cvref_t<F>::operator())> {};
131+
F, std::void_t<decltype(&std::remove_cvref_t<F>::operator())>>
132+
: function_traits<decltype(&std::remove_cvref_t<F>::operator())> {};
133133

134134
template <typename F> struct function_traits : detect_call_operator<F> {};
135135
} // namespace detail

include/stdx/functional.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct bind_front_t<F, std::index_sequence<Is...>, BoundArgs...> {
5656

5757
template <typename F, typename... Args>
5858
constexpr auto bind_front(F &&f, Args &&...args) {
59-
return detail::bind_front_t<stdx::remove_cvref_t<F>,
59+
return detail::bind_front_t<std::remove_cvref_t<F>,
6060
std::make_index_sequence<sizeof...(Args)>,
6161
std::decay_t<Args>...>{
6262
std::forward<F>(f), {std::forward<Args>(args)...}};
@@ -112,7 +112,7 @@ struct bind_back_t<F, std::index_sequence<Is...>, BoundArgs...> {
112112

113113
template <typename F, typename... Args>
114114
constexpr auto bind_back(F &&f, Args &&...args) {
115-
return detail::bind_back_t<stdx::remove_cvref_t<F>,
115+
return detail::bind_back_t<std::remove_cvref_t<F>,
116116
std::make_index_sequence<sizeof...(Args)>,
117117
std::decay_t<Args>...>{
118118
std::forward<F>(f), {std::forward<Args>(args)...}};

include/stdx/iterator.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace stdx {
1313
inline namespace v1 {
1414
namespace detail {
1515
template <typename T> struct ct_capacity_fail {
16-
static_assert(always_false_v<stdx::remove_cvref_t<T>>,
16+
static_assert(always_false_v<std::remove_cvref_t<T>>,
1717
"Type does not support compile-time capacity");
1818
};
1919
} // namespace detail
@@ -31,7 +31,7 @@ template <typename T> constexpr auto ct_capacity_v<T const> = ct_capacity_v<T>;
3131

3232
template <typename T>
3333
consteval auto ct_capacity([[maybe_unused]] T &&) -> std::size_t {
34-
return ct_capacity_v<remove_cvref_t<T>>;
34+
return ct_capacity_v<std::remove_cvref_t<T>>;
3535
}
3636

3737
template <typename T = int, typename = std::enable_if_t<std::is_integral_v<T>>>

include/stdx/latched.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace stdx {
1212
inline namespace v1 {
1313
template <typename F> struct latched {
14-
using value_type = stdx::remove_cvref_t<std::invoke_result_t<F>>;
14+
using value_type = std::remove_cvref_t<std::invoke_result_t<F>>;
1515

1616
constexpr explicit latched(F const &f) : lazy{f} {}
1717
constexpr explicit latched(F &&f) : lazy{std::move(f)} {}
@@ -56,6 +56,6 @@ template <typename F> struct latched {
5656
};
5757

5858
template <typename C>
59-
using latched_value_t = typename stdx::remove_cvref_t<C>::value_type;
59+
using latched_value_t = typename std::remove_cvref_t<C>::value_type;
6060
} // namespace v1
6161
} // namespace stdx

0 commit comments

Comments
 (0)