Title
uninitialized_fill_n should return the end of its range
Status
c++11
Section
[uninitialized.fill]
Submitter
Jared Hoberock

Created on 2010-07-14.00:00:00 last changed 161 months ago

Messages

Date: 2010-11-23.13:22:14

Proposed resolution:

In section [memory] change:,

template <class ForwardIterator, class Size, class T>
  void ForwardIterator uninitialized_fill_n(ForwardIterator first, Size n, const T& x);

In section [uninitialized.fill.n] change,

template <class ForwardIterator, class Size, class T>
  void ForwardIterator uninitialized_fill_n(ForwardIterator first, Size n, const T& x);

1 Effects:

for (; n--; ++first)
  ::new (static_cast<void*>(&*first))
    typename iterator_traits<ForwardIterator>::value_type(x);
return first;
Date: 2010-11-23.13:22:14

[ Adopted at 2010-11 Batavia ]

Date: 2010-10-21.19:06:53

[ Post-Rapperswil: ]

Moved to Tentatively Ready after 5 positive votes on c++std-lib.

Date: 2010-07-14.00:00:00

N3092's specification of uninitialized_fill_n discards useful information and is inconsistent with other algorithms such as fill_n which accept an iterator and a size. As currently specified, unintialized_fill_n requires an additional linear traversal to find the end of the range.

Instead of returning void, unintialized_fill_n should return one past the last iterator it dereferenced.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-11-23 13:22:14adminsetmessages: + msg5406
2010-11-14 13:10:57adminsetstatus: voting -> wp
2010-11-08 14:14:39adminsetstatus: ready -> voting
2010-10-21 19:06:53adminsetmessages: + msg4777
2010-10-21 19:06:53adminsetstatus: new -> ready
2010-10-21 18:28:33adminsetmessages: + msg1634
2010-07-14 00:00:00admincreate