I understand that std::find() can find a certain element in a vector or other STL container... but, if I have a vector of an object, can I search through the vector for an object with a member that is a certain value?
Example
class MyClass{public: int a;};void main(){ std::vector<MyClass> MyVector; MyClass mc; mc.a = 15; MyVector.push_back(mc); mc.a = 7; MyVector.push_back(mc); mc.a = 15144; MyVector.push_back(mc); mc.a = 12457; MyVector.push_back(mc); std::vector<MyClass>::iterator i; i = Search(MyVector,a,7); // <-- Searches for an element whose // member ''a'' is set to 7... // And use A to do whatever is neccesary...};