alpar@906: /* -*- C++ -*- alpar@921: * src/lemon/extended_pair.h - Part of LEMON, a generic C++ optimization library alpar@906: * alpar@1164: * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@906: * (Egervary Combinatorial Optimization Research Group, EGRES). alpar@906: * alpar@906: * Permission to use, modify and distribute this software is granted alpar@906: * provided that this copyright notice appears in all copies. For alpar@906: * precise terms see the accompanying LICENSE file. alpar@906: * alpar@906: * This software is provided "AS IS" with no warranty of any kind, alpar@906: * express or implied, and with no claim as to its suitability for any alpar@906: * purpose. alpar@906: * alpar@906: */ alpar@906: alpar@921: #ifndef LEMON_EXTENDED_PAIR_H alpar@921: #define LEMON_EXTENDED_PAIR_H deba@782: deba@782: template deba@782: struct extended_pair { deba@782: typedef T1 first_type; deba@782: typedef T2 second_type; deba@782: deba@782: extended_pair() : first(), second() {} deba@782: deba@782: extended_pair(A1 f, A2 s) : first(f), second(s) {} deba@782: deba@782: template deba@782: extended_pair(const Pair& pair) : first(pair.first), second(pair.second) {} deba@782: deba@782: T1 first; deba@782: T2 second; deba@782: }; deba@782: deba@782: template deba@782: bool operator==(const extended_pair& left, deba@782: const extended_pair& right) { deba@782: return left.first == right.first && left.second == right.second; deba@782: } deba@782: deba@782: template deba@782: bool operator!=(const extended_pair& left, deba@782: const extended_pair& right) { deba@782: return !(left == right); deba@782: } deba@782: deba@782: template deba@782: bool operator<(const extended_pair& left, deba@782: const extended_pair& right) { deba@897: return left.first < right.first || deba@897: (!(right.first deba@782: bool operator>(const extended_pair& left, deba@782: const extended_pair& right) { deba@782: return right < left; deba@782: } deba@782: deba@782: template deba@782: bool operator<=(const extended_pair& left, deba@782: const extended_pair& right) { deba@782: return !(right > left); deba@782: } deba@782: deba@782: template deba@782: bool operator>=(const extended_pair& left, deba@782: const extended_pair& right) { deba@782: return !(right < left); deba@782: } deba@782: deba@782: deba@782: #endif