stl_pair.h

00001 /*
00002  *
00003  * Copyright (c) 1994
00004  * Hewlett-Packard Company
00005  *
00006  * Permission to use, copy, modify, distribute and sell this software
00007  * and its documentation for any purpose is hereby granted without fee,
00008  * provided that the above copyright notice appear in all copies and
00009  * that both that copyright notice and this permission notice appear
00010  * in supporting documentation.  Hewlett-Packard Company makes no
00011  * representations about the suitability of this software for any
00012  * purpose.  It is provided "as is" without express or implied warranty.
00013  *
00014  *
00015  * Copyright (c) 1996,1997
00016  * Silicon Graphics Computer Systems, Inc.
00017  *
00018  * Permission to use, copy, modify, distribute and sell this software
00019  * and its documentation for any purpose is hereby granted without fee,
00020  * provided that the above copyright notice appear in all copies and
00021  * that both that copyright notice and this permission notice appear
00022  * in supporting documentation.  Silicon Graphics makes no
00023  * representations about the suitability of this software for any
00024  * purpose.  It is provided "as is" without express or implied warranty.
00025  */
00026 
00027 /* NOTE: This is an internal header file, included by other STL headers.
00028  *   You should not attempt to use it directly.
00029  */
00030 
00031 #ifndef __SGI_STL_INTERNAL_PAIR_H
00032 #define __SGI_STL_INTERNAL_PAIR_H
00033 
00034 __STL_BEGIN_NAMESPACE
00035 
00036 template <class _T1, class _T2>
00037 struct pair {
00038   typedef _T1 first_type;
00039   typedef _T2 second_type;
00040 
00041   _T1 first;
00042   _T2 second;
00043   pair() : first(_T1()), second(_T2()) {}
00044   pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
00045 
00046 #ifdef __STL_MEMBER_TEMPLATES
00047   template <class _U1, class _U2>
00048   pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
00049 #endif
00050 };
00051 
00052 template <class _T1, class _T2>
00053 inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
00054 { 
00055   return __x.first == __y.first && __x.second == __y.second; 
00056 }
00057 
00058 template <class _T1, class _T2>
00059 inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
00060 { 
00061   return __x.first < __y.first || 
00062          (!(__y.first < __x.first) && __x.second < __y.second); 
00063 }
00064 
00065 #ifdef __STL_FUNCTION_TMPL_PARTIAL_ORDER
00066 
00067 template <class _T1, class _T2>
00068 inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
00069   return !(__x == __y);
00070 }
00071 
00072 template <class _T1, class _T2>
00073 inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
00074   return __y < __x;
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 !(__x < __y);
00085 }
00086 
00087 #endif /* __STL_FUNCTION_TMPL_PARTIAL_ORDER */
00088 
00089 template <class _T1, class _T2>
00090 inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y)
00091 {
00092   return pair<_T1, _T2>(__x, __y);
00093 }
00094 
00095 __STL_END_NAMESPACE
00096 
00097 #endif /* __SGI_STL_INTERNAL_PAIR_H */
00098 
00099 // Local Variables:
00100 // mode:C++
00101 // End:

Generated on Mon Jun 5 10:20:44 2006 for Intelligence.kdevelop by  doxygen 1.4.6