Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4680 | right-hear | 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 | |||
27 | /* NOTE: This is an internal header file, included by other STL headers. |
||
28 | * You should not attempt to use it directly. |
||
29 | */ |
||
30 | |||
31 | #ifndef __SGI_STL_INTERNAL_PAIR_H |
||
32 | #define __SGI_STL_INTERNAL_PAIR_H |
||
33 | |||
34 | namespace std |
||
35 | { |
||
36 | |||
37 | template |
||
38 | struct pair { |
||
39 | typedef _T1 first_type; |
||
40 | typedef _T2 second_type; |
||
41 | |||
42 | _T1 first; |
||
43 | _T2 second; |
||
44 | #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS |
||
45 | //265. std::pair::pair() effects overly restrictive |
||
46 | pair() : first(), second() {} |
||
47 | #else |
||
48 | pair() : first(_T1()), second(_T2()) {} |
||
49 | #endif |
||
50 | pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {} |
||
51 | |||
52 | template |
||
53 | pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} |
||
54 | }; |
||
55 | |||
56 | template |
||
57 | inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) |
||
58 | { |
||
59 | return __x.first == __y.first && __x.second == __y.second; |
||
60 | } |
||
61 | |||
62 | template |
||
63 | inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) |
||
64 | { |
||
65 | return __x.first < __y.first || |
||
66 | (!(__y.first < __x.first) && __x.second < __y.second); |
||
67 | } |
||
68 | |||
69 | template |
||
70 | inline bool operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { |
||
71 | return !(__x == __y); |
||
72 | } |
||
73 | |||
74 | template |
||
75 | inline bool operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { |
||
76 | return __y < __x; |
||
77 | } |
||
78 | |||
79 | template |
||
80 | inline bool operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { |
||
81 | return !(__y < __x); |
||
82 | } |
||
83 | |||
84 | template |
||
85 | inline bool operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) { |
||
86 | return !(__x < __y); |
||
87 | } |
||
88 | |||
89 | template |
||
90 | #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS |
||
91 | //181. make_pair() unintended behavior |
||
92 | inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y) |
||
93 | #else |
||
94 | inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y) |
||
95 | #endif |
||
96 | { |
||
97 | return pair<_T1, _T2>(__x, __y); |
||
98 | } |
||
99 | |||
100 | } // namespace std |
||
101 | |||
102 | #endif /* __SGI_STL_INTERNAL_PAIR_H */ |
||
103 | |||
104 | // Local Variables: |
||
105 | // mode:C++ |
||
106 | // End:>>=(const>>>>>(const> |