uninitialized_copy()
/etc. should tolerate overloaded operator&
Section: 26.11 [specialized.algorithms] Status: C++17 Submitter: Stephan T. Lavavej Opened: 2014-10-01 Last modified: 2017-07-30
Priority: 0
View other active issues in [specialized.algorithms].
View all other issues in [specialized.algorithms].
View all issues with C++17 status.
Discussion:
This restriction isn't necessary anymore. In fact, this is the section that defines addressof()
.
(Editorial note: We can depict these algorithms as calling addressof()
instead of std::addressof()
thanks to 16.4.2.2 [contents]/3 "Whenever a name x
defined in the standard library is mentioned, the name
x
is assumed to be fully qualified as ::std::x
, unless explicitly described otherwise.")
[Urbana 2014-11-07: Move to Ready]
Proposed resolution:
This wording is relative to N3936.
Change 26.11 [specialized.algorithms] p1 as depicted:
-1-
All the iterators that are used as formal template parameters in the following algorithms are required to have theirIn the algorithmoperator*
return an object for whichoperator&
is defined and returns a pointer toT
.uninitialized_copy
, the formal template parameterInputIterator
is required to satisfy the requirements of an input iterator (24.2.3). In all of the following algorithms, the formal template parameterForwardIterator
is required to satisfy the requirements of a forward iterator (24.2.5), and is required to have the property that no exceptions are thrown from increment, assignment, comparison, or indirection through valid iterators. In the following algorithms, if an exception is thrown there are no effects.
Change 26.11.5 [uninitialized.copy] p1 as depicted:
-1- Effects:
for (; first != last; ++result, ++first) ::new (static_cast<void*>(addressof(&*result))) typename iterator_traits<ForwardIterator>::value_type(*first);
Change 26.11.5 [uninitialized.copy] p3 as depicted:
-3- Effects:
for (; n > 0; ++result, ++first, --n) { ::new (static_cast<void*>(addressof(&*result))) typename iterator_traits<ForwardIterator>::value_type(*first); }
Change 26.11.7 [uninitialized.fill] p1 as depicted:
-1- Effects:
for (; first != last; ++first) ::new (static_cast<void*>(addressof(&*first))) typename iterator_traits<ForwardIterator>::value_type(x);
Change [uninitialized.fill.n] p1 as depicted:
-1- Effects:
for (; n--; ++first) ::new (static_cast<void*>(addressof(&*first))) typename iterator_traits<ForwardIterator>::value_type(x); return first;