templates + operator overloading problem

BC NOTmi_emayl_adrez at hotmail.com.remove.not
Sat Dec 8 11:28:44 PST 2007


i'm doing a lambda functions thing and I've got this

class Lambda(T)
{
    Ret2!(RHST).Ret opSub(RHST)(RHST rhs)
    {
       return Ret2!(RHST).opAdd(rhs);
    }
    Ret2!(RHST).Ret opSub_r(RHST)(RHST rhs)
    {
       return Ret2!(RHST).opAdd(rhs);
    }
}

i need to be able to accept an operand of any type on either side
(for constants in expressions)
unfortunately D says this is ambiguous and gives a compile error
whenever I subtract Lambda from Lambda. i can specialise it for the
case when it *is* Lambda, but i can't get rid of the need for a
catch all for the constants. i can't see any way around
this? is there?

BC


More information about the Digitalmars-d-learn mailing list