Assuming a list list<double> mylist = {1, 2, 3, ...}
It seems I can not operate directly on iterator of the list, like for(auto it = mylist.begin(); it != mylist.end()-5; it++)
Here the -5 is not accepted. But it is necessary for me to fix the range from the end of list. How can I do this?
Since std::list uses a bidirectional iterator instead of the random iterator you can't just subtract a number from them. But you can do something like: