We can use the result of the first lookup to avoid doing another redundant lookup to perform the erasure. While we're at it, we can use std::string's std::string_view constructor in order to avoid an unnecessary strlen() call.