digitalmars.D.learn - Error: TypeInfo.equals is not implemented
- Andre (27/27) Feb 08 2014 Hi,
- Stanislav Blinov (8/8) Feb 08 2014 opEquals should be const:
- bearophile (4/12) Feb 08 2014 DMD needs to give better error messages in such cases.
- Stanislav Blinov (2/3) Feb 08 2014 Naturally. Especially since that was a runtime exception %\
- bearophile (4/5) Feb 08 2014 Is this already in a bugzilla entry?
- Stanislav Blinov (2/3) Feb 08 2014 Can't find anything similar. I'll reduce and post it.
- Stanislav Blinov (1/1) Feb 08 2014 https://d.puremagic.com/issues/show_bug.cgi?id=12108
- Andre (4/5) Feb 08 2014 Thanks a lot.
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 }
Feb 08 2014
opEquals should be const: struct Decimal(int precision, int scale){ bool opEquals(T)(T d) const if (isInstanceOf!(Decimal, T)) { return false; } }
Feb 08 2014
Stanislav Blinov:opEquals should be const: struct Decimal(int precision, int scale){ bool opEquals(T)(T d) const if (isInstanceOf!(Decimal, T)) { return false; } }DMD needs to give better error messages in such cases. Bye, bearophile
Feb 08 2014
On Saturday, 8 February 2014 at 14:15:56 UTC, bearophile wrote:DMD needs to give better error messages in such cases.Naturally. Especially since that was a runtime exception %\
Feb 08 2014
Stanislav Blinov:Naturally. Especially since that was a runtime exception %\Is this already in a bugzilla entry? Bye, bearophile
Feb 08 2014
On Saturday, 8 February 2014 at 15:51:11 UTC, bearophile wrote:Is this already in a bugzilla entry?Can't find anything similar. I'll reduce and post it.
Feb 08 2014
Am 08.02.2014 17:14, schrieb Stanislav Blinov:https://d.puremagic.com/issues/show_bug.cgi?id=12108Thanks a lot. Kind regards André
Feb 08 2014