Domain::operator<
    Allan Stokes 
    allan at stokes.ca
       
    Tue Jun 26 07:26:46 UTC 2001
    
    
  
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
    
    
More information about the pooma-dev
mailing list