Vector checking

This is a discussion on Vector checking within the C++ Programming forums, part of the General Programming Boards category; I was wondering if there was a way to check if theres already stored in a vector element.
For example:
...

what do you mean by "there's already stored in a vector element", are you trying to check if the 0th string is written? Then you can compare the 0th element with a string created by the default constructor of "string".

Like I'm trying to write a method of class Human thats named getItem. It is suppose to check if the 0th element of the vector is empty or not written yet and store the string(Name of item) in there but if it is empty i want to skip to the next element and check if its written or not again.

You can check the vector's size. If the size is n, then there are n elements stored from [0, n-1].
Other than that, you can also try using the at method. If the index you are trying to access doesn't exist, it will throw an exception.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell