@@ -203,7 +203,7 @@ template <typename T> T FuzzedDataProvider::ConsumeIntegral() {
203
203
// be less than or equal to |max|.
204
204
template <typename T>
205
205
T FuzzedDataProvider::ConsumeIntegralInRange (T min, T max) {
206
- static_assert (std::is_integral <T>::value , " An integral type is required." );
206
+ static_assert (std::is_integral_v <T>, " An integral type is required." );
207
207
static_assert (sizeof (T) <= sizeof (uint64_t ), " Unsupported integral type." );
208
208
209
209
if (min > max)
@@ -271,14 +271,14 @@ T FuzzedDataProvider::ConsumeFloatingPointInRange(T min, T max) {
271
271
// Returns a floating point number in the range [0.0, 1.0]. If there's no
272
272
// input data left, always returns 0.
273
273
template <typename T> T FuzzedDataProvider::ConsumeProbability () {
274
- static_assert (std::is_floating_point <T>::value ,
274
+ static_assert (std::is_floating_point_v <T>,
275
275
" A floating point type is required." );
276
276
277
277
// Use different integral types for different floating point types in order
278
278
// to provide better density of the resulting values.
279
279
using IntegralType =
280
- typename std::conditional <(sizeof (T) <= sizeof (uint32_t )), uint32_t ,
281
- uint64_t >::type ;
280
+ typename std::conditional_t <(sizeof (T) <= sizeof (uint32_t )), uint32_t ,
281
+ uint64_t >;
282
282
283
283
T result = static_cast <T>(ConsumeIntegral<IntegralType>());
284
284
result /= static_cast <T>(std::numeric_limits<IntegralType>::max ());
@@ -294,7 +294,7 @@ inline bool FuzzedDataProvider::ConsumeBool() {
294
294
// also contain |kMaxValue| aliased to its largest (inclusive) value. Such as:
295
295
// enum class Foo { SomeValue, OtherValue, kMaxValue = OtherValue };
296
296
template <typename T> T FuzzedDataProvider::ConsumeEnum () {
297
- static_assert (std::is_enum <T>::value , " |T| must be an enum type." );
297
+ static_assert (std::is_enum_v <T>, " |T| must be an enum type." );
298
298
return static_cast <T>(
299
299
ConsumeIntegralInRange<uint32_t >(0 , static_cast <uint32_t >(T::kMaxValue )));
300
300
}
0 commit comments