0
0
Fork 0
geforkt von LengKundee/NUNA
NUNA_FORK/Include/Generic/Internal/EqualFunction.mqh

26 Zeilen
1,1 KiB
MQL5

2026-01-06 05:44:21 +00:00
//+------------------------------------------------------------------+
//| EqualFunction.mqh |
//| Copyright 2000-2025, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#include <Generic\Interfaces\IEqualityComparable.mqh>
//+------------------------------------------------------------------+
//| Indicates whether x object is equal y object of the same type. |
//+------------------------------------------------------------------+
template<typename T>
bool Equals(T x,T y)
{
//--- try to convert to equality comparable object
IEqualityComparable<T>*equtable=dynamic_cast<IEqualityComparable<T>*>(x);
if(equtable)
{
//--- use specied equality compare method
return equtable.Equals(y);
}
else
{
//--- use default equality comparer operator
return(x==y);
}
}
//+------------------------------------------------------------------+