220 35109 <172fc6328e80a64a748e4fabe78cfa5f@kdab.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Marc Mutz <marc.mutz@kdab.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Marking more std::string_view members noexcept
Date: Thu, 26 Oct 2017 10:40:50 +0200
Organization: KDAB
Lines: 40
Approved: news@gmane.org
Message-ID: <172fc6328e80a64a748e4fabe78cfa5f@kdab.com>
References: <3d03cd7d-2177-98fd-408d-f74b1f6a8552@gmail.com>
 <CAGNvRgBSk47UXuzh_jm_Yr2pBCM5NYSZ8kqVjwLyWsm-4r6ozw@mail.gmail.com>
 <af89c375-0437-4092-cfc7-d93eafbf969e@gmail.com>
 <2b8591ee-3a1e-4a41-8c14-221bdc5cd1e4@isocpp.org>
 <da4a8fb7-246b-f19c-3f50-7bb5f318f1a4@gmail.com>
 <0574ad73-0d36-47c0-9e47-79e234cc6708@isocpp.org>
 <79ff7517-9d44-4770-8124-a2a036a2e6be@isocpp.org>
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 1509007272 19671 195.159.176.226 (26 Oct 2017 08:41:12 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 26 Oct 2017 08:41:12 +0000 (UTC)
Cc: pavel.kryukov@phystech.edu
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCRPXDOU7ECRBG57Y3HQKGQEGLFXNHA@isocpp.org Thu Oct 26 10:41:03 2017
Return-path: <std-proposals+bncBCRPXDOU7ECRBG57Y3HQKGQEGLFXNHA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wr0-f200.google.com ([209.85.128.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCRPXDOU7ECRBG57Y3HQKGQEGLFXNHA@isocpp.org>)
	id 1e7dif-00034Q-J7
	for gclcip-std-proposals@m.gmane.org; Thu, 26 Oct 2017 10:40:53 +0200
Original-Received: by mail-wr0-f200.google.com with SMTP id w105sf1270927wrc.20
        for <gclcip-std-proposals@m.gmane.org>; Thu, 26 Oct 2017 01:41:01 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1509007261; cv=pass;
        d=google.com; s=arc-20160816;
        b=OR6Z0h4/TuToihVn+vLJlwsEitVCS6nBUiUMThZDZz4X3BJq1Hq1oeQxJd0wKQYRC2
         7bS8R+GLUlDFlZBnDULjnO2EHXzykmZrZ84J7sJVg8Y9YHGF4770wL3EEsD+x5/lZNHo
         KoqERHvZ7HWInEAuzY5+rHVzcvyH8WcMx+TWzWP/PERfW6GO2b0DvCZ8BrYYtRjC1VFd
         ZDKmzYNHCL/cxQm3lq5Yfu+ONMZaPNTxpXZAAse7eHnHIn0of25qqsGR7N2VrZEQz+OA
         YeMxdfbPds/LZHgCcBKCAuAvwS99NjG2VemPlJyC9osZ2MsBSUtaoZDh4eE0bXzssDA/
         K/Ug==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:message-id:references
         :in-reply-to:organization:subject:cc:to:from:date:mime-version
         :sender:arc-authentication-results:arc-message-signature
         :arc-authentication-results;
        bh=Y/QEdRAPMncXpBmpGHsk6eAUOMqtHQuo3uiOZbUm+Pw=;
        b=LxjYcjoZJHKgvRkbU6ZjgyNVbAEdvUQrnJivkiGtEnfSPdmvWGM1CMQLeG1xRfH4Kc
         ImTDDUGlEitPIgtTmIQmqEyK7ui65+6at2pPsRfa/OGAt7f13qiIqq9WijdglNeCZvTy
         Y/mN7jbNJy/oQIGROofg8nUlfr9gcPp+HEQgbO1xsM4k9NyzIhBdYq4Ztly0beEC0HgC
         bvOq6NghDMXKXPiW0CBM9VVLP6OAkzyeM/Um9XURXD0KoUOlAr3pS81xZL6UWjsgkOVl
         XmL4v1zv5rRypWmJtczj5uvPZIAVMq8sMyUmtKdiNfZ9KlZILAPn9A6WMSl638w+IO1j
         /aNA==
ARC-Authentication-Results: i=2; mx.google.com;
       spf=pass (google.com: domain of marc.mutz@kdab.com designates 176.9.126.58 as permitted sender) smtp.mailfrom=marc.mutz@kdab.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:sender:mime-version:date:from:to:cc:subject
         :organization:in-reply-to:references:message-id: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=Y/QEdRAPMncXpBmpGHsk6eAUOMqtHQuo3uiOZbUm+Pw=;
        b=jLEx8kULBZN1TIlFjn+7nNcleEpPP9rYzHBj9LJCrs+NHp3vsu09S/VNWy/dZuU47L
         dmVTwX3FLGce/JJo/72xAP8F4G3a1PcrZpelVTahlMJAL70NMgHCsxEutbPQsq9ifCQ1
         BO4Lj40Yqip/WwV3Id41vvttDtPDcg2QA0GTp1q/hQk0ONAE/gUE8xK6uxZ9EN5Prc2Y
         8P59ciDp8i662+KCYhbpTvHl+C/5Pa9TZCa6mN3GVY+gz/cBZO9yG3cD22roP/2sIUck
         iAEzyKuc2EUda2z9ffb9tjgrvWowCWNKRr4jXHCb1Ihn1pNLFU1PbyL5q86MAn8ydvs+
         VcAw== 
X-Gm-Message-State: AMCzsaXrb0QU8b9vDihTzasQYsyzJBPFzsgDNe9a7segKHX44/Vg7LQm
	Cpq8Btrv+mGa3vYvZ/bPMLLYeA==
X-Google-Smtp-Source: ABhQp+S+0eO8wm+VcfGywItSCsn/B9Z/Sp0edi8ql5Lpm9QwzYNNSV3C2y0eXaAkhE5N9Ant3SKkCw==
X-Received: by 10.28.144.210 with SMTP id s201mr118133wmd.20.1509007261006;
        Thu, 26 Oct 2017 01:41:01 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.223.141.202 with SMTP id o68ls681034wrb.6.gmail; Thu, 26 Oct
 2017 01:40:59 -0700 (PDT)
X-Received: by 10.28.95.10 with SMTP id t10mr867351wmb.72.1509007259668;
        Thu, 26 Oct 2017 01:40:59 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1509007259; cv=none;
        d=google.com; s=arc-20160816;
        b=cY4krd6nS1KMjZBNtoIMKbjS1iTTzujiLJ8tAHL68M7h7Lw4uO/cY7187GqrF6g17L
         JV3AxdfwhgUznBYVQIdsq6RBW6t6WL8v2NbG2AfIgz1Q/8Ij8xb5uzHsuMitgGh1Jf8P
         y5VgrJA0flKM/eOergrQCGZ9flZ7Qtg9SpYo/0XxW0sa2G7Trksnm94r6FmC5iZdCy1E
         EsHyZisk7o1n5hoAgtu0HTDphg00Nqx08wiUu/u6Z7HvNYItEXMtbLK5aNGluLhGvUo0
         lZBG6zrLSw0MBTzJzGfsRrWv3yBPOuwr6nLYFwx1lguUkL/rjhdedKFhVzyIGJCvofkt
         Xmjg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=message-id:references:in-reply-to:organization:subject:cc:to:from
         :date:content-transfer-encoding:mime-version:sender
         :arc-authentication-results;
        bh=NPRcEFldq3P4DVogg7iefTnOOHWLULzOUGDQAu4+8hw=;
        b=JnNirWstJxqBE4Qi/00S17ls2akI3sEyo67p975jOZg0X6PDwUzDxgGrerMcs4O9It
         ut/0dDzL5aoEM53JPPpMHtOavWzvJkDWhRlAha2eTgk214j1WmrSRTMvWSYONIcmxCbM
         pmsuooJIforjMtVjcSFz1XTwqJm0XyHc1Tn0w/p4RiKHNz6d95U4AbOvSiSJu/B/2HW9
         +MagyPo3HDqcGNL6SSvtyAdC9pKOPbUp6Kqsu2rOcCqXw84/ydhQbDedAUYWLphFn0GO
         D2JlpHWOk3v8IfDaquz9XGGHSCCttezjoZAW2MW3FqUUdQkKP2/jwMV6ZKmOSUyB9r1u
         Zp/A==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=pass (google.com: domain of marc.mutz@kdab.com designates 176.9.126.58 as permitted sender) smtp.mailfrom=marc.mutz@kdab.com
Original-Received: from mail.kdab.com (mail.kdab.com. [176.9.126.58])
        by mx.google.com with ESMTPS id 38si3331789wry.273.2017.10.26.01.40.59
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 26 Oct 2017 01:40:59 -0700 (PDT)
Received-SPF: pass (google.com: domain of marc.mutz@kdab.com designates 176.9.126.58 as permitted sender) client-ip=176.9.126.58;
X-Virus-Scanned: amavisd-new at kdab.com
Original-Sender: marc@kdab.com
In-Reply-To: <79ff7517-9d44-4770-8124-a2a036a2e6be@isocpp.org>
X-Sender: marc.mutz@kdab.com
X-Original-Sender: marc.mutz@kdab.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of marc.mutz@kdab.com designates 176.9.126.58 as permitted sender) smtp.mailfrom=marc.mutz@kdab.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:35109
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/35109>

On 2017-10-25 22:07, pavel.kryukov@phystech.edu wrote:
> Hi
> 
> If there was a ctor from array reference, would it be noexcept?
> 
> template<size_t N>
> constexpr basic_string_view(const charT(&str)[N]) noexcept;

This one still has the precondition that [Char, N) is a valid range. It 
might not be:

    char bug[512];
    auto s = string_view(bug);

but you can't check (in C++) for that.

FWIW, QStringView's Char[N] and Char* ctors are noexcept while the 
(Char*, n) and (Char*, Char*) ones are not. I believe I did it like that 
according to (non-/)checkability of preconditions (you can't check for 
precondition violations for the first two, but you can check for some 
violations for the other two). If you can't check using C++, then you 
can't add an assert[1].

> Of course, you may do reinterpret_cast and pass something wrong to it,
> but it would be programmer's responsibility.

Meeting the preconditions of a function he's calling is _always_ the 
programmer's responsibility.

Thanks,
Marc

[1] not entirely true: https://codereview.qt-project.org/193707

-- 
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/172fc6328e80a64a748e4fabe78cfa5f%40kdab.com.

.
