list's don't support random access, ie "by element number" you have to do something like this
Code:
template<class T>
std::list<T>::iterator get_n(std::list<T> &l, int n) {
std::list<T>::iterator it = l.begin();
while(n>0 && it != l.end()) {it++;n--;}
return it;
}
This is painfully slow, in general the main reason you want a list is for "destructive splice" If you want to remove a sequence of elemetns from one container and insert it into the middle of another then list is the way to go. std::vector is probably what you really want.