diff --git a/src/history.h b/src/history.h index 9ae7bdadc..fd9b98b98 100644 --- a/src/history.h +++ b/src/history.h @@ -71,7 +71,7 @@ inline int non_pawn_index(const Position& pos) { template class StatsEntry { - static_assert(std::is_arithmetic::value, "Not an arithmetic type"); + static_assert(std::is_arithmetic_v, "Not an arithmetic type"); static_assert(D <= std::numeric_limits::max(), "D overflows T"); T entry; diff --git a/src/misc.h b/src/misc.h index 8adbac68a..d2cbb699d 100644 --- a/src/misc.h +++ b/src/misc.h @@ -155,6 +155,10 @@ struct MultiArrayHelper { using ChildType = T; }; +template +constexpr bool is_strictly_assignable_v = + std::is_assignable_v && (std::is_same_v || !std::is_convertible_v); + } // MultiArray is a generic N-dimensional array. @@ -212,7 +216,8 @@ class MultiArray { template void fill(const U& v) { - static_assert(std::is_assignable_v, "Cannot assign fill value to entry type"); + static_assert(Detail::is_strictly_assignable_v, + "Cannot assign fill value to entry type"); for (auto& ele : data_) { if constexpr (sizeof...(Sizes) == 0)