[pooma-dev] Domain::operator<
James Crotinger
JimC at proximation.com
Tue Jun 26 17:43:16 UTC 2001
I haven't looked, but this might be used in DomainMap. I agree that we
should fix this to be a complete ordering.
Since this is a template member, I'm assuming that it was an explicit
decision to allow different types of domains to be compared. I think this
makes sense for Interval, Range, and Grid.
Jim
> -----Original Message-----
> From: Allan Stokes [mailto:allan at stokes.ca]
> Sent: Tuesday, June 26, 2001 1:27 AM
> To: Pooma-Dev
> Subject: [pooma-dev] Domain::operator<
>
>
>
> Hello,
>
> I spent my time today converting my Domain notes into a
> DocBook document.
> At this point the bottom half of the document resembles a
> code review, the
> top half of the document discusses concepts.
>
> While I was checking into equivalence and ordering I came across this
> function definition from Domain.h:
>
> template<class T>
> bool operator<(const T &d2) const {
> CTAssert(Dim == DomainTraits<T>::dimensions);
> for (int i = 0; i < Dim; i++)
> if (domain_m[i] >= DomainTraits<T>::getDomain(d2, i))
> return false;
> return true;
> }
>
>
> This is not a complete ordering relation.
>
> 3 4 < 3 5 : false
> 3 5 < 3 4 : false
> 3 5 == 3 4 : false
>
> I also see that operator!=, operator>, operator<=, operator>= are all
> defined individually rather than have just operator== and
> operator< and
> everything else defined in terms of these.
>
> Is this meant to be an ordering relation? Or this is this
> just a typo? Is
> there any situation where it matters how domains are ordered?
>
> I also noted that there is a CTAssert() that both domains
> have the same Dim.
> This creates a separate equivalence class and ordering
> relation for each N.
> Since Domain<N> and Domain<M> are different types where N!=M
> this could be
> the right choice.
>
> However, the way these function signatures are set up we
> aren't checking
> that T is the same type of Domain (Grid, Interval, etc.) as
> *this. Is there
> a reason why having the same dimensions in the types is more
> important that
> having the same domain types?
>
> Allan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20010626/4bc4df1a/attachment.html>
More information about the pooma-dev
mailing list