const Point& Cluster::operator[](unsigned int u) const { if(__size == 0) { throw EmptyClusterEx(); } if(u >= __size) { throw OutOfBoundsEx(u, __size); } LNodePtr cursor = __points; for(int i = 0; i < u; i++) { cursor = cursor->next; } return cursor->point; }
// Operators // Members: Sub-script const Point &Cluster::operator[](unsigned int index) const { if (__size == 0) throw EmptyClusterEx(); if (index >= __size) throw OutOfBoundsEx(__size, index); LNodePtr cursor = __points; for (int i = 0; i < index; ++i) { cursor = cursor->next; } return cursor->point; }
const Point &Cluster::operator[](unsigned int index) const{ LNodePtr temp; temp = __points; if(getSize() == 0){ throw EmptyClusterEx(); } if(index > getSize()-1){ throw OutOfBoundsEx(getSize()-1,index); } if(index == 0){ return __points->point; } for(int i = 0; i < index; ++i){ temp = temp->next; } return temp->point; }