digitalmars.D.learn - DList!(Tuple!(TypeInfo_Class)) causes compilation error
- Zhenya (9/9) Dec 30 2012 Hi!
- Zhenya (14/23) Dec 30 2012 Used
- monarch_dodra (4/6) Dec 30 2012 The problem is that DList's opEqual *is* const qualified, which
- monarch_dodra (11/20) Dec 30 2012 Sounds like a bug in Tuple.opEqual: It, and its arguments, should
- Zhenya (2/24) Dec 30 2012 Thank you,that works.
Hi! I just need DList!(Tuple!(TypeInfo_Class)) for my n-dimensional dispatcher, but compiler says: Error: function std.typecons.Tuple!(TypeInfo_Class).Tuple.opEquals!(const(Tuple!(TypeIn o_Class))).opEquals (const(Tuple!(TypeInfo_Class)) rhs) is not callable using argument types (const(Tuple!(TypeInfo_Class))) const Could you give me some advice/workaround for this?
Dec 30 2012
On Sunday, 30 December 2012 at 20:09:57 UTC, Zhenya wrote:Hi! I just need DList!(Tuple!(TypeInfo_Class)) for my n-dimensional dispatcher, but compiler says: Error: function std.typecons.Tuple!(TypeInfo_Class).Tuple.opEquals!(const(Tuple!(TypeIn o_Class))).opEquals (const(Tuple!(TypeInfo_Class)) rhs) is not callable using argument types (const(Tuple!(TypeInfo_Class))) const Could you give me some advice/workaround for this?Used struct Wrapper(T) { T t; this(T a) { t = a; } alias t this; } Ugly a little bit,but works. Could anyone explain me please what's wrong with Tuple!TypeInfo_Class opEquals?
Dec 30 2012
On Sunday, 30 December 2012 at 21:28:37 UTC, Zhenya wrote:Could anyone explain me please what's wrong with Tuple!TypeInfo_Class opEquals?The problem is that DList's opEqual *is* const qualified, which means it is trying to compare some "const Tuple", which does not work, because Tuple does not define opEqual for const Tuples.
Dec 30 2012
On Sunday, 30 December 2012 at 20:09:57 UTC, Zhenya wrote:Hi! I just need DList!(Tuple!(TypeInfo_Class)) for my n-dimensional dispatcher, but compiler says: Error: function std.typecons.Tuple!(TypeInfo_Class).Tuple.opEquals!(const(Tuple!(TypeIn o_Class))).opEquals (const(Tuple!(TypeInfo_Class)) rhs) is not callable using argument types (const(Tuple!(TypeInfo_Class))) const Could you give me some advice/workaround for this?Sounds like a bug in Tuple.opEqual: It, and its arguments, should be const qualified, but aren't. I'll try and get it fixed for 2.061. In the mean time, you *could* try changing std.typecons.Tuple's opEqual: From: bool opEquals(R)(R rhs) if (isTuple!R) To: bool opEquals(R)(const R rhs) const if (isTuple!R) But I have not thoroughly tested this, so use at your own risk.
Dec 30 2012
On Sunday, 30 December 2012 at 21:30:04 UTC, monarch_dodra wrote:On Sunday, 30 December 2012 at 20:09:57 UTC, Zhenya wrote:Thank you,that works.Hi! I just need DList!(Tuple!(TypeInfo_Class)) for my n-dimensional dispatcher, but compiler says: Error: function std.typecons.Tuple!(TypeInfo_Class).Tuple.opEquals!(const(Tuple!(TypeIn o_Class))).opEquals (const(Tuple!(TypeInfo_Class)) rhs) is not callable using argument types (const(Tuple!(TypeInfo_Class))) const Could you give me some advice/workaround for this?Sounds like a bug in Tuple.opEqual: It, and its arguments, should be const qualified, but aren't. I'll try and get it fixed for 2.061. In the mean time, you *could* try changing std.typecons.Tuple's opEqual: From: bool opEquals(R)(R rhs) if (isTuple!R) To: bool opEquals(R)(const R rhs) const if (isTuple!R) But I have not thoroughly tested this, so use at your own risk.
Dec 30 2012