You get undefined behaviour – you need to check that the container contains something using empty() (which checks if the container is empty) before calling front().
You get undefined behaviour – you need to check that the container contains something using empty() (which checks if the container is empty) before calling front().