It is possible to define an enumeration that has values not defined by any of its enumerators.
Yes. std::vector names has a size that allows any index from 0 to the maximum value of the enum values - each element initialised to "Invalid". L15 checks that the value of the given enum is within the permitted range and only accesses std::vector names if it is. L4 checks that all given enum values are >= 0.
So I'm probably having a senior moment here at the end of a long day- but what's the issue?