1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-17 09:22:42 +01:00

Codechange: add concept of ConvertibleThroughBase for strong types

This makes it possible to write templated alternatives for ConvertibleThroughBase
which are then available for any (strong) type that implements a base() function
In the end making adding new ConvertibleThroughBase types less awkward.
This commit is contained in:
Rubidium
2025-02-01 12:57:01 +01:00
committed by rubidium42
parent 3e747397f0
commit 55588b052e
11 changed files with 68 additions and 49 deletions

View File

@@ -1949,8 +1949,7 @@ static bool OrderConditionCompare(OrderConditionComparator occ, int variable, in
}
}
template <typename T, std::enable_if_t<std::is_base_of<StrongTypedefBase, T>::value, int> = 0>
static bool OrderConditionCompare(OrderConditionComparator occ, T variable, int value)
static bool OrderConditionCompare(OrderConditionComparator occ, ConvertibleThroughBase auto variable, int value)
{
return OrderConditionCompare(occ, variable.base(), value);
}