min_element : returning all instance

Hi
I have a list of structs
the struct has fields a,b,f
StructName struct1 = *min_element(myList.begin(), myList.end(),&ClassName::_compareObjectiveF);
_compareObjectiveF is comparing the structs based on f value, so min_element returns the struct that has the minimum value for f

In myList, there are sometimes many structs that share the same minimum f
How can I return them all using min_element instead of the first one?

Thank you
Unless they happen to be ordered by f, it's not possible to return them all "using min_element".
But you can easily write your own function to return them all.
If they are ordered by f then min_element returns an iterator to the first one, so you could iterate from there.
Topic archived. No new replies allowed.