Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 57075 invoked from network); 8 Dec 2005 02:25:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Dec 2005 02:25:09 -0000 Received: (qmail 76345 invoked by uid 500); 8 Dec 2005 02:25:09 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 76330 invoked by uid 500); 8 Dec 2005 02:25:08 -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 76319 invoked by uid 500); 8 Dec 2005 02:25:08 -0000 Delivered-To: apmail-incubator-stdcxx-cvs@incubator.apache.org Received: (qmail 76300 invoked by uid 99); 8 Dec 2005 02:25:08 -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:25:08 -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:25:08 -0800 Received: (qmail 56972 invoked by uid 65534); 8 Dec 2005 02:24:47 -0000 Message-ID: <20051208022447.56969.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r354936 - /incubator/stdcxx/trunk/include/algorithm Date: Thu, 08 Dec 2005 02:24:47 -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:24:41 2005 New Revision: 354936 URL: http://svn.apache.org/viewcvs?rev=354936&view=rev Log: 2005-12-07 Martin Sebor STDCXX-83 * algorithm (generate_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/algorithm Modified: incubator/stdcxx/trunk/include/algorithm URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/include/algorithm?rev=354936&r1=354935&r2=354936&view=diff ============================================================================== --- incubator/stdcxx/trunk/include/algorithm (original) +++ incubator/stdcxx/trunk/include/algorithm Wed Dec 7 18:24:41 2005 @@ -4,7 +4,7 @@ * algorithm - declarations and inline definitions of the C++ Standard * Library algorithms * - * $Id: //stdlib/dev/include/algorithm#50 $ + * $Id$ * *************************************************************************** * @@ -416,7 +416,11 @@ template inline void generate_n (_OutputIter __first, _Size __n, _Generator __gen) { - for (; __n > 0; --__n, ++__first) + // 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 = __gen (); }