OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / prebuilt / ndk / android-ndk-r4 / platforms / android-8 / arch-arm / usr / include / stl_pair.h
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *  * Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in
12  *    the documentation and/or other materials provided with the
13  *    distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 /*
29  *
30  * Copyright (c) 1994
31  * Hewlett-Packard Company
32  *
33  * Permission to use, copy, modify, distribute and sell this software
34  * and its documentation for any purpose is hereby granted without fee,
35  * provided that the above copyright notice appear in all copies and
36  * that both that copyright notice and this permission notice appear
37  * in supporting documentation.  Hewlett-Packard Company makes no
38  * representations about the suitability of this software for any
39  * purpose.  It is provided "as is" without express or implied warranty.
40  *
41  *
42  * Copyright (c) 1996,1997
43  * Silicon Graphics Computer Systems, Inc.
44  *
45  * Permission to use, copy, modify, distribute and sell this software
46  * and its documentation for any purpose is hereby granted without fee,
47  * provided that the above copyright notice appear in all copies and
48  * that both that copyright notice and this permission notice appear
49  * in supporting documentation.  Silicon Graphics makes no
50  * representations about the suitability of this software for any
51  * purpose.  It is provided "as is" without express or implied warranty.
52  */
53
54 /* NOTE: This is an internal header file, included by other STL headers.
55  *   You should not attempt to use it directly.
56  */
57
58 #ifndef __SGI_STL_INTERNAL_PAIR_H
59 #define __SGI_STL_INTERNAL_PAIR_H
60
61 __STL_BEGIN_NAMESPACE
62
63 template <class _T1, class _T2>
64 struct pair {
65   typedef _T1 first_type;
66   typedef _T2 second_type;
67
68   _T1 first;
69   _T2 second;
70   pair() : first(), second() {}
71   pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
72
73   template <class _U1, class _U2>
74   pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
75 };
76
77 template <class _T1, class _T2>
78 inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
79 {
80   return __x.first == __y.first && __x.second == __y.second;
81 }
82
83 template <class _T1, class _T2>
84 inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
85 {
86   return __x.first < __y.first ||
87          (!(__y.first < __x.first) && __x.second < __y.second);
88 }
89
90 template <class _T1, class _T2>
91 inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
92   return !(__x == __y);
93 }
94
95 template <class _T1, class _T2>
96 inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
97   return __y < __x;
98 }
99
100 template <class _T1, class _T2>
101 inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
102   return !(__y < __x);
103 }
104
105 template <class _T1, class _T2>
106 inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
107   return !(__x < __y);
108 }
109
110 template <class _T1, class _T2>
111 inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y)
112 {
113   return pair<_T1, _T2>(__x, __y);
114 }
115
116 __STL_END_NAMESPACE
117
118 #endif /* __SGI_STL_INTERNAL_PAIR_H */
119
120 // Local Variables:
121 // mode:C++
122 // End: