I am using the queue library from C++ and I need to pick the front element from the queue and edit this element without removing it from the queue. There is any way to do this?
I need to do something like this:
queue<int> myQueue;
myQueue.push(1);
myQueue.push(2);
cout << myQueue.front(); // 2
int a = myQueue.front();
a = 3;
cout << myQueue.front(); // 3
Obviously this don’t work =D. Anyone knows how to do it?
front()returns a reference,