[llvm] 2bb43d7 - [ADT] Use std::tuple_element_t (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 3 23:27:56 PDT 2022
Author: Kazu Hirata
Date: 2022-09-03T23:27:24-07:00
New Revision: 2bb43d72d91cdc269fd756725a5f187dcb48b038
URL: https://github.com/llvm/llvm-project/commit/2bb43d72d91cdc269fd756725a5f187dcb48b038
DIFF: https://github.com/llvm/llvm-project/commit/2bb43d72d91cdc269fd756725a5f187dcb48b038.diff
LOG: [ADT] Use std::tuple_element_t (NFC)
Added:
Modified:
llvm/include/llvm/ADT/DenseMapInfo.h
llvm/include/llvm/ADT/STLExtras.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/DenseMapInfo.h b/llvm/include/llvm/ADT/DenseMapInfo.h
index 01e96a58d748..1c00fb699cc2 100644
--- a/llvm/include/llvm/ADT/DenseMapInfo.h
+++ b/llvm/include/llvm/ADT/DenseMapInfo.h
@@ -254,7 +254,7 @@ template <typename... Ts> struct DenseMapInfo<std::tuple<Ts...>> {
template <unsigned I>
static unsigned getHashValueImpl(const Tuple &values, std::false_type) {
- using EltType = typename std::tuple_element<I, Tuple>::type;
+ using EltType = std::tuple_element_t<I, Tuple>;
std::integral_constant<bool, I + 1 == sizeof...(Ts)> atEnd;
return detail::combineHashValue(
DenseMapInfo<EltType>::getHashValue(std::get<I>(values)),
@@ -273,7 +273,7 @@ template <typename... Ts> struct DenseMapInfo<std::tuple<Ts...>> {
template <unsigned I>
static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type) {
- using EltType = typename std::tuple_element<I, Tuple>::type;
+ using EltType = std::tuple_element_t<I, Tuple>;
std::integral_constant<bool, I + 1 == sizeof...(Ts)> atEnd;
return DenseMapInfo<EltType>::isEqual(std::get<I>(lhs), std::get<I>(rhs)) &&
isEqualImpl<I + 1>(lhs, rhs, atEnd);
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 34c5058806b1..88ec10e03ba0 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -112,7 +112,7 @@ struct function_traits<ReturnType (ClassType::*)(Args...) const, false> {
/// The type of an argument to this function.
template <size_t Index>
- using arg_t = typename std::tuple_element<Index, std::tuple<Args...>>::type;
+ using arg_t = std::tuple_element_t<Index, std::tuple<Args...>>;
};
/// Overload for class function types.
template <typename ClassType, typename ReturnType, typename... Args>
@@ -129,7 +129,7 @@ struct function_traits<ReturnType (*)(Args...), false> {
/// The type of an argument to this function.
template <size_t i>
- using arg_t = typename std::tuple_element<i, std::tuple<Args...>>::type;
+ using arg_t = std::tuple_element_t<i, std::tuple<Args...>>;
};
template <typename ReturnType, typename... Args>
struct function_traits<ReturnType (*const)(Args...), false>
@@ -618,13 +618,14 @@ template<typename... Iters> struct ZipTupleType {
template <typename ZipType, typename... Iters>
using zip_traits = iterator_facade_base<
- ZipType, typename std::common_type<std::bidirectional_iterator_tag,
- typename std::iterator_traits<
- Iters>::iterator_category...>::type,
+ ZipType,
+ typename std::common_type<
+ std::bidirectional_iterator_tag,
+ typename std::iterator_traits<Iters>::iterator_category...>::type,
// ^ TODO: Implement random access methods.
typename ZipTupleType<Iters...>::type,
- typename std::iterator_traits<typename std::tuple_element<
- 0, std::tuple<Iters...>>::type>::
diff erence_type,
+ typename std::iterator_traits<
+ std::tuple_element_t<0, std::tuple<Iters...>>>::
diff erence_type,
// ^ FIXME: This follows boost::make_zip_iterator's assumption that all
// inner iterators have the same
diff erence_type. It would fail if, for
// instance, the second field's
diff erence_type were non-numeric while the
@@ -799,8 +800,8 @@ class zip_longest_iterator
std::forward_iterator_tag,
typename std::iterator_traits<Iters>::iterator_category...>::type,
typename ZipLongestTupleType<Iters...>::type,
- typename std::iterator_traits<typename std::tuple_element<
- 0, std::tuple<Iters...>>::type>::
diff erence_type,
+ typename std::iterator_traits<
+ std::tuple_element_t<0, std::tuple<Iters...>>>::
diff erence_type,
typename ZipLongestTupleType<Iters...>::type *,
typename ZipLongestTupleType<Iters...>::type> {
public:
More information about the llvm-commits
mailing list