A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue1339 below:

uninitialized_fill_n should return the end of its range

This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

1339. uninitialized_fill_n should return the end of its range

Section: 26.11.7 [uninitialized.fill] Status: C++11 Submitter: Jared Hoberock Opened: 2010-07-14 Last modified: 2017-06-15

Priority: Not Prioritized

View all issues with C++11 status.

Discussion:

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.

[ Post-Rapperswil: ]

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

[ Adopted at 2010-11 Batavia ]

Proposed resolution:

In section 20.2 [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;

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4