Le test étant un test strict, il faut renvoyer des indices en dehors de la zone allouée. Ce qui nous donne :
colormap::iterator colormap::iterator::end()
{
iterator ite(*this);
if(mode==forward)
ite.current=nb_color;
else
ite.current=-1;
return ite;
}
colormap::iterator colormap::iterator::operator++(int nothing)
{
colormap::iterator tmp(*this);
if(mode==forward)
current++;
else
current--;
return tmp;
}
et
colormap::iterator& colormap::iterator::operator++()
{
if(mode==forward)
current++;
else
current--;
return *this;
}
bool colormap::iterator::operator <(const colormap::iterator &ite)
{
if(mode==forward)
return current < ite.current;
return current > ite.current;
}