C++ check if element exists in vector

c++, vector

Solution

This is the check you are looking for: `(myvec.size() >= 8)`. In C++ there are no blank elements in a vector - i.e. the vector elements are with consecutive indices.

Problem

I'm working with a vector and need to check if there exists an element at a specific spot in the vector, like `myvec[7]` I need to work outside of a loop and be able to perform this check for any given point in the vector. What would be the most efficient way to do this with a vector?

Original source