www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DList!(Tuple!(TypeInfo_Class)) causes compilation error

reply "Zhenya" <zheny list.ru> writes:
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
next sibling parent reply "Zhenya" <zheny list.ru> writes:
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
parent "monarch_dodra" <monarchdodra gmail.com> writes:
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
prev sibling parent reply "monarch_dodra" <monarchdodra gmail.com> writes:
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
parent "Zhenya" <zheny list.ru> writes:
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:
 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.
Thank you,that works.
Dec 30 2012