Now, that being said, I'd argue that map should probably be changed so that it calls its function on popFront rather than front (though that has the downside of requiring that it then hold the current value, which it doesn't currently have to do), but regardless, you're using map for something other than what itwas designed to do.
That would break random access.
