220 28421 <CAGNvRgBSk47UXuzh_jm_Yr2pBCM5NYSZ8kqVjwLyWsm-4r6ozw@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: =?UTF-8?Q?Daniel_Kr=C3=BCgler?= <daniel.kruegler@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Marking more std::string_view members noexcept
Date: Tue, 27 Sep 2016 19:47:00 +0200
Lines: 40
Approved: news@gmane.org
Message-ID: <CAGNvRgBSk47UXuzh_jm_Yr2pBCM5NYSZ8kqVjwLyWsm-4r6ozw@mail.gmail.com>
References: <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
X-Trace: blaine.gmane.org 1474998433 7645 195.159.176.226 (27 Sep 2016 17:47:13 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 27 Sep 2016 17:47:13 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCT7RVFA4QORBFPBVK7QKGQEP4ROXEQ@isocpp.org Tue Sep 27 19:47:08 2016
Return-path: <std-proposals+bncBCT7RVFA4QORBFPBVK7QKGQEP4ROXEQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f72.google.com ([209.85.215.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCT7RVFA4QORBFPBVK7QKGQEP4ROXEQ@isocpp.org>)
	id 1bowT6-0000NT-Cx
	for gclcip-std-proposals@m.gmane.org; Tue, 27 Sep 2016 19:47:00 +0200
Original-Received: by mail-lf0-f72.google.com with SMTP id b71sf22618939lfg.2
        for <gclcip-std-proposals@m.gmane.org>; Tue, 27 Sep 2016 10:47:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :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=/kOVh0icwRBzoT54mBvpPjnl8pO1ruk+2CXLM7NytaU=;
        b=G7vcvTcmIQaHJGccMr2999prafAjIacQNbwJx9HPl7gNR0LJJUdWsIaK1H4kPQCyqU
         9jLtSAgBBblOQ7/ys/jTVcy2bh1kXL6PkJu7/RD6MnNrBBNJf5snOjife0EWZk2oySxk
         johbylDaqnXJM0xYJUqDR48nQWp5mbXq7p/nn8CVML0tiRPyYLIiVtpTQHJ9YeJUH/OM
         j9mi/Apx2n3B0mWldHgIeklVTLIVliJcILUeKvHQFfpvZ2922TPByjyaueJx/DzREFsh
         VFFVTRho9UmnKpViSf3oOhZPqSX1swOSpHacM36DGYo/xJ8NDjMW8SBVA6Ohl8Za4T8s
         3HPg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to: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=/kOVh0icwRBzoT54mBvpPjnl8pO1ruk+2CXLM7NytaU=;
        b=TKQ7yzixoHRNZYg3e9/bKOG6uFC0c8qXpNNsRlDTcnoIP47eTEaxB0C8Oyw61jR7ba
         jt0ekRCCrCpuEyEGlz79XTgUTAReCFoH96ofZQ2w/DsDq8jtV4ujFXX623v34jk+5x7s
         xElgyC9K5zjAY7v/xjaY6dTTcxqzsnLeMKVzzTCzMSVWFn0XhBkwiEAAgfWedR0sL1WL
         33IUZYj01W6ZvV9MvnaQjerHliq/QG5GiigBpWfA2q6r4fCzM6MzJbhOhAMsJZrKd7wJ
         bmG1Fp4FNz1NezEi4CR3nm5IkDqalH+FT3z0mLuWLvfqkzt2hKFH3D66qa1gVIOtBLWh
         zNFQ==
X-Gm-Message-State: AE9vXwNVBHy2mN0/EVSCBVaiZIzDtz4CtufGKw4xBMTB/WAKKQfR2cqewt2NoBfCdjc1Hw==
X-Received: by 10.25.204.21 with SMTP id c21mr1502423lfg.19.1474998422363;
        Tue, 27 Sep 2016 10:47:02 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.17.7 with SMTP id 7ls2048280wmr.0.canary; Tue, 27 Sep 2016
 10:47:01 -0700 (PDT)
X-Received: by 10.28.181.145 with SMTP id e139mr4093839wmf.114.1474998421216;
        Tue, 27 Sep 2016 10:47:01 -0700 (PDT)
Original-Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com. [2a00:1450:400c:c09::22d])
        by mx.google.com with ESMTPS id 8si14855257wmo.24.2016.09.27.10.47.01
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 27 Sep 2016 10:47:01 -0700 (PDT)
Received-SPF: pass (google.com: domain of daniel.kruegler@gmail.com designates 2a00:1450:400c:c09::22d as permitted sender) client-ip=2a00:1450:400c:c09::22d;
Original-Received: by mail-wm0-x22d.google.com with SMTP id w84so189363809wmg.1
        for <std-proposals@isocpp.org>; Tue, 27 Sep 2016 10:47:01 -0700 (PDT)
X-Received: by 10.194.81.106 with SMTP id z10mr23344727wjx.140.1474998420601;
 Tue, 27 Sep 2016 10:47:00 -0700 (PDT)
Original-Received: by 10.28.167.12 with HTTP; Tue, 27 Sep 2016 10:47:00 -0700 (PDT)
In-Reply-To: <3d03cd7d-2177-98fd-408d-f74b1f6a8552@gmail.com>
X-Original-Sender: daniel.kruegler@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 daniel.kruegler@gmail.com designates 2a00:1450:400c:c09::22d as permitted
 sender) smtp.mailfrom=daniel.kruegler@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:28421
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/28421>

2016-09-27 14:21 GMT+02:00 Andrey Semashev <andrey.semashev@gmail.com>:
> 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?

This is so, because these functions have a narrow contract. The
current guideline for LWG was described by this proposal:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3279.pdf

> Also, why there is no obvious constructor from basic_string?

Which one in particular is in your mind?

Thanks,

- Daniel

-- 
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/CAGNvRgBSk47UXuzh_jm_Yr2pBCM5NYSZ8kqVjwLyWsm-4r6ozw%40mail.gmail.com.

.
