Thread overview
DList!(Tuple!(TypeInfo_Class)) causes compilation error
Dec 30, 2012
Zhenya
Dec 30, 2012
Zhenya
Dec 30, 2012
monarch_dodra
Dec 30, 2012
monarch_dodra
Dec 30, 2012
Zhenya
December 30, 2012
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!(TypeInfo_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?
December 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!(TypeInfo_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?
December 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!(TypeInfo_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.
December 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.
December 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:
>> 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!(TypeInfo_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.