This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] LWG DR 1339: uninitialized_fill_n should return the end of its range
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Thu, 25 Sep 2014 17:08:28 +0100
- Subject: Re: [patch] LWG DR 1339: uninitialized_fill_n should return the end of its range
- Authentication-results: sourceware.org; auth=none
- References: <20140925152745 dot GG2669 at redhat dot com>
On the subject of uninitialized_fill_n (and also fill_n) I'm wondering
if we should add the following:
template<typename FwdIter, typename T>
FwdIter
uninitialized_fill_n(FwdIter, FwdIter, const T&) = delete;
This would catch calls like uninitialized_fill_n(p, p+n, t) that are
almost certainly a mistake. The second argument should be n, not p+n,
but it compiles and then loops until decrementing the pointer reaches
0, or it segfaults, whichever happens first!