#include <tr1/unordered_map>
#include <boost/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <algorithm>
struct A {int x; int y; };
int main()
{
    typedef std::tr1::unordered_map<int, A> map_t;
    map_t m;
    A a1 = {1, 100}; 
    m[1] = a1;
    A a2 = {10, 101};
    m[2] = a2;
    A a3 = {-1, 42};
    m[1000] = a3;

    A max_a = max_element(m.begin(), m.end(),
                    bind(&A::x, bind(&map_t::value_type::second, _1))
                  < bind(&A::x, bind(&map_t::value_type::second, _2))
             )->second;
             
     std::cout << "The max A::x was found in {" << max_a.x << ", " << max_a.y << "}\n";
    
}
