there are two other options. if you have a vector with 5 elements and try to access element 10, it will throw an exception. you can catch it and say something like out of bounds. otherwise you could make a class that inherits from vector that checks if the number passed to at is in bounds. if not, do nothing
If you are just trying to determine whether or not the element exists, just do a bounds check: if (index > 0 && index < myVector.size()).
If you have a vector of pointers, they are not always guaranteed to be initialized to NULL, so you have to make sure that when you create your vector and/or expand it that they are explicitly initialized that way.
Then, if (myVector[index] != NULL)
Technically, you could get away with: if ((index > 0 && index < myVector.size()) && (myVector[index] != NULL)).
This works for vectors of pointers. If you have vectors of references or values then you don't really have a NULL condition and you have to detect that the value is in an 'empty' state.