ReactOS 0.4.15-dev-7788-g1ad9096
_pair.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) 1994
4 * Hewlett-Packard Company
5 *
6 * Copyright (c) 1996,1997
7 * Silicon Graphics Computer Systems, Inc.
8 *
9 * Copyright (c) 1997
10 * Moscow Center for SPARC Technology
11 *
12 * Copyright (c) 1999
13 * Boris Fomitchev
14 *
15 * This material is provided "as is", with absolutely no warranty expressed
16 * or implied. Any use is at your own risk.
17 *
18 * Permission to use or copy this software for any purpose is hereby granted
19 * without fee, provided the above notices are retained on all copies.
20 * Permission to modify the code and to distribute modified code is granted,
21 * provided the above notices are retained, and a notice that the code was
22 * modified is included with the above copyright notice.
23 *
24 */
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 _STLP_INTERNAL_PAIR_H
32#define _STLP_INTERNAL_PAIR_H
33
34#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
35# ifndef _STLP_TYPE_TRAITS_H
36# include <stl/type_traits.h>
37# endif
38
39# if !defined (_STLP_MOVE_CONSTRUCT_FWK_H) && !defined (_STLP_NO_MOVE_SEMANTIC)
41# endif
42#endif
43
45
46template <class _T1, class _T2>
47struct pair {
48 typedef _T1 first_type;
49 typedef _T2 second_type;
50
51 _T1 first;
52 _T2 second;
53#if defined (_STLP_CONST_CONSTRUCTOR_BUG)
54 pair() {}
55#else
56 pair() : first(_T1()), second(_T2()) {}
57#endif
58 pair(const _T1& __a, const _T2& __b) : first(__a), second(__b) {}
59
60#if defined (_STLP_MEMBER_TEMPLATES)
61 template <class _U1, class _U2>
62 pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {}
63
64 pair(const pair<_T1,_T2>& __o) : first(__o.first), second(__o.second) {}
65#endif
66
67#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_NO_MOVE_SEMANTIC)
70 {}
71#endif
72
74};
75
76template <class _T1, class _T2>
77inline bool _STLP_CALL operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
78{ return __x.first == __y.first && __x.second == __y.second; }
79
80template <class _T1, class _T2>
81inline bool _STLP_CALL operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) {
82 return __x.first < __y.first ||
83 (!(__y.first < __x.first) && __x.second < __y.second);
84}
85
86#if defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
87template <class _T1, class _T2>
88inline bool _STLP_CALL operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
89{ return !(__x == __y); }
90
91template <class _T1, class _T2>
92inline bool _STLP_CALL operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
93{ return __y < __x; }
94
95template <class _T1, class _T2>
96inline bool _STLP_CALL operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
97{ return !(__y < __x); }
98
99template <class _T1, class _T2>
100inline bool _STLP_CALL operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
101{ return !(__x < __y); }
102#endif /* _STLP_USE_SEPARATE_RELOPS_NAMESPACE */
103
104#if defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_EXTENSIONS)
105template <class _T1, class _T2, int _Sz>
106inline pair<_T1, _T2 const*> make_pair(_T1 const& __x,
107 _T2 const (&__y)[_Sz])
108{ return pair<_T1, _T2 const*>(__x, static_cast<_T2 const*>(__y)); }
109
110template <class _T1, class _T2, int _Sz>
111inline pair<_T1 const*, _T2> make_pair(_T1 const (&__x)[_Sz],
112 _T2 const& __y)
113{ return pair<_T1 const*, _T2>(static_cast<_T1 const*>(__x), __y); }
114
115template <class _T1, class _T2, int _Sz1, int _Sz2>
116inline pair<_T1 const*, _T2 const*> make_pair(_T1 const (&__x)[_Sz1],
117 _T2 const (&__y)[_Sz2]) {
118 return pair<_T1 const*, _T2 const*>(static_cast<_T1 const*>(__x),
119 static_cast<_T2 const*>(__y));
120}
121#endif
122
123template <class _T1, class _T2>
124inline pair<_T1, _T2> _STLP_CALL make_pair(_T1 __x, _T2 __y)
125{ return pair<_T1, _T2>(__x, __y); }
126
128
129#if defined (_STLP_USE_NAMESPACES) || !defined (_STLP_USE_SEPARATE_RELOPS_NAMESPACE)
131
132template <class _Tp>
133inline bool _STLP_CALL operator!=(const _Tp& __x, const _Tp& __y)
134{ return !(__x == __y); }
135
136template <class _Tp>
137inline bool _STLP_CALL operator>(const _Tp& __x, const _Tp& __y)
138{ return __y < __x; }
139
140template <class _Tp>
141inline bool _STLP_CALL operator<=(const _Tp& __x, const _Tp& __y)
142{ return !(__y < __x); }
143
144template <class _Tp>
145inline bool _STLP_CALL operator>=(const _Tp& __x, const _Tp& __y)
146{ return !(__x < __y); }
147
149#endif
150
151#if defined (_STLP_CLASS_PARTIAL_SPECIALIZATION)
153
154template <class _T1, class _T2>
155struct __type_traits<pair<_T1, _T2> > {
156 typedef __type_traits<_T1> _T1Traits;
157 typedef __type_traits<_T2> _T2Traits;
158 typedef typename _Land2<typename _T1Traits::has_trivial_default_constructor,
159 typename _T2Traits::has_trivial_default_constructor>::_Ret has_trivial_default_constructor;
160 typedef typename _Land2<typename _T1Traits::has_trivial_copy_constructor,
161 typename _T2Traits::has_trivial_copy_constructor>::_Ret has_trivial_copy_constructor;
162 typedef typename _Land2<typename _T1Traits::has_trivial_assignment_operator,
163 typename _T2Traits::has_trivial_assignment_operator>::_Ret has_trivial_assignment_operator;
164 typedef typename _Land2<typename _T1Traits::has_trivial_destructor,
165 typename _T2Traits::has_trivial_destructor>::_Ret has_trivial_destructor;
167};
168
169# if !defined (_STLP_NO_MOVE_SEMANTIC)
170template <class _T1, class _T2>
171struct __move_traits<pair<_T1, _T2> >
172 : _STLP_PRIV __move_traits_help1<_T1, _T2> {};
173# endif
174
176#endif
177
178#endif /* _STLP_INTERNAL_PAIR_H */
179
180// Local Variables:
181// mode:C++
182// End:
#define _STLP_CALL
Definition: _bc.h:131
#define _STLP_PRIV
Definition: _dm.h:70
_STLP_TYPENAME_ON_RETURN_TYPE _MoveSourceTraits< _Tp >::_Type _AsMoveSource(_Tp &src)
_STLP_END_NAMESPACE _STLP_BEGIN_RELOPS_NAMESPACE bool _STLP_CALL operator!=(const _Tp &__x, const _Tp &__y)
Definition: _pair.h:133
bool _STLP_CALL operator<(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Definition: _pair.h:81
bool _STLP_CALL operator==(const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
Definition: _pair.h:77
bool _STLP_CALL operator<=(const _Tp &__x, const _Tp &__y)
Definition: _pair.h:141
bool _STLP_CALL operator>=(const _Tp &__x, const _Tp &__y)
Definition: _pair.h:145
pair< _T1, _T2 > _STLP_CALL make_pair(_T1 __x, _T2 __y)
Definition: _pair.h:124
bool _STLP_CALL operator>(const _Tp &__x, const _Tp &__y)
Definition: _pair.h:137
void get(int argc, const char *argv[])
Definition: cmds.c:480
#define _STLP_END_RELOPS_NAMESPACE
Definition: features.h:512
#define __TRIVIAL_DESTRUCTOR(__type)
Definition: features.h:796
#define _STLP_BEGIN_RELOPS_NAMESPACE
Definition: features.h:511
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_END_NAMESPACE
Definition: features.h:503
GLenum src
Definition: glext.h:6340
const GLint * first
Definition: glext.h:5794
__bool2type< pod >::_Ret is_POD_type
__bool2type< trivial_destructor >::_Ret has_trivial_destructor
__bool2type< trivial_constructor >::_Ret has_trivial_default_constructor
__bool2type< trivial_copy >::_Ret has_trivial_copy_constructor
__bool2type< trivial_assign >::_Ret has_trivial_assignment_operator
Definition: _pair.h:47
_T1 first_type
Definition: _pair.h:48
_T2 second
Definition: _pair.h:52
_T2 second_type
Definition: _pair.h:49
pair()
Definition: _pair.h:56
_T1 first
Definition: _pair.h:51
pair(const _T1 &__a, const _T2 &__b)
Definition: _pair.h:58
#define const
Definition: zconf.h:233