Use C++17 variable templates for type traits

The C++17 variable templates are slightly more readable and allow us to
remove the typename keyword in a few cases.

closes https://github.com/official-stockfish/Stockfish/pull/4806

No functional change
This commit is contained in:
Sebastian Buchwald
2023-09-25 12:24:48 +02:00
committed by Disservin
parent 31d0b7fe93
commit 4f0fecad8a
4 changed files with 11 additions and 11 deletions
+2 -2
View File
@@ -102,7 +102,7 @@ constexpr Value WDL_to_value[] = {
template<typename T, int Half = sizeof(T) / 2, int End = sizeof(T) - 1>
inline void swap_endian(T& x)
{
static_assert(std::is_unsigned<T>::value, "Argument of swap_endian not unsigned");
static_assert(std::is_unsigned_v<T>, "Argument of swap_endian not unsigned");
uint8_t tmp, *c = (uint8_t*)&x;
for (int i = 0; i < Half; ++i)
@@ -332,7 +332,7 @@ struct PairsData {
// first access, when the corresponding file is memory mapped.
template<TBType Type>
struct TBTable {
using Ret = typename std::conditional<Type == WDL, WDLScore, int>::type;
using Ret = std::conditional_t<Type == WDL, WDLScore, int>;
static constexpr int Sides = Type == WDL ? 2 : 1;