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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user