[cfe-commits] [libcxx] r137860 - /libcxx/branches/apple/include/string

Howard Hinnant hhinnant at apple.com
Wed Aug 17 13:30:53 PDT 2011


Author: hhinnant
Date: Wed Aug 17 15:30:53 2011
New Revision: 137860

URL: http://llvm.org/viewvc/llvm-project?rev=137860&view=rev
Log:
Fixed <rdar://problem/9969674>

Modified:
    libcxx/branches/apple/include/string

Modified: libcxx/branches/apple/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/branches/apple/include/string?rev=137860&r1=137859&r2=137860&view=diff
==============================================================================
--- libcxx/branches/apple/include/string (original)
+++ libcxx/branches/apple/include/string Wed Aug 17 15:30:53 2011
@@ -1578,6 +1578,27 @@
 #endif
 
     _LIBCPP_INLINE_VISIBILITY
+    void
+    __move_assign_alloc(const basic_string& __str)
+        _NOEXCEPT_(
+            !__alloc_traits::propagate_on_container_move_assignment::value ||
+            is_nothrow_move_assignable<allocator_type>::value)
+    {__move_assign_alloc(__str, integral_constant<bool,
+                      __alloc_traits::propagate_on_container_move_assignment::value>());}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(const basic_string& __c, true_type)
+        _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+        {
+            __alloc() = _VSTD::move(__c.__alloc());
+        }
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __move_assign_alloc(const basic_string& __c, false_type)
+        _NOEXCEPT
+        {}
+
+    _LIBCPP_INLINE_VISIBILITY
     static void __swap_alloc(allocator_type& __x, allocator_type& __y)
         _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
                    __is_nothrow_swappable<allocator_type>::value)
@@ -2120,7 +2141,8 @@
 {
     clear();
     shrink_to_fit();
-    __r_ = _VSTD::move(__str.__r_);
+    __r_.first() = __str.__r_.first();
+    __move_assign_alloc(__str);
     __str.__zero();
 }
 





More information about the cfe-commits mailing list