How to get min or max element in a vector of structures in c++, based on some field in the structure?
For example:
struct Size { int width, height; }
Use std::min/std::max/std::minmax _element with comparator. http://en.cppreference.com/w/cpp/algorithm/min_element
std::min/std::max/std::minmax _element