empty() is guaranteed to be constant complexity for both vectors and lists, while size() has linear complexity for lists.