/** -*- C++ -*- ** ** KAI C++ Compiler ** ** Copyright (C) 1996-2001 Intel Corp. All rights reserved. **/ /** ** Lib++ : The Modena C++ Standard Library, ** Version 2.4, October 1997 ** ** Copyright (c) 1995-1997 Modena Software Inc. **/ #ifndef __KAI_UTILITY #define __KAI_UTILITY #include /* ADR removed Modena's gratuitous #include of from here. */ namespace std { // Subclause 20.2.1 -- Operators namespace rel_ops { template inline bool operator!=(const T& x, const T& y) { return ! (x == y); } template inline bool operator>(const T& x, const T& y) { return y < x; } template inline bool operator<=(const T& x, const T& y) { return !(y < x);} template inline bool operator>=(const T& x, const T& y) { return !(x < y);} } /* namespace rel_ops */ // Section 20.2.2 -- Pair template struct pair { typedef T1 first_type; typedef T2 second_type; T1 first; T2 second; pair() : first (), second () {} pair(const T1& a, const T2& b) : first (a), second (b) {} template pair(const pair &p): first(p.first), second(p.second) {} }; template inline bool operator==(const pair& x, const pair& y) { return x.first==y.first && x.second==y.second; } template inline bool operator<(const pair& x, const pair& y) { return x.first < y.first || (! (y.first < x.first) && x.second < y.second); } template inline bool operator!=(const pair& x, const pair& y) { return !(x == y); } template inline bool operator>(const pair& x, const pair& y) { return (y < x); } template inline bool operator>=(const pair& x, const pair& y) { return !(x < y); } template inline bool operator<=(const pair& x, const pair& y) { return !(y < x); } template inline pair make_pair(const T1& x, const T2& y) { return pair (x, y); } #if KAI_NONSTD_UTILITY // struct triple -- For Implementation Of Hash Tables template struct triple { T1 first; T2 second; T3 third; triple(const T1& a, const T2& b, const T3& c) : first(a), second(b), third(c) {} }; template inline bool operator==(const triple& x, const triple& y) { return x.first == y.first && x.second == y.second && x.third == y.third; } template inline bool operator<(const triple& x, const triple& y) { return x.first < y.first || (! (y.first < x.first) && (x.second < y.second || (! y.second < x.second) && (x.third < y.third))); } template inline triple make_triple(const T1& x, const T2& y, const T3& z) { return triple(x, y, z); } // Section 20.2.2.3 -- Restrictor template class restrictor { protected: T value; public: restrictor (const T& x) : value (x) {} template friend bool operator==(const restrictor& x, const restrictor& y); template friend bool operator<(const restrictor& x, const restrictor& y); template friend bool operator!=(const restrictor& x, const restrictor& y); template friend bool operator>(const restrictor& x, const restrictor& y); template friend bool operator>=(const restrictor& x, const restrictor& y); template friend bool operator<=(const restrictor& x, const restrictor& y); }; template inline bool operator==(const restrictor& x, const restrictor& y) { return (x.value == y.value); } template inline bool operator<(const restrictor& x, const restrictor& y) { return (x.value < y.value); } template inline bool operator!=(const restrictor& x, const restrictor& y) { return !(x.value == y.value); } template inline bool operator>(const restrictor& x, const restrictor& y) { return (y.value < x.value); } template inline bool operator>=(const restrictor& x, const restrictor& y) { return !(x.value < y.value); } template inline bool operator<=(const restrictor& x, const restrictor& y) { return !(y.value < x.value); } #endif /* KAI_NONSTD_UTILITY */ } // namespace std #endif /* __KAI_UTILITY */