hello . ive got a simple question.
how do i create a method in my class which tells me the size of my list
..............
int size(void){
int s=0;
for (pos = begin(); pos.not_equal(e nd()); pos.next())
{s++;}
return s;
}
...............
here is the methods for begin and end:
Iterator List::begin()
{ Iterator iter;
iter.position = first;
iter.last = last;
return iter;
}
Iterator List::end()
{ Iterator iter;
iter.position = NULL;
iter.last = last;
return iter;
}
how do i create a method in my class which tells me the size of my list
..............
int size(void){
int s=0;
for (pos = begin(); pos.not_equal(e nd()); pos.next())
{s++;}
return s;
}
...............
here is the methods for begin and end:
Iterator List::begin()
{ Iterator iter;
iter.position = first;
iter.last = last;
return iter;
}
Iterator List::end()
{ Iterator iter;
iter.position = NULL;
iter.last = last;
return iter;
}
Comment