Purpose of front() and back() in assigning values in a Queue? (C++)
- by kevin
I have declared:
queue<int, list<int> > Q
After a series of calls:
Q.push(37);
Q.pop();
Q.push(19);
Q.push(3);
Q.push(13);
Q.front();
Q.push(22);
Q.push(8);
Q.back();
I get:
19-3-13-22-8-NULL
What I don't get is what the calls to Q.front() and Q.back() do. From what I understand, they return a reference to the first or last…