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#ifndef __STL_BEGIN_NAMESPACE
62#define __STL_BEGIN_NAMESPACE namespace std {
63#endif
64
65#ifndef __STL_END_NAMESPACE
66#define __STL_END_NAMESPACE   }
67#endif
68
69__STL_BEGIN_NAMESPACE
70
71template <class _T1, class _T2>
72struct pair {
73  typedef _T1 first_type;
74  typedef _T2 second_type;
75
76  _T1 first;
77  _T2 second;
78  pair() : first(), second() {}
79  pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
80
81  template <class _U1, class _U2>
82  pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
83};
84
85template <class _T1, class _T2>
86inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
87{
88  return __x.first == __y.first && __x.second == __y.second;
89}
90
91template <class _T1, class _T2>
92inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
93{
94  return __x.first < __y.first ||
95         (!(__y.first < __x.first) && __x.second < __y.second);
96}
97
98template <class _T1, class _T2>
99inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
100  return !(__x == __y);
101}
102
103template <class _T1, class _T2>
104inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
105  return __y < __x;
106}
107
108template <class _T1, class _T2>
109inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
110  return !(__y < __x);
111}
112
113template <class _T1, class _T2>
114inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
115  return !(__x < __y);
116}
117
118template <class _T1, class _T2>
119inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y)
120{
121  return pair<_T1, _T2>(__x, __y);
122}
123
124__STL_END_NAMESPACE
125
126#endif /* __SGI_STL_INTERNAL_PAIR_H */
127
128// Local Variables:
129// mode:C++
130// End:
131