00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __SGI_STL_INTERNAL_PAIR_H
00028 #define __SGI_STL_INTERNAL_PAIR_H
00029
00035 namespace std
00036 {
00037
00039 template <class _T1, class _T2>
00040 struct pair {
00041 typedef _T1 first_type;
00042 typedef _T2 second_type;
00043
00044 _T1 first;
00045 _T2 second;
00046
00049 pair() : first(_T1()), second(_T2()) {}
00052 pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
00053
00055 template <class _U1, class _U2>
00056 pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
00057 };
00058
00059 template <class _T1, class _T2>
00060 inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
00061 {
00062 return __x.first == __y.first && __x.second == __y.second;
00063 }
00064
00065 template <class _T1, class _T2>
00066 inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
00067 {
00068 return __x.first < __y.first ||
00069 (!(__y.first < __x.first) && __x.second < __y.second);
00070 }
00071
00072 template <class _T1, class _T2>
00073 inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
00074 return !(__x == __y);
00075 }
00076
00077 template <class _T1, class _T2>
00078 inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
00079 return __y < __x;
00080 }
00081
00082 template <class _T1, class _T2>
00083 inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
00084 return !(__y < __x);
00085 }
00086
00087 template <class _T1, class _T2>
00088 inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
00089 return !(__x < __y);
00090 }
00091
00101 template <class _T1, class _T2>
00102 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00103
00104 inline pair<_T1, _T2> make_pair(const _T1 __x, const _T2 __y)
00105 #else
00106 inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y)
00107 #endif
00108 {
00109 return pair<_T1, _T2>(__x, __y);
00110 }
00111
00112 }
00113
00114 #endif
00115
00116
00117
00118