From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50436 invoked by alias); 30 Apr 2015 12:39:16 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 50414 invoked by uid 89); 30 Apr 2015 12:39:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_50,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 30 Apr 2015 12:39:14 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 23B908EB2B; Thu, 30 Apr 2015 12:39:13 +0000 (UTC) Received: from localhost (ovpn-116-62.ams2.redhat.com [10.36.116.62]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3UCdC61027282; Thu, 30 Apr 2015 08:39:12 -0400 Date: Thu, 30 Apr 2015 12:47:00 -0000 From: Jonathan Wakely To: Ed Smith-Rowland <3dw4rd@verizon.net> Cc: gcc-patches , "libstdc++@gcc.gnu.org" Subject: Re: [PATCH] [libstdc++] Add uniform container erasure. Message-ID: <20150430123911.GS3618@redhat.com> References: <55421311.90905@verizon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <55421311.90905@verizon.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-04/txt/msg02032.txt.bz2 On 30/04/15 07:33 -0400, Ed Smith-Rowland wrote: >This has been in me tree for a good while. > >It is fairly simple and adds C++ experimental container erasure. And make_array, which isn't in the working paper yet, so I'd prefer to leave that part out for now. >Index: include/experimental/erase_if.tcc >=================================================================== >--- include/experimental/erase_if.tcc (revision 0) >+++ include/experimental/erase_if.tcc (working copy) >@@ -0,0 +1,70 @@ >+// -*- C++ -*- >+ >+// Copyright (C) 2015 Free Software Foundation, Inc. >+// >+// This file is part of the GNU ISO C++ Library. This library is free >+// software; you can redistribute it and/or modify it under the >+// terms of the GNU General Public License as published by the >+// Free Software Foundation; either version 3, or (at your option) >+// any later version. >+ >+// This library is distributed in the hope that it will be useful, >+// but WITHOUT ANY WARRANTY; without even the implied warranty of >+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+// GNU General Public License for more details. >+ >+// Under Section 7 of GPL version 3, you are granted additional >+// permissions described in the GCC Runtime Library Exception, version >+// 3.1, as published by the Free Software Foundation. >+ >+// You should have received a copy of the GNU General Public License and >+// a copy of the GCC Runtime Library Exception along with this program; >+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see >+// . >+ >+/** @file experimental/erase_if.tcc >+ * This is an internal header file, included by other library headers. >+ * Do not attempt to use it directly. @headername{erase_if} The Doxygen @headername command tells users which header they are supposed to include, rather than this one. Since there is no header that's wrong. I'd just omit the @headername. >+ */ >+ >+#ifndef _GLIBCXX_EXPERIMENTAL_ERASE_IF_TCC >+#define _GLIBCXX_EXPERIMENTAL_ERASE_IF_TCC 1 >+ >+#pragma GCC system_header >+ >+#if __cplusplus <= 201103L >+# include >+#else >+ >+namespace std >+{ >+namespace experimental >+{ >+inline namespace fundamentals_v2 >+{ >+ >+ namespace __detail >+ { >+ template >+ void >+ __erase_nodes_if(_Container& __cont, _Predicate __pred) >+ { >+ for (auto __iter = __cont.begin(), __last = __cont.end(); >+ __iter != __last;) >+ { >+ if (__pred(*__iter)) >+ __iter = __cont.erase(__iter); >+ else >+ ++__iter; >+ } >+ } >+ } This file doesn't really seem like a .tcc to me, it isn't providing definitions of templates declared elsewhere (specifically in an erase_if.h header). Maybe we want an experimental/bits/ directory for this sort of thing (which I could also use for the filesystem headers I'm about to commit) but in the meanwhile I think just experimental/erase_if.h is a better name. OK for trunk with those changes (remove make_array, rename erase_if.tcc)