summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2011-08-17 20:36:18 +0000
committerHoward Hinnant <hhinnant@apple.com>2011-08-17 20:36:18 +0000
commite41124ade18ac99f2453586dfa1de4b6973b78d7 (patch)
tree6e80ad79b70cef91fb004b1d1e537bd394760610
parente2d152016fae5ec61d5ad464e7b3a59751f6de26 (diff)
downloadbcm5719-llvm-e41124ade18ac99f2453586dfa1de4b6973b78d7.tar.gz
bcm5719-llvm-e41124ade18ac99f2453586dfa1de4b6973b78d7.zip
Don't move assign string::allocator_type when propagate_on_container_move_assignment is false.
llvm-svn: 137862
-rw-r--r--libcxx/include/string24
1 files changed, 23 insertions, 1 deletions
diff --git a/libcxx/include/string b/libcxx/include/string
index 7fdf0d89061..a1dba310b5b 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -1592,6 +1592,27 @@ private:
#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)
@@ -2138,7 +2159,8 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
{
clear();
shrink_to_fit();
- __r_ = _VSTD::move(__str.__r_);
+ __r_.first() = __str.__r_.first();
+ __move_assign_alloc(__str);
__str.__zero();
}
OpenPOWER on IntegriCloud