clang-tidy: Add check modernize-type-traits
Add and apply clang-tidy check modernize-type-traits.
This check enforces the rule of preferring to use type traits in short form traits_t<...>
and traits_v<...>
, instead of the long form traits<...>::type
and traits<...>::value
, respectively. This improves readability and makes lines shorter.
Example:
// Prefer to use the shorter version of type traits
std::enable_if_t<std::is_integral_v<T>, Time>
std::is_integral_v<T>
std::is_same_v<int, float>
// Avoid the longer form of type traits
std::enable_if<std::is_integral<T>::value, Time>::type
std::is_integral<T>::value
std::is_same<int, float>::value
Edited by Eduardo Almeida