J
Jason Heyes
How do I rewrite the following code so that I am taking advantage of the
STL? The purpose of the code is to determine whether a vector contains any
objects of MyClass that are "true" (i.e., MyClass::is_true() returns true).
bool found = false;
vector<MyClass>::size_type i;
for (i=0; i < objects.size(); i++)
{
MyClass object = objects;
if (object.is_true())
{
found = true;
break;
}
}
Any help is very appreciated.
STL? The purpose of the code is to determine whether a vector contains any
objects of MyClass that are "true" (i.e., MyClass::is_true() returns true).
bool found = false;
vector<MyClass>::size_type i;
for (i=0; i < objects.size(); i++)
{
MyClass object = objects;
if (object.is_true())
{
found = true;
break;
}
}
Any help is very appreciated.