Exemplo n.º 1
0
template <class Scalar> inline
bool BlockIterator<Scalar>
::operator<(const BlockIterator<Scalar>& other) const
{
  if (debug())
  {
    Out::os() << "comparing (<): LHS=" << *this
              << ", RHS=" << other << std::endl;
  }
  TEUCHOS_TEST_FOR_EXCEPTION(this->space() != other.space(),
    RuntimeError, "Attempt to compare block iterators attached to "
    "two different spaces");

  if (!this->atEnd_ && other.atEnd_) return true;
  if (this->atEnd_ && !other.atEnd_) return false;
  if (this->atEnd_ && other.atEnd_) return false;

  int d = std::min(this->index_.size(), other.index_.size());
  

  for (int i=0; i<d; i++)
  {
    if (this->index_[i] < other.index_[i]) return true;
    if (this->index_[i] > other.index_[i]) return false;
  }

  return false;
}