1 /* 2 * 3 * Copyright (c) 1994 4 * Hewlett-Packard Company 5 * 6 * Permission to use, copy, modify, distribute and sell this software 7 * and its documentation for any purpose is hereby granted without fee, 8 * provided that the above copyright notice appear in all copies and 9 * that both that copyright notice and this permission notice appear 10 * in supporting documentation. Hewlett-Packard Company makes no 11 * representations about the suitability of this software for any 12 * purpose. It is provided "as is" without express or implied warranty. 13 * 14 * 15 * Copyright (c) 1996,1997 16 * Silicon Graphics Computer Systems, Inc. 17 * 18 * Permission to use, copy, modify, distribute and sell this software 19 * and its documentation for any purpose is hereby granted without fee, 20 * provided that the above copyright notice appear in all copies and 21 * that both that copyright notice and this permission notice appear 22 * in supporting documentation. Silicon Graphics makes no 23 * representations about the suitability of this software for any 24 * purpose. It is provided "as is" without express or implied warranty. 25 */ 26 27 /* NOTE: This is an internal header file, included by other STL headers. 28 * You should not attempt to use it directly. 29 */ 30 31 #ifndef __SGI_STL_INTERNAL_PAIR_H 32 #define __SGI_STL_INTERNAL_PAIR_H 33 34 __STL_BEGIN_NAMESPACE 35 36 template <class _T1, class _T2> 37 struct pair { 38 typedef _T1 first_type; 39 typedef _T2 second_type; 40 41 _T1 first; 42 _T2 second; 43 pair() : first(_T1()), second(_T2()) {} 44 pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {} 45 46 #ifdef __STL_MEMBER_TEMPLATES 47 template <class _U1, class _U2> 48 pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} 49 #endif 50 }; 51 52 template <class _T1, class _T2> 53 inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) 54 { 55 return __x.first == __y.first && __x.second == __y.second; 56 } 57 58 template <class _T1, class _T2> 59 inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) 60 { 61 return __x.first < __y.first || 62 (!(__y.first < __x.first) && __x.second < __y.second); 63 } 64 65 template <class _T1, class _T2> 66 inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y) 67 { 68 return pair<_T1, _T2>(__x, __y); 69 } 70 71 __STL_END_NAMESPACE 72 73 #endif /* __SGI_STL_INTERNAL_PAIR_H */ 74 75 // Local Variables: 76 // mode:C++ 77 // End: 78