4 * Hewlett-Packard Company
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.
15 * Copyright (c) 1996,1997
16 * Silicon Graphics Computer Systems, Inc.
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.
27 /* NOTE: This is an internal header file, included by other STL headers.
28 * You should not attempt to use it directly.
31 #ifndef __SGI_STL_INTERNAL_PAIR_H
32 #define __SGI_STL_INTERNAL_PAIR_H
37 template <class _T1
, class _T2
>
39 typedef _T1 first_type
;
40 typedef _T2 second_type
;
44 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
45 //265. std::pair::pair() effects overly restrictive
46 pair() : first(), second() {}
48 pair() : first(_T1()), second(_T2()) {}
50 pair(const _T1
& __a
, const _T2
& __b
) : first(__a
), second(__b
) {}
52 template <class _U1
, class _U2
>
53 pair(const pair
<_U1
, _U2
>& __p
) : first(__p
.first
), second(__p
.second
) {}
56 template <class _T1
, class _T2
>
57 inline bool operator==(const pair
<_T1
, _T2
>& __x
, const pair
<_T1
, _T2
>& __y
)
59 return __x
.first
== __y
.first
&& __x
.second
== __y
.second
;
62 template <class _T1
, class _T2
>
63 inline bool operator<(const pair
<_T1
, _T2
>& __x
, const pair
<_T1
, _T2
>& __y
)
65 return __x
.first
< __y
.first
||
66 (!(__y
.first
< __x
.first
) && __x
.second
< __y
.second
);
69 template <class _T1
, class _T2
>
70 inline bool operator!=(const pair
<_T1
, _T2
>& __x
, const pair
<_T1
, _T2
>& __y
) {
74 template <class _T1
, class _T2
>
75 inline bool operator>(const pair
<_T1
, _T2
>& __x
, const pair
<_T1
, _T2
>& __y
) {
79 template <class _T1
, class _T2
>
80 inline bool operator<=(const pair
<_T1
, _T2
>& __x
, const pair
<_T1
, _T2
>& __y
) {
84 template <class _T1
, class _T2
>
85 inline bool operator>=(const pair
<_T1
, _T2
>& __x
, const pair
<_T1
, _T2
>& __y
) {
89 template <class _T1
, class _T2
>
90 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
91 //181. make_pair() unintended behavior
92 inline pair
<_T1
, _T2
> make_pair(_T1 __x
, _T2 __y
)
94 inline pair
<_T1
, _T2
> make_pair(const _T1
& __x
, const _T2
& __y
)
97 return pair
<_T1
, _T2
>(__x
, __y
);
102 #endif /* __SGI_STL_INTERNAL_PAIR_H */