Check with empty() instead of equality to catch edge cases