Frank
unread,Jan 28, 2013, 6:18:45 AM1/28/13You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Dear people,
I have a custom class (myclass) and a std::vector<myclass> of objects.
Now I'd like to std::find a certain object, the criterium
is an integer member variable in the class. So if the
integer variable fits an integer I provide, the object was found.
The integer (i) is set in one of the constructors of the class:
myclass obj(par1, par2, i);
Up to now, I std::find like this:
std::find(vec.begin(), vec.end(), myclass(0, 0, 33));
where 33 is the integer to be looked for,
myclass provides a proper "equals" operator.
Now the question: Is it possible to do this without
constructing a dummy object? Of course I could
write my own find function to do this but I'd rather
not if STL already provides a mechanism for it.
TIA!