Original Post
How do I test if an STL vector contains nothing?
I have a function that needs to test if an element already exists in my vector. The problem is, there''s nothing in it the first time through so I get an error.
Here is some source:
// This is declared in my class header
std::vector<CTexture> STLVector;
void CTexture::Load (std::string file)
{
std::vector<CTexture>::iterator Iterator;
for (Iterator = STLVector.begin(); Iterator != STLVector.end(); Iterator++) {
// Test if element exists and if it does, return from this function
}
// Otherwise continue
CTexture Temp;
Temp.filename = file;
STLVector.push_back(Temp);
}