Title
uninitialized_copy()/etc. should tolerate overloaded operator&
Status
c++17
Section
[specialized.algorithms]
Submitter
Stephan T. Lavavej

Created on 2014-10-01.00:00:00 last changed 89 months ago

Messages

Date: 2014-11-08.16:43:57

Proposed resolution:

This wording is relative to N3936.

  1. Change [specialized.algorithms] p1 as depicted:

    -1- All the iterators that are used as formal template parameters in the following algorithms are required to have their operator* return an object for which operator& is defined and returns a pointer to T. In the algorithm uninitialized_copy, the formal template parameter InputIterator is required to satisfy the requirements of an input iterator (24.2.3). In all of the following algorithms, the formal template parameter ForwardIterator 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.

  2. Change [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);
    
  3. Change [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);
    }
    
  4. Change [uninitialized.fill] p1 as depicted:

    -1- Effects:

    for (; first != last; ++first)
      ::new (static_cast<void*>(addressof(&*first)))
        typename iterator_traits<ForwardIterator>::value_type(x);
    
  5. 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;
    
Date: 2014-11-08.16:43:57

[ Urbana 2014-11-07: Move to Ready ]

Date: 2014-10-01.00:00:00

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 [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.")

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2015-05-22 18:31:21adminsetstatus: ready -> wp
2014-11-08 16:43:57adminsetmessages: + msg7180
2014-11-08 16:43:57adminsetstatus: new -> ready
2014-10-07 19:24:34adminsetmessages: + msg7125
2014-10-01 00:00:00admincreate