From: Sylvain Pion (pion_at_[hidden])
Date: 2002-09-05 19:37:58
On Thu, Sep 05, 2002 at 08:11:01PM -0400, David Bergman wrote:
> I almost agree. But, as Herve pointed out earlier when reminding us that
> an interval actually is more than its endpoints, one should not diverge
> into the road of std::pair or std::complex too far. An interval is
> actually quite different, except in its possible representation and
I really think interval is quite similar to complex (at this level).
> The lexicographic order, which is total and fairly "natural" in
It's not that natural to me. It is not related to the nature of intervals.
As you quoted Herve : it's not 2 endpoints, it's all the values inbetween,
hence lexicographic order doesn't mean much.
> is a bit awkward in std::complex (unless we regard the
> Re-part as more important than the Im-part, which does happen,
IMHO, it's just as awkward for complex as it is for interval.
Why should you consider the lower bound more important than the upper bound ?
A std::pair is really syntactic sugar for keeping two different things as
though they were one object.
Nothing can change "internally" there : you even have access to the
data members in the public interface !
For complex, the internals are hidden, because you may think of a polar
internal representation for example. For intervals, you may think about a
possible alternate representation, like a pair of (approximation, epsilon),
which sometimes has some advantages for controlling roundoff errors.
How would you fit the lexicographical order in there ?
> So, we might have a possibility here to actually (a) use intervals in
> STL structures and algorithms and
Nothing is prevented, users would just have to define their own functor.
Just like they have to do so for std::complex.