If front() returns a reference and the container is empty what do I get, an undefined reference? Does it mean I need to check empty() before each
front()
empty()
You get undefined behaviour.
To get range checking use at(0). If this fails you get a out_of_range exception.
out_of_range