lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Avoiding PETE's overloaded operator==()


From: Greg Chicares
Subject: Re: [lmi] Avoiding PETE's overloaded operator==()
Date: Sat, 05 Jun 2010 15:12:14 +0000
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

On 2010-06-05 14:30Z, Vadim Zeitlin wrote:
> On Fri, 04 Jun 2010 22:30:42 +0000 Greg Chicares <address@hidden> wrote:
> 
> GC> Calling std::operator==() explicitly seems weird, but is there a
> GC> better way to avoid the PETE problem below (revision 4975)?
> 
>  Unfortunately I think this is a real bug in PETE and none of the binary
> operators defined in et_vector_operators.hpp can be used with 2 vectors as
> all of them are defined both in (vector<T1>,vector<T2>), (vector<T1>,T2)
> and (T1,vector<T2>) forms which is clearly ambiguous. I think it should be
> possible to exclude the latter two from consideration by using some
> boost::enable_if-like tricks to disable them when T2==vector<T1> and also
> exclude the first one by enabling it only if T1!=T2. But this would take
> some time because the file is generated so we'd need to modify
> MakeOperators to produce the modified version and I didn't look at it yet
> to see how easy or difficult will this be.
> 
>  Should I?

No, I don't think we should.

IMO, my example doesn't demonstrate a PETE defect. For these two vectors:
  v0 {1, 2, 3}
  v1 {1, 2, 4}
if you applied APL's equality operator, you'd get this vector:
  1 1 0
To determine whether all elements are equal, you'd AND-reduce that to a
scalar, which would be zero. PETE doesn't seem to have reduction, but its
where() function would be useful with its member-by-member equality operator.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]