Use std::remove_cvref instead of std::decay

This commit is contained in:
Maxime Coste 2020-11-17 07:02:40 +11:00
parent ab9d78f50d
commit bea23c6bf2
5 changed files with 11 additions and 11 deletions

View File

@ -509,8 +509,8 @@ std::unique_ptr<Highlighter> create_dynamic_regex_highlighter(HighlighterParamet
}
auto make_hl = [](auto& regex_getter, auto& face_getter) {
return std::make_unique<DynamicRegexHighlighter<std::decay_t<decltype(regex_getter)>,
std::decay_t<decltype(face_getter)>>>(
return std::make_unique<DynamicRegexHighlighter<std::remove_cvref_t<decltype(regex_getter)>,
std::remove_cvref_t<decltype(face_getter)>>>(
std::move(regex_getter), std::move(face_getter));
};
auto get_face = [faces=std::move(faces)](const Context& context, const Regex& regex){

View File

@ -9,7 +9,7 @@ UnitTest test_option_parsing{[]{
{
auto repr = option_to_strings(value);
kak_assert(strs == ConstArrayView<String>{repr});
auto parsed = option_from_strings(Meta::Type<std::decay_t<decltype(value)>>{}, strs);
auto parsed = option_from_strings(Meta::Type<std::remove_cvref_t<decltype(value)>>{}, strs);
kak_assert(parsed == value);
};

View File

@ -15,7 +15,7 @@ namespace Kakoune
template<typename Func> struct ViewFactory { Func func; };
template<typename Func>
ViewFactory<std::decay_t<Func>>
ViewFactory<std::remove_cvref_t<Func>>
make_view_factory(Func&& func) { return {std::forward<Func>(func)}; }
template<typename Range, typename Func>
@ -25,7 +25,7 @@ decltype(auto) operator| (Range&& range, ViewFactory<Func> factory)
}
template<typename Range>
struct decay_range_impl { using type = std::decay_t<Range>; };
struct decay_range_impl { using type = std::remove_cvref_t<Range>; };
template<typename Range>
struct decay_range_impl<Range&> { using type = Range&; };
@ -261,11 +261,11 @@ inline auto transform(Transform t)
});
}
template<typename T, typename U, typename = void>
template<typename T, typename U>
struct is_pointer_like : std::false_type {};
template<typename T, typename U>
struct is_pointer_like<T, U, std::enable_if_t<std::is_same_v<std::decay_t<decltype(*std::declval<U>())>, std::decay_t<T>>>> : std::true_type {};
template<typename T, typename U> requires std::is_same_v<std::remove_cvref_t<decltype(*std::declval<U>())>, std::remove_cvref_t<T>>
struct is_pointer_like<T, U> : std::true_type {};
template<typename M, typename T>
inline auto transform(M T::*member)
@ -547,7 +547,7 @@ auto elements()
return *it;
};
// Note that initializer lists elements are guaranteed to be sequenced
Array<std::decay_t<decltype(*begin(range))>, sizeof...(Indexes)> res{{elem(Indexes)...}};
Array<std::remove_cvref_t<decltype(*begin(range))>, sizeof...(Indexes)> res{{elem(Indexes)...}};
if (exact_size and ++it != end_it)
throw ExceptionType{++i};
return res;

View File

@ -205,7 +205,7 @@ struct Overload : Funcs...
template<typename... Funcs>
auto overload(Funcs&&... funcs)
{
return Overload<std::decay_t<Funcs>...>{std::forward<Funcs>(funcs)...};
return Overload<std::remove_cvref_t<Funcs>...>{std::forward<Funcs>(funcs)...};
}
}

View File

@ -18,7 +18,7 @@ struct Value
template<typename T> requires (not std::is_same_v<Value, T>)
Value(T&& val)
: m_value{new Model<std::decay_t<T>>{std::forward<T>(val)}} {}
: m_value{new Model<std::remove_cvref_t<T>>{std::forward<T>(val)}} {}
Value(const Value& val) = delete;
Value(Value&&) = default;