From patchwork Fri Jan 20 00:29:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 717440 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v4M6V29FCz9sR9 for ; Fri, 20 Jan 2017 11:29:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="tdZmj6x3"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=G+YVRRMYmVMBT1Ge4 QZgm7wnjMz5rjbaUBViJVYwnWUQY4gTP6bxwxSqLBIVvNC+hCv2plXN8A4d+KJjv nVsUf7QX2R/ePuvR5S3CSoDfTCUN2qerLPN/+YrVOgsFTdFH6n857BF325zD6cMA h6zCFE4TMOiYuzUEjvoOxL0cdQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=ntut6RreCLZ46zIiAG4xyIE wisQ=; b=tdZmj6x3u7OjOyirmn/V5B09oWIZsHx3Q6c7qu2gCuWp09LXMUjZJ2Z L8xbkqNziAJk2WwuioJupmR6xRN3q2UicDSUSLC7q4ORK1BKgdp6Uh2mwHMqucYV HqBONzT0D+Mj0bwJohy6BzSkjzhJ9qCW56g5lloFCoOH9MyjE8nE= Received: (qmail 66740 invoked by alias); 20 Jan 2017 00:29:35 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 66686 invoked by uid 89); 20 Jan 2017 00:29:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Jan 2017 00:29:31 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28B8561B84; Fri, 20 Jan 2017 00:29:31 +0000 (UTC) Received: from localhost (ovpn-116-89.ams2.redhat.com [10.36.116.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1A3D1888C0; Fri, 20 Jan 2017 00:29:30 +0000 (UTC) Date: Fri, 20 Jan 2017 00:29:29 +0000 From: Jonathan Wakely To: Tim Song Cc: libstdc++ , gcc-patches Subject: Re: [PATCH] PR64903 fix number of predicate tests in std::is_partitioned Message-ID: <20170120002928.GT3093@redhat.com> References: <20170119233301.GA17593@redhat.com> <20170120001128.GS3093@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170120001128.GS3093@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) On 20/01/17 00:11 +0000, Jonathan Wakely wrote: >On 19/01/17 19:08 -0500, Tim Song wrote: >>On Thu, Jan 19, 2017 at 6:33 PM, Jonathan Wakely wrote: >>>std::advance(__first, 1); >> >>Why not just ++__first;? > >Good question. I have no idea why I did it like that! Fixed like so. Committed to trunk. commit 926bc59c8bfe55dc85aba7ab9f3f98109918185c Author: Jonathan Wakely Date: Fri Jan 20 00:13:48 2017 +0000 PR64903 simplify last fix to std::is_partitioned PR libstdc++/64903 * include/bits/stl_algo.h (is_partitioned): Use increment instead of std::advance. diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 8cf85aa02f..938e612 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -585,7 +585,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __first = std::find_if_not(__first, __last, __pred); if (__first == __last) return true; - std::advance(__first, 1); + ++__first; return std::none_of(__first, __last, __pred); }