From patchwork Fri Nov 8 17:34:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 289896 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B8CCE2C009C for ; Sat, 9 Nov 2013 04:46:32 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=sU5zu7ro6br7YrydOo HiXuM/Svb/a23xuF6gSiqLBQpOEFD/46wZfY5N2DD6pm9VLkjggnWGnoJsxBhtcm ZjcLxsFuK2WHMe1taneR9ZbQ6PLdH0CizGtJRuqFBd7ZeYMQYJkRIzUsjkfrRNof MwThmU5h+MVvll8SFNlk+KS1w= 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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=AldG0OmWlRRBtN8egNRssYVa vLQ=; b=LThef1gALGzg+1vPz/cHojeHf5+TLZkGQv/OhJNYvihyMl15GOCMjMyH 47FTnvgrdPCufqC41ntaaQ0KnqzQ40a31saZMv4NmO+qAC+x0eLfpACyUG8wO7ms +iT6SxITxVRyZaD3jQmRV0AMkEVU055oM/l9T9YqVfOUlmX5T5M= Received: (qmail 845 invoked by alias); 8 Nov 2013 17:42:42 -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 11746 invoked by uid 89); 8 Nov 2013 17:34:59 -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, FREEMAIL_FROM, RDNS_NONE, SPF_PASS autolearn=no version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-la0-f42.google.com Received: from Unknown (HELO mail-la0-f42.google.com) (209.85.215.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 08 Nov 2013 17:34:58 +0000 Received: by mail-la0-f42.google.com with SMTP id ep20so1992988lab.15 for ; Fri, 08 Nov 2013 09:34:49 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.152.28.9 with SMTP id x9mr8050186lag.27.1383932089072; Fri, 08 Nov 2013 09:34:49 -0800 (PST) Received: by 10.112.173.195 with HTTP; Fri, 8 Nov 2013 09:34:48 -0800 (PST) In-Reply-To: References: Date: Fri, 8 Nov 2013 17:34:48 +0000 Message-ID: Subject: Re: [patch 4/4] std::regex refactoring From: Jonathan Wakely To: =?ISO-8859-1?Q?Daniel_Kr=FCgler?= Cc: "libstdc++" , gcc-patches , Tim Shen , "Stephen M. Webb" On 8 November 2013 16:03, Jonathan Wakely wrote: > On 8 November 2013 15:41, Jonathan Wakely wrote: >> On 8 November 2013 14:51, Daniel Krügler wrote: >>> I have fully not grasped for which T the specializations of >>> __has_contiguous_iter are intended to be used, >> >> Currently, only std::container iterators passed to a basic_regex >> constructor, but in theory the trait could get moved to another header >> and used elsewhere in future. > > Currently the vector specialization can never be reached, > because std::vector doesn't use __gnu_cxx::__normal_iterator > (and trying to pass vector::iterator to a regex ctor fails > anyway) so this is only a theoretical problem if we re-use > __has_contiguous_iter elsewhere. I've fixed the trait anyway, like so: 2013-11-08 Jonathan Wakely * include/bits/regex_compiler.h (__detail::__has_contiguous_iter): vector storage is not contiguous. Tested x86_64-linux, committed to trunk. diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h index 741098f..b9f8127 100644 --- a/libstdc++-v3/include/bits/regex_compiler.h +++ b/libstdc++-v3/include/bits/regex_compiler.h @@ -134,12 +134,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __has_contiguous_iter> - : std::true_type + : std::true_type // string storage is contiguous { }; template struct __has_contiguous_iter> - : std::true_type + : std::true_type // vector storage is contiguous + { }; + + template + struct __has_contiguous_iter> + : std::false_type // vector storage is not contiguous { }; template