From patchwork Tue Feb 4 02:07:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1233097 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-518822-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=FT41Aiyq; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MDQn5qxD; dkim-atps=neutral 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 48BSl26yMKz9sX0 for ; Tue, 4 Feb 2020 13:07:41 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=r5dZrSZusyck5OzJ FUpMYWJ15okRAWnfZ/NZiyUgtlXJMCuBOTksWfP2o47zknkcrafbldHe1c9nghRe SvyEYIYFEBoDl3ygWtgPJ7/+NKQgjGfXSyYBV64aB4fnd9FlGQkFPPtedm6oT9Mj Qnj8ABScf88TgAWV7mfiFj4uIXE= 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:from :to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=9uD15hiK2ncOmuT0Dh8xD1 IRSwA=; b=FT41AiyqYIRaqFGEJwxOiG7xxbyCa4CjGSqk8GGwQ8XPQeOWXTd3FK Vuoh7dcfLWomeU1YWQ+timTJAwnWB9yeFGs+rf4xsIBMudK8Sze23gdu1bKUqv1c pSzq2n5AHPe9xdB5OxGPCERvgaFmgbF/KAnLQXSvVxSXg0mNgaKoQ= Received: (qmail 114527 invoked by alias); 4 Feb 2020 02:07:33 -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 114513 invoked by uid 89); 4 Feb 2020 02:07:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Feb 2020 02:07:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580782049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6N38/aZy7jtBpW2RPlCpEmwwuz3KPZzynKY7kWfAN/M=; b=MDQn5qxDsvmYR6UlDYcr+EUIPS0efNWZwGLD5ZR+C6hkfDdt1GDizaeQ980Iv2aRFh2NgV VdExJOlNZm48iYTqJG/eWpkB5vB1QDHWrgFKDLbrflhr9Bq8I8hAfMT5tVsuA7jiEI8ZcE Bn7PuqWWXLve3zHimye6Gmf8edA8z2o= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-84-o9wJ9ZU5NjadSXBvX28y5Q-1; Mon, 03 Feb 2020 21:07:27 -0500 Received: by mail-qt1-f200.google.com with SMTP id r9so11400731qtc.4 for ; Mon, 03 Feb 2020 18:07:27 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id a36sm11185884qtk.29.2020.02.03.18.07.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2020 18:07:26 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, jwakely@redhat.com, Patrick Palka Subject: [PATCH 1/3] libstdc++: Apply the move_iterator changes described in P1207R4 Date: Mon, 3 Feb 2020 21:07:22 -0500 Message-Id: <20200204020724.217468-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes These changes are needed for some of the tests in the constrained algorithm patch, because they use move_iterator with an uncopyable output_iterator. The other changes described in the paper are already applied, it seems. libstdc++-v3/ChangeLog: * include/bits/stl_iterator.h (move_iterator::move_iterator): Move the iterator when initializing _M_current. (move_iterator::base): Split into two overloads differing in ref-qualifiers as in P1207R4. --- libstdc++-v3/include/bits/stl_iterator.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 784d200d22f..1a288a5c785 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -1166,7 +1166,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit _GLIBCXX17_CONSTEXPR move_iterator(iterator_type __i) - : _M_current(__i) { } + : _M_current(std::move(__i)) { } template _GLIBCXX17_CONSTEXPR @@ -1174,9 +1174,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_current(__i.base()) { } _GLIBCXX17_CONSTEXPR iterator_type - base() const + base() const & +#if __cplusplus > 201703L && __cpp_lib_concepts + requires copy_constructible +#endif { return _M_current; } + _GLIBCXX17_CONSTEXPR iterator_type + base() && + { return std::move(_M_current); } + _GLIBCXX17_CONSTEXPR reference operator*() const { return static_cast(*_M_current); }