Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

stl_pair.h

Go to the documentation of this file.
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 #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 //181.  make_pair() unintended behavior
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 } // namespace std
00113 
00114 #endif /* __SGI_STL_INTERNAL_PAIR_H */
00115 
00116 // Local Variables:
00117 // mode:C++
00118 // End:

Generated at Tue May 1 16:28:39 2001 for libstdc++-v3 by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001