Implement LWG2433: uninitialized_copy()/etc. should tolerate overloaded operator&

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237699 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2015-05-19 15:01:48 +00:00
parent 02be74588a
commit 5dce73dd6e
6 changed files with 102 additions and 8 deletions

View File

@@ -3527,8 +3527,8 @@ uninitialized_copy(_InputIterator __f, _InputIterator __l, _ForwardIterator __r)
try
{
#endif
for (; __f != __l; ++__f, ++__r)
::new(&*__r) value_type(*__f);
for (; __f != __l; ++__f, (void) ++__r)
::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -3551,8 +3551,8 @@ uninitialized_copy_n(_InputIterator __f, _Size __n, _ForwardIterator __r)
try
{
#endif
for (; __n > 0; ++__f, ++__r, --__n)
::new(&*__r) value_type(*__f);
for (; __n > 0; ++__f, (void) ++__r, (void) --__n)
::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -3576,7 +3576,7 @@ uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x)
{
#endif
for (; __f != __l; ++__f)
::new(&*__f) value_type(__x);
::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -3598,8 +3598,8 @@ uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
try
{
#endif
for (; __n > 0; ++__f, --__n)
::new(&*__f) value_type(__x);
for (; __n > 0; ++__f, (void) --__n)
::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)