Checking if an iterator is valid

I assume you mean “is an iterator valid,” that it hasn’t been invalidated due to changes to the container (e.g., inserting/erasing to/from a vector). In that case, no, you cannot determine if an iterator is (safely) dereferencable.

Leave a Comment