octave-maintainers
[Top][All Lists]
Advanced

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

Re: How to check for equality between 2 octave_value objects?


From: Michael Goffioul
Subject: Re: How to check for equality between 2 octave_value objects?
Date: Fri, 8 Aug 2008 19:48:34 +0200

On Fri, Aug 8, 2008 at 5:12 PM, John W. Eaton <address@hidden> wrote:
> On  8-Aug-2008, Michael Goffioul wrote:
>
> | Thinking about possible implementations, you might also
> | consider to add a method to the octave_value/octave_base_value
> | class like bool isequal (const octave_value& ov) and leave the
> | work of equality check to the derived class of octave_base_value.
>
> I suggested the other method because I think all other binary
> operators are handled by using a lookup table on both types rather
> than dispatching on the first and expecting that function to somehow
> be able to handle all others.  However, if what you are looking for is
> precise equality (integers do not compare equal to floats, for
> example), then this approach might be OK.

Indeed, what I'm looking for is precise equality. I can live with my
ad-hoc solution and I suggest that we don't change isequal for
the moment. It's really not a priority.

For your information, the context is the following. I'm trying to
make property "set" to only trigger actions (listeners, backend
notification...) when the property value is actually changed.
In the case of array_property, I wanted to check the new value
against the current value. In this context, I decided that "equal"
meant same element type, same dims and same elements.

Michael.


reply via email to

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