This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] LWG DR 1339: uninitialized_fill_n should return the end of its range


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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]