Modernize libartbase/ usage of <type_traits>...
... and other standard library templates.
Use `std::*_t<...>` and `std::*_v<...>` instead of
`std::*<...>::type` and `std::*<...>::value`.
Remove some unnecessary "typename" qualifiers and second
arguments to `static_assert()`.
Test: Rely on TreeHugger.
Change-Id: I4dc8e6fd905c60f652d3ac74bdf3d275b98daee8
diff --git a/libartbase/base/bit_struct.h b/libartbase/base/bit_struct.h
index 4cc222c..599e12a 100644
--- a/libartbase/base/bit_struct.h
+++ b/libartbase/base/bit_struct.h
@@ -112,7 +112,7 @@
size_t kBitWidth,
typename StorageType>
struct BitStructField {
- static_assert(std::is_standard_layout<T>::value, "T must be standard layout");
+ static_assert(std::is_standard_layout_v<T>, "T must be standard layout");
operator T() const {
return Get();
@@ -120,7 +120,7 @@
// Exclude overload when T==StorageType.
template <typename _ = void,
- typename = std::enable_if_t<std::is_same<T, StorageType>::value, _>>
+ typename = std::enable_if_t<std::is_same_v<T, StorageType>, _>>
explicit operator StorageType() const {
return BitFieldExtract(storage_, kBitOffset, kBitWidth);
}
@@ -151,7 +151,7 @@
// Since C++ doesn't allow the type of operator= to change out
// in the subclass, reimplement operator= in each subclass
// manually and call this helper function.
- static_assert(std::is_base_of<BitStructField, T2>::value, "T2 must inherit BitStructField");
+ static_assert(std::is_base_of_v<BitStructField, T2>, "T2 must inherit BitStructField");
what.Set(value);
return what;
}
@@ -172,10 +172,9 @@
private:
using ValueConverter = detail::ValueConverter<T>;
using ConversionType = typename ValueConverter::StorageType;
- using ExtractionType =
- typename std::conditional<std::is_signed_v<ConversionType>,
- std::make_signed_t<StorageType>,
- StorageType>::type;
+ using ExtractionType = std::conditional_t<std::is_signed_v<ConversionType>,
+ std::make_signed_t<StorageType>,
+ StorageType>;
StorageType storage_;
};