Hi,
I do not understand the following error message. I have template
structure Decimal, which is used in a OrderDb structure.
Comparing two OrderDb structures is working, but trying to compare
two OrderDb array structures ends with an error message:
object.Error: TypeInfo.equals is not implemented.
Kind regards
André
--- Code ---
import std.traits: isInstanceOf;
struct Decimal(int precision, int scale){
bool opEquals(T)(T d)
if (isInstanceOf!(Decimal, T))
{
return false;
}
}
struct OrderDb{
string orderId;
Decimal!(10,2) amount;
}
void main(){
auto o1 = OrderDb();
auto o2 = OrderDb();
if (o1 == o2) {}; // Works
if ([o1] == [o2]) {}; // object.Error: TypeInfo.equals is not
implemented
}