1 This patch was generated from the headers installed by MacPorts
2 gcc-4.4 on OS X 10.6. You can apply it there with
3 `cd /opt/local/include/gcc44/c++ ; sudo patch -p1 <this_patch`, or similar
4 on other operating systems. Mail cfe-dev if you find other problems in the
7 This patch is offered under the same modified GPLv3 as libstdc++-4.4.
9 diff -ur a/bits/forward_list.h b/bits/forward_list.h
10 --- a/bits/forward_list.h 2011-03-15 14:49:05.000000000 -0700
11 +++ b/bits/forward_list.h 2011-05-02 23:51:33.000000000 -0700
16 - swap(forward_list&& __list)
17 + swap(forward_list& __list)
18 { _Node_base::swap(this->_M_impl._M_head, __list._M_impl._M_head); }
21 diff -ur a/bits/move.h b/bits/move.h
22 --- a/bits/move.h 2011-03-15 14:49:05.000000000 -0700
23 +++ b/bits/move.h 2011-03-29 10:33:39.000000000 -0700
26 template<typename _Tp>
28 - forward(typename std::identity<_Tp>::type&& __t)
29 + forward(typename std::remove_reference<_Tp>::type& __t)
31 + { return static_cast<_Tp&&>(__t); }
36 + template<typename _Tp>
38 + forward(typename std::remove_reference<_Tp>::type&& __t)
41 + static_assert(!std::is_lvalue_reference<_Tp>::value,
42 + "Can't instantiate this forward() with an"
43 + " lvalue reference type.");
44 + return static_cast<_Tp&&>(__t);
50 template<typename _Tp>
51 inline typename std::remove_reference<_Tp>::type&&
54 + { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
59 _GLIBCXX_END_NAMESPACE
61 diff -ur a/bits/shared_ptr.h b/bits/shared_ptr.h
62 --- a/bits/shared_ptr.h 2011-03-15 14:49:05.000000000 -0700
63 +++ b/bits/shared_ptr.h 2011-03-31 16:40:45.000000000 -0700
65 { return _M_refcount._M_get_use_count(); }
68 - swap(__shared_ptr<_Tp, _Lp>&& __other) // never throws
69 + swap(__shared_ptr<_Tp, _Lp>& __other) // never throws
71 std::swap(_M_ptr, __other._M_ptr);
72 _M_refcount._M_swap(__other._M_refcount);
74 swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b)
77 - template<typename _Tp, _Lock_policy _Lp>
79 - swap(__shared_ptr<_Tp, _Lp>&& __a, __shared_ptr<_Tp, _Lp>& __b)
82 - template<typename _Tp, _Lock_policy _Lp>
84 - swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>&& __b)
87 // 2.2.3.9 shared_ptr casts
88 /** @warning The seemingly equivalent
89 * <code>shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))</code>
90 @@ -1372,16 +1362,6 @@
91 swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b)
94 - template<typename _Tp>
96 - swap(shared_ptr<_Tp>&& __a, shared_ptr<_Tp>& __b)
99 - template<typename _Tp>
101 - swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>&& __b)
104 // 20.8.13.2.10 shared_ptr casts.
105 template<typename _Tp, typename _Tp1>
106 inline shared_ptr<_Tp>
107 diff -ur a/bits/stl_bvector.h b/bits/stl_bvector.h
108 --- a/bits/stl_bvector.h 2011-03-15 14:49:05.000000000 -0700
109 +++ b/bits/stl_bvector.h 2011-05-02 23:34:46.000000000 -0700
114 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
120 std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
121 std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
122 diff -ur a/bits/stl_deque.h b/bits/stl_deque.h
123 --- a/bits/stl_deque.h 2011-03-15 14:49:05.000000000 -0700
124 +++ b/bits/stl_deque.h 2011-03-29 10:33:39.000000000 -0700
125 @@ -1395,11 +1395,7 @@
126 * std::swap(d1,d2) will feed to this function.
129 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
135 std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
136 std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
137 diff -ur a/bits/stl_iterator.h b/bits/stl_iterator.h
138 --- a/bits/stl_iterator.h 2011-03-15 14:49:05.000000000 -0700
139 +++ b/bits/stl_iterator.h 2011-03-29 10:33:39.000000000 -0700
144 - { return *_M_current; }
145 + { return std::move(*_M_current); }
149 diff -ur a/bits/stl_list.h b/bits/stl_list.h
150 --- a/bits/stl_list.h 2011-03-15 14:49:05.000000000 -0700
151 +++ b/bits/stl_list.h 2011-03-29 10:33:39.000000000 -0700
152 @@ -1106,11 +1106,7 @@
156 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
162 _List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node);
164 @@ -1160,6 +1156,12 @@
168 +#ifdef __GXX_EXPERIMENTAL_CXX0X__
170 + splice(iterator __position, list& __x)
171 + { splice(__position, std::move(__x)); }
175 * @brief Insert element from another %list.
176 * @param position Iterator referencing the element to insert before.
177 @@ -1187,6 +1189,12 @@
178 this->_M_transfer(__position, __i, __j);
181 +#ifdef __GXX_EXPERIMENTAL_CXX0X__
183 + splice(iterator __position, list& __x, iterator __i)
184 + { splice(__position, std::move(__x), __i); }
188 * @brief Insert range from another %list.
189 * @param position Iterator referencing the element to insert before.
190 @@ -1217,6 +1225,13 @@
194 +#ifdef __GXX_EXPERIMENTAL_CXX0X__
196 + splice(iterator __position, list& __x, iterator __first,
198 + { splice(__position, std::move(__x), __first, __last); }
202 * @brief Remove all elements equal to value.
203 * @param value The value to remove.
204 @@ -1287,6 +1302,10 @@
206 #ifdef __GXX_EXPERIMENTAL_CXX0X__
211 + { merge(std::move(__x)); }
215 @@ -1307,6 +1326,11 @@
217 #ifdef __GXX_EXPERIMENTAL_CXX0X__
218 merge(list&&, _StrictWeakOrdering);
220 + template<typename _StrictWeakOrdering>
222 + merge(list& __l, _StrictWeakOrdering __comp)
223 + { merge(std::move(__l), __comp); }
225 merge(list&, _StrictWeakOrdering);
227 diff -ur a/bits/stl_map.h b/bits/stl_map.h
228 --- a/bits/stl_map.h 2011-03-15 14:49:05.000000000 -0700
229 +++ b/bits/stl_map.h 2011-03-29 10:33:39.000000000 -0700
231 * that std::swap(m1,m2) will feed to this function.
234 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
239 { _M_t.swap(__x._M_t); }
242 diff -ur a/bits/stl_multimap.h b/bits/stl_multimap.h
243 --- a/bits/stl_multimap.h 2011-03-15 14:49:05.000000000 -0700
244 +++ b/bits/stl_multimap.h 2011-03-29 10:33:39.000000000 -0700
246 * std::swap(m1,m2) will feed to this function.
249 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
250 - swap(multimap&& __x)
254 { _M_t.swap(__x._M_t); }
257 diff -ur a/bits/stl_multiset.h b/bits/stl_multiset.h
258 --- a/bits/stl_multiset.h 2011-03-15 14:49:05.000000000 -0700
259 +++ b/bits/stl_multiset.h 2011-03-29 10:33:39.000000000 -0700
261 * std::swap(s1,s2) will feed to this function.
264 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
265 - swap(multiset&& __x)
269 { _M_t.swap(__x._M_t); }
272 diff -ur a/bits/stl_pair.h b/bits/stl_pair.h
273 --- a/bits/stl_pair.h 2011-03-15 14:49:05.000000000 -0700
274 +++ b/bits/stl_pair.h 2011-03-29 10:33:39.000000000 -0700
276 : first(__a), second(__b) { }
278 #ifdef __GXX_EXPERIMENTAL_CXX0X__
279 - template<class _U1, class _U2>
280 + template<class _U1, class = typename
281 + std::enable_if<std::is_convertible<_U1, _T1>::value>::type>
282 + pair(_U1&& __x, const _T2& __y)
283 + : first(std::forward<_U1>(__x)), second(__y) { }
285 + template<class _U2, class = typename
286 + std::enable_if<std::is_convertible<_U2, _T2>::value>::type>
287 + pair(const _T1& __x, _U2&& __y)
288 + : first(__x), second(std::forward<_U2>(__y)) { }
290 + template<class _U1, class _U2, class = typename
291 + std::enable_if<std::is_convertible<_U1, _T1>::value
292 + && std::is_convertible<_U2, _T2>::value>::type>
293 pair(_U1&& __x, _U2&& __y)
294 - : first(std::forward<_U1>(__x)),
295 - second(std::forward<_U2>(__y)) { }
296 + : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) { }
299 : first(std::move(__p.first)),
300 @@ -107,11 +118,19 @@
301 second(std::move(__p.second)) { }
303 // http://gcc.gnu.org/ml/libstdc++/2007-08/msg00052.html
306 + // This constructor is incompatible with libstdc++-4.6, and it
307 + // interferes with passing NULL pointers to the 2-argument
308 + // constructors, so we disable it. map::emplace isn't
309 + // implemented in libstdc++-4.4 anyway, and that's what this
310 + // constructor was here for.
311 template<class _U1, class _Arg0, class... _Args>
312 pair(_U1&& __x, _Arg0&& __arg0, _Args&&... __args)
313 : first(std::forward<_U1>(__x)),
314 second(std::forward<_Arg0>(__arg0),
315 std::forward<_Args>(__args)...) { }
319 operator=(pair&& __p)
328 swap(first, __p.first);
329 diff -ur a/bits/stl_queue.h b/bits/stl_queue.h
330 --- a/bits/stl_queue.h 2011-03-15 14:49:05.000000000 -0700
331 +++ b/bits/stl_queue.h 2011-05-02 23:36:15.000000000 -0700
334 #ifdef __GXX_EXPERIMENTAL_CXX0X__
343 #ifdef __GXX_EXPERIMENTAL_CXX0X__
345 - swap(priority_queue&& __pq)
346 + swap(priority_queue& __pq)
350 diff -ur a/bits/stl_set.h b/bits/stl_set.h
351 --- a/bits/stl_set.h 2011-03-15 14:49:05.000000000 -0700
352 +++ b/bits/stl_set.h 2011-03-29 10:33:39.000000000 -0700
354 * std::swap(s1,s2) will feed to this function.
357 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
362 { _M_t.swap(__x._M_t); }
365 diff -ur a/bits/stl_stack.h b/bits/stl_stack.h
366 --- a/bits/stl_stack.h 2011-03-15 14:49:05.000000000 -0700
367 +++ b/bits/stl_stack.h 2011-05-02 23:36:36.000000000 -0700
370 #ifdef __GXX_EXPERIMENTAL_CXX0X__
377 diff -ur a/bits/stl_tree.h b/bits/stl_tree.h
378 --- a/bits/stl_tree.h 2011-03-15 14:49:05.000000000 -0700
379 +++ b/bits/stl_tree.h 2011-03-29 10:33:39.000000000 -0700
381 { return _M_get_Node_allocator().max_size(); }
384 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
385 - swap(_Rb_tree&& __t);
392 @@ -1104,11 +1100,7 @@
393 typename _Compare, typename _Alloc>
395 _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
396 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
397 - swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&& __t)
399 swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)
404 diff -ur a/bits/stl_vector.h b/bits/stl_vector.h
405 --- a/bits/stl_vector.h 2011-03-15 14:49:05.000000000 -0700
406 +++ b/bits/stl_vector.h 2011-03-29 10:33:39.000000000 -0700
408 * std::swap(v1,v2) will feed to this function.
411 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
417 std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
418 std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
419 diff -ur a/bits/unique_ptr.h b/bits/unique_ptr.h
420 --- a/bits/unique_ptr.h 2011-03-15 14:49:05.000000000 -0700
421 +++ b/bits/unique_ptr.h 2011-03-31 16:40:45.000000000 -0700
426 - swap(unique_ptr&& __u)
427 + swap(unique_ptr& __u)
430 swap(_M_t, __u._M_t);
432 void reset(_Up) = delete;
435 - swap(unique_ptr&& __u)
436 + swap(unique_ptr& __u)
439 swap(_M_t, __u._M_t);
441 unique_ptr<_Tp, _Tp_Deleter>& __y)
444 - template<typename _Tp, typename _Tp_Deleter>
446 - swap(unique_ptr<_Tp, _Tp_Deleter>&& __x,
447 - unique_ptr<_Tp, _Tp_Deleter>& __y)
450 - template<typename _Tp, typename _Tp_Deleter>
452 - swap(unique_ptr<_Tp, _Tp_Deleter>& __x,
453 - unique_ptr<_Tp, _Tp_Deleter>&& __y)
456 template<typename _Tp, typename _Tp_Deleter,
457 typename _Up, typename _Up_Deleter>
459 diff -ur a/exception_ptr.h b/exception_ptr.h
460 --- a/exception_ptr.h 2011-03-15 14:49:08.000000000 -0700
461 +++ b/exception_ptr.h 2011-03-29 10:33:39.000000000 -0700
464 operator==(const exception_ptr&, const exception_ptr&) throw();
467 + const class type_info*
468 __cxa_exception_type() const throw();
471 diff -ur a/ext/algorithm b/ext/algorithm
472 --- a/ext/algorithm 2011-03-15 14:49:05.000000000 -0700
473 +++ b/ext/algorithm 2011-03-29 10:33:39.000000000 -0700
475 __out_last - __out_first);
478 +#ifdef __GXX_EXPERIMENTAL_CXX0X__
479 + using std::is_heap;
482 * This is an SGI extension.
483 * @ingroup SGIextensions
486 return std::__is_heap(__first, __comp, __last - __first);
490 // is_sorted, a predicated testing whether a range is sorted in
491 // nondescending order. This is an extension, not part of the C++
492 diff -ur a/ext/vstring.h b/ext/vstring.h
493 --- a/ext/vstring.h 2011-03-15 14:49:05.000000000 -0700
494 +++ b/ext/vstring.h 2011-03-29 10:33:39.000000000 -0700
498 __versa_string(__versa_string&& __str)
499 - : __vstring_base(std::forward<__vstring_base>(__str)) { }
500 + : __vstring_base(std::move(__str)) { }
503 * @brief Construct string from an initializer list.
504 @@ -1439,11 +1439,7 @@
508 -#ifdef __GXX_EXPERIMENTAL_CXX0X__
509 - swap(__versa_string&& __s)
511 swap(__versa_string& __s)
513 { this->_M_swap(__s); }
515 // String operations:
516 diff -ur a/tr1_impl/hashtable b/tr1_impl/hashtable
517 --- a/tr1_impl/hashtable 2011-03-15 14:49:07.000000000 -0700
518 +++ b/tr1_impl/hashtable 2011-05-02 23:41:55.000000000 -0700
523 -#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
524 - void swap(_Hashtable&&);
526 void swap(_Hashtable&);
529 // Basic container operations
533 _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
534 _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
535 -#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
536 - swap(_Hashtable&& __x)
538 swap(_Hashtable& __x)
541 // The only base class with member variables is hash_code_base. We
542 // define _Hash_code_base::_M_swap because different specializations
543 diff -ur a/tuple b/tuple
544 --- a/tuple 2011-03-15 14:49:07.000000000 -0700
545 +++ b/tuple 2011-05-02 23:33:23.000000000 -0700
547 _Head& _M_head() { return *this; }
548 const _Head& _M_head() const { return *this; }
550 - void _M_swap_impl(_Head&&) { /* no-op */ }
551 + void _M_swap_impl(_Head&) { /* no-op */ }
554 template<std::size_t _Idx, typename _Head>
556 const _Head& _M_head() const { return _M_head_impl; }
559 - _M_swap_impl(_Head&& __h)
560 + _M_swap_impl(_Head& __h)
563 swap(__h, _M_head_impl);
565 struct _Tuple_impl<_Idx>
568 - void _M_swap_impl(_Tuple_impl&&) { /* no-op */ }
569 + void _M_swap_impl(_Tuple_impl&) { /* no-op */ }
577 - _M_swap_impl(_Tuple_impl&& __in)
578 + _M_swap_impl(_Tuple_impl& __in)
580 _Base::_M_swap_impl(__in._M_head());
581 _Inherited::_M_swap_impl(__in._M_tail());
588 { _Inherited::_M_swap_impl(__in); }
595 - void swap(tuple&&) { /* no-op */ }
596 + void swap(tuple&) { /* no-op */ }
599 /// tuple (2-element), with construction and assignment from a pair.
608 swap(this->_M_head(), __in._M_head());