Chris@16
|
1 // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
Chris@16
|
2 // Use, modification and distribution are subject to the Boost Software License,
|
Chris@16
|
3 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
4 // http://www.boost.org/LICENSE_1_0.txt).
|
Chris@16
|
5 //
|
Chris@16
|
6 // See http://www.boost.org/libs/utility for most recent version including documentation.
|
Chris@16
|
7
|
Chris@16
|
8 // compressed_pair: pair that "compresses" empty members
|
Chris@101
|
9 // (see libs/utility/doc/html/compressed_pair.html)
|
Chris@16
|
10 //
|
Chris@16
|
11 // JM changes 25 Jan 2004:
|
Chris@16
|
12 // For the case where T1 == T2 and both are empty, then first() and second()
|
Chris@16
|
13 // should return different objects.
|
Chris@16
|
14 // JM changes 25 Jan 2000:
|
Chris@16
|
15 // Removed default arguments from compressed_pair_switch to get
|
Chris@16
|
16 // C++ Builder 4 to accept them
|
Chris@16
|
17 // rewriten swap to get gcc and C++ builder to compile.
|
Chris@16
|
18 // added partial specialisations for case T1 == T2 to avoid duplicate constructor defs.
|
Chris@16
|
19
|
Chris@16
|
20 #ifndef BOOST_DETAIL_COMPRESSED_PAIR_HPP
|
Chris@16
|
21 #define BOOST_DETAIL_COMPRESSED_PAIR_HPP
|
Chris@16
|
22
|
Chris@16
|
23 #include <algorithm>
|
Chris@16
|
24
|
Chris@16
|
25 #include <boost/type_traits/remove_cv.hpp>
|
Chris@16
|
26 #include <boost/type_traits/is_empty.hpp>
|
Chris@16
|
27 #include <boost/type_traits/is_same.hpp>
|
Chris@16
|
28 #include <boost/call_traits.hpp>
|
Chris@16
|
29
|
Chris@16
|
30 #ifdef BOOST_MSVC
|
Chris@16
|
31 # pragma warning(push)
|
Chris@16
|
32 # pragma warning(disable:4512)
|
Chris@16
|
33 #endif
|
Chris@16
|
34 namespace boost
|
Chris@16
|
35 {
|
Chris@16
|
36
|
Chris@16
|
37 template <class T1, class T2>
|
Chris@16
|
38 class compressed_pair;
|
Chris@16
|
39
|
Chris@16
|
40
|
Chris@16
|
41 // compressed_pair
|
Chris@16
|
42
|
Chris@16
|
43 namespace details
|
Chris@16
|
44 {
|
Chris@16
|
45 // JM altered 26 Jan 2000:
|
Chris@16
|
46 template <class T1, class T2, bool IsSame, bool FirstEmpty, bool SecondEmpty>
|
Chris@16
|
47 struct compressed_pair_switch;
|
Chris@16
|
48
|
Chris@16
|
49 template <class T1, class T2>
|
Chris@16
|
50 struct compressed_pair_switch<T1, T2, false, false, false>
|
Chris@16
|
51 {static const int value = 0;};
|
Chris@16
|
52
|
Chris@16
|
53 template <class T1, class T2>
|
Chris@16
|
54 struct compressed_pair_switch<T1, T2, false, true, true>
|
Chris@16
|
55 {static const int value = 3;};
|
Chris@16
|
56
|
Chris@16
|
57 template <class T1, class T2>
|
Chris@16
|
58 struct compressed_pair_switch<T1, T2, false, true, false>
|
Chris@16
|
59 {static const int value = 1;};
|
Chris@16
|
60
|
Chris@16
|
61 template <class T1, class T2>
|
Chris@16
|
62 struct compressed_pair_switch<T1, T2, false, false, true>
|
Chris@16
|
63 {static const int value = 2;};
|
Chris@16
|
64
|
Chris@16
|
65 template <class T1, class T2>
|
Chris@16
|
66 struct compressed_pair_switch<T1, T2, true, true, true>
|
Chris@16
|
67 {static const int value = 4;};
|
Chris@16
|
68
|
Chris@16
|
69 template <class T1, class T2>
|
Chris@16
|
70 struct compressed_pair_switch<T1, T2, true, false, false>
|
Chris@16
|
71 {static const int value = 5;};
|
Chris@16
|
72
|
Chris@16
|
73 template <class T1, class T2, int Version> class compressed_pair_imp;
|
Chris@16
|
74
|
Chris@16
|
75 #ifdef __GNUC__
|
Chris@16
|
76 // workaround for GCC (JM):
|
Chris@16
|
77 using std::swap;
|
Chris@16
|
78 #endif
|
Chris@16
|
79 //
|
Chris@16
|
80 // can't call unqualified swap from within classname::swap
|
Chris@16
|
81 // as Koenig lookup rules will find only the classname::swap
|
Chris@16
|
82 // member function not the global declaration, so use cp_swap
|
Chris@16
|
83 // as a forwarding function (JM):
|
Chris@16
|
84 template <typename T>
|
Chris@16
|
85 inline void cp_swap(T& t1, T& t2)
|
Chris@16
|
86 {
|
Chris@16
|
87 #ifndef __GNUC__
|
Chris@16
|
88 using std::swap;
|
Chris@16
|
89 #endif
|
Chris@16
|
90 swap(t1, t2);
|
Chris@16
|
91 }
|
Chris@16
|
92
|
Chris@16
|
93 // 0 derive from neither
|
Chris@16
|
94
|
Chris@16
|
95 template <class T1, class T2>
|
Chris@16
|
96 class compressed_pair_imp<T1, T2, 0>
|
Chris@16
|
97 {
|
Chris@16
|
98 public:
|
Chris@16
|
99 typedef T1 first_type;
|
Chris@16
|
100 typedef T2 second_type;
|
Chris@16
|
101 typedef typename call_traits<first_type>::param_type first_param_type;
|
Chris@16
|
102 typedef typename call_traits<second_type>::param_type second_param_type;
|
Chris@16
|
103 typedef typename call_traits<first_type>::reference first_reference;
|
Chris@16
|
104 typedef typename call_traits<second_type>::reference second_reference;
|
Chris@16
|
105 typedef typename call_traits<first_type>::const_reference first_const_reference;
|
Chris@16
|
106 typedef typename call_traits<second_type>::const_reference second_const_reference;
|
Chris@16
|
107
|
Chris@16
|
108 compressed_pair_imp() {}
|
Chris@16
|
109
|
Chris@16
|
110 compressed_pair_imp(first_param_type x, second_param_type y)
|
Chris@16
|
111 : first_(x), second_(y) {}
|
Chris@16
|
112
|
Chris@16
|
113 compressed_pair_imp(first_param_type x)
|
Chris@16
|
114 : first_(x) {}
|
Chris@16
|
115
|
Chris@16
|
116 compressed_pair_imp(second_param_type y)
|
Chris@16
|
117 : second_(y) {}
|
Chris@16
|
118
|
Chris@16
|
119 first_reference first() {return first_;}
|
Chris@16
|
120 first_const_reference first() const {return first_;}
|
Chris@16
|
121
|
Chris@16
|
122 second_reference second() {return second_;}
|
Chris@16
|
123 second_const_reference second() const {return second_;}
|
Chris@16
|
124
|
Chris@16
|
125 void swap(::boost::compressed_pair<T1, T2>& y)
|
Chris@16
|
126 {
|
Chris@16
|
127 cp_swap(first_, y.first());
|
Chris@16
|
128 cp_swap(second_, y.second());
|
Chris@16
|
129 }
|
Chris@16
|
130 private:
|
Chris@16
|
131 first_type first_;
|
Chris@16
|
132 second_type second_;
|
Chris@16
|
133 };
|
Chris@16
|
134
|
Chris@16
|
135 // 1 derive from T1
|
Chris@16
|
136
|
Chris@16
|
137 template <class T1, class T2>
|
Chris@16
|
138 class compressed_pair_imp<T1, T2, 1>
|
Chris@16
|
139 : protected ::boost::remove_cv<T1>::type
|
Chris@16
|
140 {
|
Chris@16
|
141 public:
|
Chris@16
|
142 typedef T1 first_type;
|
Chris@16
|
143 typedef T2 second_type;
|
Chris@16
|
144 typedef typename call_traits<first_type>::param_type first_param_type;
|
Chris@16
|
145 typedef typename call_traits<second_type>::param_type second_param_type;
|
Chris@16
|
146 typedef typename call_traits<first_type>::reference first_reference;
|
Chris@16
|
147 typedef typename call_traits<second_type>::reference second_reference;
|
Chris@16
|
148 typedef typename call_traits<first_type>::const_reference first_const_reference;
|
Chris@16
|
149 typedef typename call_traits<second_type>::const_reference second_const_reference;
|
Chris@16
|
150
|
Chris@16
|
151 compressed_pair_imp() {}
|
Chris@16
|
152
|
Chris@16
|
153 compressed_pair_imp(first_param_type x, second_param_type y)
|
Chris@16
|
154 : first_type(x), second_(y) {}
|
Chris@16
|
155
|
Chris@16
|
156 compressed_pair_imp(first_param_type x)
|
Chris@16
|
157 : first_type(x) {}
|
Chris@16
|
158
|
Chris@16
|
159 compressed_pair_imp(second_param_type y)
|
Chris@16
|
160 : second_(y) {}
|
Chris@16
|
161
|
Chris@16
|
162 first_reference first() {return *this;}
|
Chris@16
|
163 first_const_reference first() const {return *this;}
|
Chris@16
|
164
|
Chris@16
|
165 second_reference second() {return second_;}
|
Chris@16
|
166 second_const_reference second() const {return second_;}
|
Chris@16
|
167
|
Chris@16
|
168 void swap(::boost::compressed_pair<T1,T2>& y)
|
Chris@16
|
169 {
|
Chris@16
|
170 // no need to swap empty base class:
|
Chris@16
|
171 cp_swap(second_, y.second());
|
Chris@16
|
172 }
|
Chris@16
|
173 private:
|
Chris@16
|
174 second_type second_;
|
Chris@16
|
175 };
|
Chris@16
|
176
|
Chris@16
|
177 // 2 derive from T2
|
Chris@16
|
178
|
Chris@16
|
179 template <class T1, class T2>
|
Chris@16
|
180 class compressed_pair_imp<T1, T2, 2>
|
Chris@16
|
181 : protected ::boost::remove_cv<T2>::type
|
Chris@16
|
182 {
|
Chris@16
|
183 public:
|
Chris@16
|
184 typedef T1 first_type;
|
Chris@16
|
185 typedef T2 second_type;
|
Chris@16
|
186 typedef typename call_traits<first_type>::param_type first_param_type;
|
Chris@16
|
187 typedef typename call_traits<second_type>::param_type second_param_type;
|
Chris@16
|
188 typedef typename call_traits<first_type>::reference first_reference;
|
Chris@16
|
189 typedef typename call_traits<second_type>::reference second_reference;
|
Chris@16
|
190 typedef typename call_traits<first_type>::const_reference first_const_reference;
|
Chris@16
|
191 typedef typename call_traits<second_type>::const_reference second_const_reference;
|
Chris@16
|
192
|
Chris@16
|
193 compressed_pair_imp() {}
|
Chris@16
|
194
|
Chris@16
|
195 compressed_pair_imp(first_param_type x, second_param_type y)
|
Chris@16
|
196 : second_type(y), first_(x) {}
|
Chris@16
|
197
|
Chris@16
|
198 compressed_pair_imp(first_param_type x)
|
Chris@16
|
199 : first_(x) {}
|
Chris@16
|
200
|
Chris@16
|
201 compressed_pair_imp(second_param_type y)
|
Chris@16
|
202 : second_type(y) {}
|
Chris@16
|
203
|
Chris@16
|
204 first_reference first() {return first_;}
|
Chris@16
|
205 first_const_reference first() const {return first_;}
|
Chris@16
|
206
|
Chris@16
|
207 second_reference second() {return *this;}
|
Chris@16
|
208 second_const_reference second() const {return *this;}
|
Chris@16
|
209
|
Chris@16
|
210 void swap(::boost::compressed_pair<T1,T2>& y)
|
Chris@16
|
211 {
|
Chris@16
|
212 // no need to swap empty base class:
|
Chris@16
|
213 cp_swap(first_, y.first());
|
Chris@16
|
214 }
|
Chris@16
|
215
|
Chris@16
|
216 private:
|
Chris@16
|
217 first_type first_;
|
Chris@16
|
218 };
|
Chris@16
|
219
|
Chris@16
|
220 // 3 derive from T1 and T2
|
Chris@16
|
221
|
Chris@16
|
222 template <class T1, class T2>
|
Chris@16
|
223 class compressed_pair_imp<T1, T2, 3>
|
Chris@16
|
224 : protected ::boost::remove_cv<T1>::type,
|
Chris@16
|
225 protected ::boost::remove_cv<T2>::type
|
Chris@16
|
226 {
|
Chris@16
|
227 public:
|
Chris@16
|
228 typedef T1 first_type;
|
Chris@16
|
229 typedef T2 second_type;
|
Chris@16
|
230 typedef typename call_traits<first_type>::param_type first_param_type;
|
Chris@16
|
231 typedef typename call_traits<second_type>::param_type second_param_type;
|
Chris@16
|
232 typedef typename call_traits<first_type>::reference first_reference;
|
Chris@16
|
233 typedef typename call_traits<second_type>::reference second_reference;
|
Chris@16
|
234 typedef typename call_traits<first_type>::const_reference first_const_reference;
|
Chris@16
|
235 typedef typename call_traits<second_type>::const_reference second_const_reference;
|
Chris@16
|
236
|
Chris@16
|
237 compressed_pair_imp() {}
|
Chris@16
|
238
|
Chris@16
|
239 compressed_pair_imp(first_param_type x, second_param_type y)
|
Chris@16
|
240 : first_type(x), second_type(y) {}
|
Chris@16
|
241
|
Chris@16
|
242 compressed_pair_imp(first_param_type x)
|
Chris@16
|
243 : first_type(x) {}
|
Chris@16
|
244
|
Chris@16
|
245 compressed_pair_imp(second_param_type y)
|
Chris@16
|
246 : second_type(y) {}
|
Chris@16
|
247
|
Chris@16
|
248 first_reference first() {return *this;}
|
Chris@16
|
249 first_const_reference first() const {return *this;}
|
Chris@16
|
250
|
Chris@16
|
251 second_reference second() {return *this;}
|
Chris@16
|
252 second_const_reference second() const {return *this;}
|
Chris@16
|
253 //
|
Chris@16
|
254 // no need to swap empty bases:
|
Chris@16
|
255 void swap(::boost::compressed_pair<T1,T2>&) {}
|
Chris@16
|
256 };
|
Chris@16
|
257
|
Chris@16
|
258 // JM
|
Chris@16
|
259 // 4 T1 == T2, T1 and T2 both empty
|
Chris@16
|
260 // Originally this did not store an instance of T2 at all
|
Chris@16
|
261 // but that led to problems beause it meant &x.first() == &x.second()
|
Chris@16
|
262 // which is not true for any other kind of pair, so now we store an instance
|
Chris@16
|
263 // of T2 just in case the user is relying on first() and second() returning
|
Chris@16
|
264 // different objects (albeit both empty).
|
Chris@16
|
265 template <class T1, class T2>
|
Chris@16
|
266 class compressed_pair_imp<T1, T2, 4>
|
Chris@16
|
267 : protected ::boost::remove_cv<T1>::type
|
Chris@16
|
268 {
|
Chris@16
|
269 public:
|
Chris@16
|
270 typedef T1 first_type;
|
Chris@16
|
271 typedef T2 second_type;
|
Chris@16
|
272 typedef typename call_traits<first_type>::param_type first_param_type;
|
Chris@16
|
273 typedef typename call_traits<second_type>::param_type second_param_type;
|
Chris@16
|
274 typedef typename call_traits<first_type>::reference first_reference;
|
Chris@16
|
275 typedef typename call_traits<second_type>::reference second_reference;
|
Chris@16
|
276 typedef typename call_traits<first_type>::const_reference first_const_reference;
|
Chris@16
|
277 typedef typename call_traits<second_type>::const_reference second_const_reference;
|
Chris@16
|
278
|
Chris@16
|
279 compressed_pair_imp() {}
|
Chris@16
|
280
|
Chris@16
|
281 compressed_pair_imp(first_param_type x, second_param_type y)
|
Chris@16
|
282 : first_type(x), m_second(y) {}
|
Chris@16
|
283
|
Chris@16
|
284 compressed_pair_imp(first_param_type x)
|
Chris@16
|
285 : first_type(x), m_second(x) {}
|
Chris@16
|
286
|
Chris@16
|
287 first_reference first() {return *this;}
|
Chris@16
|
288 first_const_reference first() const {return *this;}
|
Chris@16
|
289
|
Chris@16
|
290 second_reference second() {return m_second;}
|
Chris@16
|
291 second_const_reference second() const {return m_second;}
|
Chris@16
|
292
|
Chris@16
|
293 void swap(::boost::compressed_pair<T1,T2>&) {}
|
Chris@16
|
294 private:
|
Chris@16
|
295 T2 m_second;
|
Chris@16
|
296 };
|
Chris@16
|
297
|
Chris@16
|
298 // 5 T1 == T2 and are not empty: //JM
|
Chris@16
|
299
|
Chris@16
|
300 template <class T1, class T2>
|
Chris@16
|
301 class compressed_pair_imp<T1, T2, 5>
|
Chris@16
|
302 {
|
Chris@16
|
303 public:
|
Chris@16
|
304 typedef T1 first_type;
|
Chris@16
|
305 typedef T2 second_type;
|
Chris@16
|
306 typedef typename call_traits<first_type>::param_type first_param_type;
|
Chris@16
|
307 typedef typename call_traits<second_type>::param_type second_param_type;
|
Chris@16
|
308 typedef typename call_traits<first_type>::reference first_reference;
|
Chris@16
|
309 typedef typename call_traits<second_type>::reference second_reference;
|
Chris@16
|
310 typedef typename call_traits<first_type>::const_reference first_const_reference;
|
Chris@16
|
311 typedef typename call_traits<second_type>::const_reference second_const_reference;
|
Chris@16
|
312
|
Chris@16
|
313 compressed_pair_imp() {}
|
Chris@16
|
314
|
Chris@16
|
315 compressed_pair_imp(first_param_type x, second_param_type y)
|
Chris@16
|
316 : first_(x), second_(y) {}
|
Chris@16
|
317
|
Chris@16
|
318 compressed_pair_imp(first_param_type x)
|
Chris@16
|
319 : first_(x), second_(x) {}
|
Chris@16
|
320
|
Chris@16
|
321 first_reference first() {return first_;}
|
Chris@16
|
322 first_const_reference first() const {return first_;}
|
Chris@16
|
323
|
Chris@16
|
324 second_reference second() {return second_;}
|
Chris@16
|
325 second_const_reference second() const {return second_;}
|
Chris@16
|
326
|
Chris@16
|
327 void swap(::boost::compressed_pair<T1, T2>& y)
|
Chris@16
|
328 {
|
Chris@16
|
329 cp_swap(first_, y.first());
|
Chris@16
|
330 cp_swap(second_, y.second());
|
Chris@16
|
331 }
|
Chris@16
|
332 private:
|
Chris@16
|
333 first_type first_;
|
Chris@16
|
334 second_type second_;
|
Chris@16
|
335 };
|
Chris@16
|
336
|
Chris@16
|
337 } // details
|
Chris@16
|
338
|
Chris@16
|
339 template <class T1, class T2>
|
Chris@16
|
340 class compressed_pair
|
Chris@16
|
341 : private ::boost::details::compressed_pair_imp<T1, T2,
|
Chris@16
|
342 ::boost::details::compressed_pair_switch<
|
Chris@16
|
343 T1,
|
Chris@16
|
344 T2,
|
Chris@16
|
345 ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
|
Chris@16
|
346 ::boost::is_empty<T1>::value,
|
Chris@16
|
347 ::boost::is_empty<T2>::value>::value>
|
Chris@16
|
348 {
|
Chris@16
|
349 private:
|
Chris@16
|
350 typedef details::compressed_pair_imp<T1, T2,
|
Chris@16
|
351 ::boost::details::compressed_pair_switch<
|
Chris@16
|
352 T1,
|
Chris@16
|
353 T2,
|
Chris@16
|
354 ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
|
Chris@16
|
355 ::boost::is_empty<T1>::value,
|
Chris@16
|
356 ::boost::is_empty<T2>::value>::value> base;
|
Chris@16
|
357 public:
|
Chris@16
|
358 typedef T1 first_type;
|
Chris@16
|
359 typedef T2 second_type;
|
Chris@16
|
360 typedef typename call_traits<first_type>::param_type first_param_type;
|
Chris@16
|
361 typedef typename call_traits<second_type>::param_type second_param_type;
|
Chris@16
|
362 typedef typename call_traits<first_type>::reference first_reference;
|
Chris@16
|
363 typedef typename call_traits<second_type>::reference second_reference;
|
Chris@16
|
364 typedef typename call_traits<first_type>::const_reference first_const_reference;
|
Chris@16
|
365 typedef typename call_traits<second_type>::const_reference second_const_reference;
|
Chris@16
|
366
|
Chris@16
|
367 compressed_pair() : base() {}
|
Chris@16
|
368 compressed_pair(first_param_type x, second_param_type y) : base(x, y) {}
|
Chris@16
|
369 explicit compressed_pair(first_param_type x) : base(x) {}
|
Chris@16
|
370 explicit compressed_pair(second_param_type y) : base(y) {}
|
Chris@16
|
371
|
Chris@16
|
372 first_reference first() {return base::first();}
|
Chris@16
|
373 first_const_reference first() const {return base::first();}
|
Chris@16
|
374
|
Chris@16
|
375 second_reference second() {return base::second();}
|
Chris@16
|
376 second_const_reference second() const {return base::second();}
|
Chris@16
|
377
|
Chris@16
|
378 void swap(compressed_pair& y) { base::swap(y); }
|
Chris@16
|
379 };
|
Chris@16
|
380
|
Chris@16
|
381 // JM
|
Chris@16
|
382 // Partial specialisation for case where T1 == T2:
|
Chris@16
|
383 //
|
Chris@16
|
384 template <class T>
|
Chris@16
|
385 class compressed_pair<T, T>
|
Chris@16
|
386 : private details::compressed_pair_imp<T, T,
|
Chris@16
|
387 ::boost::details::compressed_pair_switch<
|
Chris@16
|
388 T,
|
Chris@16
|
389 T,
|
Chris@16
|
390 ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
|
Chris@16
|
391 ::boost::is_empty<T>::value,
|
Chris@16
|
392 ::boost::is_empty<T>::value>::value>
|
Chris@16
|
393 {
|
Chris@16
|
394 private:
|
Chris@16
|
395 typedef details::compressed_pair_imp<T, T,
|
Chris@16
|
396 ::boost::details::compressed_pair_switch<
|
Chris@16
|
397 T,
|
Chris@16
|
398 T,
|
Chris@16
|
399 ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
|
Chris@16
|
400 ::boost::is_empty<T>::value,
|
Chris@16
|
401 ::boost::is_empty<T>::value>::value> base;
|
Chris@16
|
402 public:
|
Chris@16
|
403 typedef T first_type;
|
Chris@16
|
404 typedef T second_type;
|
Chris@16
|
405 typedef typename call_traits<first_type>::param_type first_param_type;
|
Chris@16
|
406 typedef typename call_traits<second_type>::param_type second_param_type;
|
Chris@16
|
407 typedef typename call_traits<first_type>::reference first_reference;
|
Chris@16
|
408 typedef typename call_traits<second_type>::reference second_reference;
|
Chris@16
|
409 typedef typename call_traits<first_type>::const_reference first_const_reference;
|
Chris@16
|
410 typedef typename call_traits<second_type>::const_reference second_const_reference;
|
Chris@16
|
411
|
Chris@16
|
412 compressed_pair() : base() {}
|
Chris@16
|
413 compressed_pair(first_param_type x, second_param_type y) : base(x, y) {}
|
Chris@16
|
414 #if !(defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530))
|
Chris@16
|
415 explicit
|
Chris@16
|
416 #endif
|
Chris@16
|
417 compressed_pair(first_param_type x) : base(x) {}
|
Chris@16
|
418
|
Chris@16
|
419 first_reference first() {return base::first();}
|
Chris@16
|
420 first_const_reference first() const {return base::first();}
|
Chris@16
|
421
|
Chris@16
|
422 second_reference second() {return base::second();}
|
Chris@16
|
423 second_const_reference second() const {return base::second();}
|
Chris@16
|
424
|
Chris@16
|
425 void swap(::boost::compressed_pair<T,T>& y) { base::swap(y); }
|
Chris@16
|
426 };
|
Chris@16
|
427
|
Chris@16
|
428 template <class T1, class T2>
|
Chris@16
|
429 inline
|
Chris@16
|
430 void
|
Chris@16
|
431 swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
|
Chris@16
|
432 {
|
Chris@16
|
433 x.swap(y);
|
Chris@16
|
434 }
|
Chris@16
|
435
|
Chris@16
|
436 } // boost
|
Chris@16
|
437
|
Chris@16
|
438 #ifdef BOOST_MSVC
|
Chris@16
|
439 # pragma warning(pop)
|
Chris@16
|
440 #endif
|
Chris@16
|
441
|
Chris@16
|
442 #endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP
|
Chris@16
|
443
|