From stdcxx-commits-return-231-apmail-incubator-stdcxx-commits-archive=incubator.apache.org@incubator.apache.org Thu Dec 08 02:27:46 2005 Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 59703 invoked from network); 8 Dec 2005 02:27:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Dec 2005 02:27:46 -0000 Received: (qmail 82872 invoked by uid 500); 8 Dec 2005 02:27:46 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 82855 invoked by uid 500); 8 Dec 2005 02:27:46 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 82840 invoked by uid 500); 8 Dec 2005 02:27:45 -0000 Delivered-To: apmail-incubator-stdcxx-cvs@incubator.apache.org Received: (qmail 82837 invoked by uid 99); 8 Dec 2005 02:27:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Dec 2005 18:27:45 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 07 Dec 2005 18:27:45 -0800 Received: (qmail 59286 invoked by uid 65534); 8 Dec 2005 02:27:24 -0000 Message-ID: <20051208022724.59283.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r354938 - /incubator/stdcxx/trunk/include/rw/_algobase.h Date: Thu, 08 Dec 2005 02:27:23 -0000 To: stdcxx-cvs@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: sebor Date: Wed Dec 7 18:27:16 2005 New Revision: 354938 URL: http://svn.apache.org/viewcvs?rev=354938&view=rev Log: 2005-12-07 Martin Sebor STDCXX-84 * _algobase.h (fill_n): Removed the assumption that the Size argument is modifiable and can be predecremented and instead converted it to ptrdiff_t and manipulated the converted object. Modified: incubator/stdcxx/trunk/include/rw/_algobase.h Modified: incubator/stdcxx/trunk/include/rw/_algobase.h URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/include/rw/_algobase.h?rev=354938&r1=354937&r2=354938&view=diff ============================================================================== --- incubator/stdcxx/trunk/include/rw/_algobase.h (original) +++ incubator/stdcxx/trunk/include/rw/_algobase.h Wed Dec 7 18:27:16 2005 @@ -6,7 +6,7 @@ * This is an internal header file used to implement the C++ Standard * Library. It should never be #included directly by a program. * - * $Id: //stdlib/dev/include/rw/_algobase.h#25 $ + * $Id$ * *************************************************************************** * @@ -115,10 +115,14 @@ template -inline void fill_n (_OutputIter __first, _Size __n, const _TypeT& __value) +inline void fill_n (_OutputIter __first, _Size __n, const _TypeT &__val) { - for (;__n > 0;--__n, ++__first) - *__first = __value; + // Size must be convertible to integral type but need not itself be one + // Complexity: + // Exactly n if n is positive, or 0 otherwise, assignments. + // (see lwg issue 426 for the complexity when n is not positive) + for (_RWSTD_PTRDIFF_T __inx = __n; 0 < __inx; --__inx, ++__first) + *__first = __val; }