[cfe-commits] [libcxx] r124430 - /libcxx/trunk/include/forward_list

Howard Hinnant hhinnant at apple.com
Thu Jan 27 13:00:35 PST 2011


Author: hhinnant
Date: Thu Jan 27 15:00:35 2011
New Revision: 124430

URL: http://llvm.org/viewvc/llvm-project?rev=124430&view=rev
Log:
Make forward_list splice_after and merge work for lvalue lists

Modified:
    libcxx/trunk/include/forward_list

Modified: libcxx/trunk/include/forward_list
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/forward_list?rev=124430&r1=124429&r2=124430&view=diff
==============================================================================
--- libcxx/trunk/include/forward_list (original)
+++ libcxx/trunk/include/forward_list Thu Jan 27 15:00:35 2011
@@ -106,15 +106,21 @@
     void resize(size_type n, const value_type& v);
     void clear();
 
+    void splice_after(const_iterator p, forward_list& x);
     void splice_after(const_iterator p, forward_list&& x);
+    void splice_after(const_iterator p, forward_list& x, const_iterator i);
     void splice_after(const_iterator p, forward_list&& x, const_iterator i);
+    void splice_after(const_iterator p, forward_list& x,
+                      const_iterator first, const_iterator last);
     void splice_after(const_iterator p, forward_list&& x,
                       const_iterator first, const_iterator last);
     void remove(const value_type& v);
     template <class Predicate> void remove_if(Predicate pred);
     void unique();
     template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);
+    void merge(forward_list& x);
     void merge(forward_list&& x);
+    template <class Compare> void merge(forward_list& x, Compare comp);
     template <class Compare> void merge(forward_list&& x, Compare comp);
     void sort();
     template <class Compare> void sort(Compare comp);
@@ -632,16 +638,18 @@
     void clear() {base::clear();}
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    _LIBCPP_INLINE_VISIBILITY
     void splice_after(const_iterator __p, forward_list&& __x);
+    _LIBCPP_INLINE_VISIBILITY
     void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
+    _LIBCPP_INLINE_VISIBILITY
     void splice_after(const_iterator __p, forward_list&& __x,
                       const_iterator __f, const_iterator __l);
-#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     void splice_after(const_iterator __p, forward_list& __x);
     void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
     void splice_after(const_iterator __p, forward_list& __x,
                       const_iterator __f, const_iterator __l);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     void remove(const value_type& __v);
     template <class _Predicate> void remove_if(_Predicate __pred);
     _LIBCPP_INLINE_VISIBILITY
@@ -649,13 +657,15 @@
     template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
-    void merge(forward_list&& __x) {merge(_STD::move(__x), __less<value_type>());}
-    template <class _Compare> void merge(forward_list&& __x, _Compare __comp);
-#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+    void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
+    template <class _Compare>
+        _LIBCPP_INLINE_VISIBILITY
+        void merge(forward_list&& __x, _Compare __comp)
+        {merge(__x, _STD::move(__comp));}
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
     void merge(forward_list& __x) {merge(__x, __less<value_type>());}
     template <class _Compare> void merge(forward_list& __x, _Compare __comp);
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     _LIBCPP_INLINE_VISIBILITY
     void sort() {sort(__less<value_type>());}
     template <class _Compare> void sort(_Compare __comp);
@@ -1201,11 +1211,7 @@
 template <class _Tp, class _Alloc>
 void
 forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-                                        forward_list&& __x)
-#else
                                         forward_list& __x)
-#endif
 {
     if (!__x.empty())
     {
@@ -1226,11 +1232,7 @@
 template <class _Tp, class _Alloc>
 void
 forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-                                        forward_list&& __x,
-#else
                                         forward_list& __x,
-#endif
                                         const_iterator __i)
 {
     const_iterator __lm1 = next(__i);
@@ -1248,11 +1250,7 @@
 template <class _Tp, class _Alloc>
 void
 forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-                                        forward_list&& __x,
-#else
                                         forward_list& __x,
-#endif
                                         const_iterator __f, const_iterator __l)
 {
     if (__f != __l && __p != __f)
@@ -1272,6 +1270,39 @@
     }
 }
 
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
+                                        forward_list&& __x)
+{
+    splice_after(__p, __x);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
+                                        forward_list&& __x,
+                                        const_iterator __i)
+{
+    splice_after(__p, __x, __i);
+}
+
+template <class _Tp, class _Alloc>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
+                                        forward_list&& __x,
+                                        const_iterator __f, const_iterator __l)
+{
+    splice_after(__p, __x, __f, __l);
+}
+
+#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
 template <class _Tp, class _Alloc>
 void
 forward_list<_Tp, _Alloc>::remove(const value_type& __v)
@@ -1336,11 +1367,7 @@
 template <class _Tp, class _Alloc>
 template <class _Compare>
 void
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-forward_list<_Tp, _Alloc>::merge(forward_list&& __x, _Compare __comp)
-#else
 forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp)
-#endif
 {
     if (this != &__x)
     {





More information about the cfe-commits mailing list