stl_pair.h
上传用户:kellyonhid
上传日期:2013-10-12
资源大小:932k
文件大小:2k
源码类别:

3D图形编程

开发平台:

Visual C++

  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. /* NOTE: This is an internal header file, included by other STL headers.
  27.  *   You should not attempt to use it directly.
  28.  */
  29. #ifndef __SGI_STL_INTERNAL_PAIR_H
  30. #define __SGI_STL_INTERNAL_PAIR_H
  31. __STL_BEGIN_NAMESPACE
  32. template <class _T1, class _T2>
  33. struct pair {
  34.   typedef _T1 first_type;
  35.   typedef _T2 second_type;
  36.   _T1 first;
  37.   _T2 second;
  38.   pair() : first(_T1()), second(_T2()) {}
  39.   pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
  40. #ifdef __STL_MEMBER_TEMPLATES
  41.   template <class _U1, class _U2>
  42.   pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
  43. #endif
  44. };
  45. template <class _T1, class _T2>
  46. inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
  47.   return __x.first == __y.first && __x.second == __y.second; 
  48. }
  49. template <class _T1, class _T2>
  50. inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
  51.   return __x.first < __y.first || 
  52.          (!(__y.first < __x.first) && __x.second < __y.second); 
  53. }
  54. template <class _T1, class _T2>
  55. inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y)
  56. {
  57.   return pair<_T1, _T2>(__x, __y);
  58. }
  59. __STL_END_NAMESPACE
  60. #endif /* __SGI_STL_INTERNAL_PAIR_H */
  61. // Local Variables:
  62. // mode:C++
  63. // End: