// -*- c++ -*- #ifndef EXTENDED_PAIR_H #define EXTENDED_PAIR_H template struct extended_pair { typedef T1 first_type; typedef T2 second_type; extended_pair() : first(), second() {} extended_pair(A1 f, A2 s) : first(f), second(s) {} template extended_pair(const Pair& pair) : first(pair.first), second(pair.second) {} T1 first; T2 second; }; template bool operator==(const extended_pair& left, const extended_pair& right) { return left.first == right.first && left.second == right.second; } template bool operator!=(const extended_pair& left, const extended_pair& right) { return !(left == right); } template bool operator<(const extended_pair& left, const extended_pair& right) { if (left.first == right.first) return left.second == right.second; return left.first < right.first; } template bool operator>(const extended_pair& left, const extended_pair& right) { return right < left; } template bool operator<=(const extended_pair& left, const extended_pair& right) { return !(right > left); } template bool operator>=(const extended_pair& left, const extended_pair& right) { return !(right < left); } #endif