#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>

struct Size {
    int width, height;
};

int main()
{
    std::vector<Size> sizes = { {4, 1}, {2, 3}, {1, 2} };

    decltype(sizes)::iterator minEl, maxEl;
    std::tie(minEl, maxEl) = std::minmax_element(begin(sizes), end(sizes),
        [] (Size const& s1, Size const& s2)
        {
            return s1.width < s2.width;
        });

    std::cout << "Minimum (based on width): "
        << minEl->width << "," << minEl->height << std::endl;

    std::cout << "Maximum (based on width): "  
        << maxEl->width << "," << maxEl->height << std::endl;
}
