Import some interworking support code from devo.
[official-gcc.git] / libstdc++ / stl / stl_pair.h
blob3aa290b59edb4f20ccd3c42ff12189c267aa6cd2
1 /*
3 * Copyright (c) 1994
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
34 __STL_BEGIN_NAMESPACE
36 template <class _T1, class _T2>
37 struct pair {
38 typedef _T1 first_type;
39 typedef _T2 second_type;
41 _T1 first;
42 _T2 second;
43 pair() : first(_T1()), second(_T2()) {}
44 pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
46 #ifdef __STL_MEMBER_TEMPLATES
47 template <class _U1, class _U2>
48 pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
49 #endif
52 template <class _T1, class _T2>
53 inline bool operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
55 return __x.first == __y.first && __x.second == __y.second;
58 template <class _T1, class _T2>
59 inline bool operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
61 return __x.first < __y.first ||
62 (!(__y.first < __x.first) && __x.second < __y.second);
65 template <class _T1, class _T2>
66 inline pair<_T1, _T2> make_pair(const _T1& __x, const _T2& __y)
68 return pair<_T1, _T2>(__x, __y);
71 __STL_END_NAMESPACE
73 #endif /* __SGI_STL_INTERNAL_PAIR_H */
75 // Local Variables:
76 // mode:C++
77 // End: