220 28420 <3d03cd7d-2177-98fd-408d-f74b1f6a8552@gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Andrey Semashev <andrey.semashev@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Marking more std::string_view members noexcept
Date: Tue, 27 Sep 2016 15:21:18 +0300
Lines: 31
Approved: news@gmane.org
Message-ID: <3d03cd7d-2177-98fd-408d-f74b1f6a8552@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
X-Trace: blaine.gmane.org 1474978887 26238 195.159.176.226 (27 Sep 2016 12:21:27 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 27 Sep 2016 12:21:27 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.3.0
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCXY5TXHWYJRBQOIVG7QKGQET2UYTQA@isocpp.org Tue Sep 27 14:21:22 2016
Return-path: <std-proposals+bncBCXY5TXHWYJRBQOIVG7QKGQET2UYTQA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wm0-f69.google.com ([74.125.82.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCXY5TXHWYJRBQOIVG7QKGQET2UYTQA@isocpp.org>)
	id 1borNw-0005qk-Ud
	for gclcip-std-proposals@m.gmane.org; Tue, 27 Sep 2016 14:21:20 +0200
Original-Received: by mail-wm0-f69.google.com with SMTP id l132sf5698152wmf.0
        for <gclcip-std-proposals@m.gmane.org>; Tue, 27 Sep 2016 05:21:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:from:subject:message-id:date:user-agent:mime-version
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=KbbBrsE6B4OWQsdGc50colhYjtQNjck1LRqWKdd+cyY=;
        b=gk4LOj2fcAEZetFzGy9HZKWSTCVgmMjz808jaQvRdbGl3PPPTkjC3HdLuYtLMq21Qq
         zLLQMQgk9Mj+3/3jEZYTTCkaEXSc7DL68FXb6jrcrc1UgZfo4cT3eX0pmyeSmQC/GyuD
         1fqHb8NSGOpp11IDmTjlSBXY1ES1QHTQJbezv1PIhGMObhWsMcPqOWA/xps82HONrO5K
         kom4UrIUg+r5214bQQfgXvRdJoTvlybDXPt6ej5T3/ZwpMVzizyZsa8A9FbhQWZtLqnZ
         LfSXiXXsuPRVYrcWalfYfyy887P4Fa9zKYFK+Q+A4wz3ryKA5NxgovcuLDPYJyj1zRU1
         r4hA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:message-id:date:user-agent
         :mime-version:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=KbbBrsE6B4OWQsdGc50colhYjtQNjck1LRqWKdd+cyY=;
        b=IzPofeoUc5+vwsTlCbECNulVfR40EwjViuFrVl6IVgX1bIZ/cVEeygEbGlv06iBivE
         yeYYFbOiLu8abVwTsObC91brqmcWBWH7nE0ZddYHcIycLFlALc3AwBD3htQD0p661qtB
         Am+LZM9WTyt4DsxGpC4M7qnOgqxSUl9u0PqaFYATsXSbaFu0R19jXz9nVthcYX91UKmf
         WsUhNXbHXCearKEGfDbvcQmzGMrl1M9Bu7wXMTKs5nx0A8qmTaY2mQ24M+L08IkeZ0s7
         UfM/DjEIZB4aNpqBhnYmNjG47p8OKAZOhvRyvyv6lgTGl0SfM59BoGQZVgtlVpDAus7f
         m9bg==
X-Gm-Message-State: AA6/9Rm0oIQhzXcXtEzZKgU/A1p3MbE/3pWTX3de8ZkrX8EKzuB/xUb3OYO+d7FigZcojQ==
X-Received: by 10.28.4.200 with SMTP id 191mr197188wme.21.1474978882589;
        Tue, 27 Sep 2016 05:21:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.46.5.196 with SMTP id 187ls1485918ljf.2.gmail; Tue, 27 Sep
 2016 05:21:21 -0700 (PDT)
X-Received: by 10.25.75.196 with SMTP id y187mr8333507lfa.151.1474978881020;
        Tue, 27 Sep 2016 05:21:21 -0700 (PDT)
Original-Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com. [2a00:1450:4010:c07::22a])
        by mx.google.com with ESMTPS id c69si954896lfe.10.2016.09.27.05.21.20
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 27 Sep 2016 05:21:21 -0700 (PDT)
Received-SPF: pass (google.com: domain of andrey.semashev@gmail.com designates 2a00:1450:4010:c07::22a as permitted sender) client-ip=2a00:1450:4010:c07::22a;
Original-Received: by mail-lf0-x22a.google.com with SMTP id b71so20606526lfg.0
        for <std-proposals@isocpp.org>; Tue, 27 Sep 2016 05:21:20 -0700 (PDT)
X-Received: by 10.25.37.18 with SMTP id l18mr11266612lfl.88.1474978880311;
        Tue, 27 Sep 2016 05:21:20 -0700 (PDT)
Original-Received: from [192.168.1.2] (broadband-90-154-68-136.nationalcablenetworks.ru. [90.154.68.136])
        by smtp.googlemail.com with ESMTPSA id 202sm376366ljf.33.2016.09.27.05.21.19
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 27 Sep 2016 05:21:19 -0700 (PDT)
X-Original-Sender: andrey.semashev@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 andrey.semashev@gmail.com designates 2a00:1450:4010:c07::22a as permitted
 sender) smtp.mailfrom=andrey.semashev@gmail.com;       dmarc=pass (p=NONE
 dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:28420
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/28420>

Hi,

I'm looking at string_view interface definition in N4606 and wondering 
why so many members are not marked noexcept? For example, these 
constructors:

   constexpr basic_string_view(const charT* str);
   constexpr basic_string_view(const charT* str, size_type len);

Assuming that the input string is not a constant expression, the first 
constructor would call an equivalent of strlen(str), which in 99% is a 
no-throw operation. Why not mark it 
"noexcept(noexcept(traits::length(str))"? The second constructor does 
not even need that and could be simply noexcept.

I'm most interested in constructors, but other members like operator[], 
front(), back(), substr(), compare() also don't seem to need to ever 
throw, yet they are not marked noexcept.

Is there a reason for these omissions?

Also, why there is no obvious constructor from basic_string?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/3d03cd7d-2177-98fd-408d-f74b1f6a8552%40gmail.com.

.
