In below code.
int main() {
list<int> m_list;
m_list.push_back(1);
list<int>::iterator it1 = (--m_list.end()); // it works, *it1 return 1;
list<int>::iterator it2 = (m_list.end() - 1); // compile issue?
}
Anybody explain why in list (m_list.end() - 1) has compile issue? and why (--m_list.end()) is OK? If we change to others, vector, string. both cases do work.
int main() {
vector<int> m_vector;
m_vector.push_back(1);
vector<int>::iterator it1 = (--m_vector.end()); // both work
vector<int>::iterator it2 = (m_vector.end() - 1); // both work
}