220 34257 <CAFk2RUYH3MitS+1HXMJkBsRPAvyV4VaX+nxiNj00ozF=cbfwRQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Proposal to add constructors to std::bad_alloc
 exception class.
Date: Fri, 1 Sep 2017 23:45:34 +0300
Lines: 32
Approved: news@gmane.org
Message-ID: <CAFk2RUYH3MitS+1HXMJkBsRPAvyV4VaX+nxiNj00ozF=cbfwRQ@mail.gmail.com>
References: <d9001051-0946-4dcf-bf78-8bcdb8302989@isocpp.org>
 <CAFk2RUaAOnPnLsUc5SpycK9dTpeT60+Vt0dQFbSPMROb7JCf0w@mail.gmail.com> <CAGg_6+P1nWqSwTQWAWt8jJ6YEM7zKjDp1xzK56OT+iAc5ayzhQ@mail.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 1504298750 23253 195.159.176.226 (1 Sep 2017 20:45:50 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 1 Sep 2017 20:45:50 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC5JHI7A7ALRB34NU7GQKGQE3TQWHCI@isocpp.org Fri Sep 01 22:45:38 2017
Return-path: <std-proposals+bncBC5JHI7A7ALRB34NU7GQKGQE3TQWHCI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f198.google.com ([209.85.192.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRB34NU7GQKGQE3TQWHCI@isocpp.org>)
	id 1dnsoj-00052F-PY
	for gclcip-std-proposals@m.gmane.org; Fri, 01 Sep 2017 22:45:30 +0200
Original-Received: by mail-pf0-f198.google.com with SMTP id r7sf2413107pfj.19
        for <gclcip-std-proposals@m.gmane.org>; Fri, 01 Sep 2017 13:45:37 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1504298736; cv=pass;
        d=google.com; s=arc-20160816;
        b=iWE7yNWtMUtP3dVZrBYueG+bJkNkcG3WcqKqC33+ty6mscOpemePxbdzz0QOWJJOyE
         aq6TMk66sMJ8jRbU6ZFIzQCVayCZ10LW+BObosLUuOZyMl1o+IQiJZKqdPG0ajNkFKqR
         vDl9joRBm0xEgm/k6/RwK0Y8BD6NdbldRCRxwB5jguCDyikfqZBOCC8GoeSRqQ2HH9WY
         VxrwecoN8QZU8jJqrn5mbBlN4Rn86mS2NHbdKgRz0rnGyuIpZY45QAFCejUBtUuLQfXW
         +Mzpyk9dTsNaZGUQHLcdu2HdrUrb5F4jXpO3Tetsj5HNCV+yWFiQ54UurKWi4/0ViVVb
         RreQ==
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:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=wHvpd7M+ygKe5J4NFG3wUlKzFKvr+Ot5zak8Mi2ierA=;
        b=SXNj++GnR9LSAJ3fmBHGbVSPXhK9iL4F/TX6BSU7AZUBl8ivmxV3xeaArWUJYGXlBv
         QkUYvX8m5x0K73i3lyISd1yt1PKBApUAixGimz/Ta25VMenpR8dwBKAgkxAvhBUf9YYo
         u8OpCMpkFqJM5vTTLgD3zXevtOvYVKj7qJBMoLUVeDFV+Xz3F0iD6L/iNYzujniwoqtj
         EYT+7K1XKeS8ZFXe+TEF63ATwwGj/Ztgz2u0rMg5HOKdP88orvI4i5wq51IX7mjU4Out
         EuVcINwx28rrRCU4olkR+AAyVDl17/mZwucC1tH2iSDnd6yG4ocAWrpKEtFytbsrygxa
         temg==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=TypytRIr;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
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:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=wHvpd7M+ygKe5J4NFG3wUlKzFKvr+Ot5zak8Mi2ierA=;
        b=JnI9rXnmhgaAVXWmExQv+PYTqhbQQXhJ5iRoC6ALbK/m6K9QxeQv6XBfAHKzvdtGwf
         7S2G13FSYRm2//w+KMrRNn8g0oenCJriPdWa6ABvKC3HRTKDz1VKEBwgCMUjT9k7/doe
         nkFFiYmgELXbbqSITicugH41Eiy2R7zxh8g7J8twErcSO+OQo2uScZ0S2174vwfy6mTf
         zQjozFjprPoXLmbsIZCkoj/0TUa9q/CTe7C9MCtmNApy1OYkHUctIt3PFu8U+YiIjGat
         7w8vGLgCvt2FL00sneTxsv3g/Q3Z/jmYhtrh+k3aAkYXbw2lgOC34iueNupWAJLed44m
         2Zag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        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=wHvpd7M+ygKe5J4NFG3wUlKzFKvr+Ot5zak8Mi2ierA=;
        b=ilMu1kN+ovhU0525XmBiLYRDiOjclXNr4KC8zmcKDa+zlKndOOFTQt8yPflaRBVC/D
         kYKdr1nMPEWCbVzZRA9dfmeWdnurPwZ4lUDSWburafpIdkwRF6zuvtHR08Px3tfVtVAc
         QMezFESZo+VMWZVXIte8cvxMH0elDlWGeheZuk8dcxlWOVJNySDxFQDJKtmqEIJn/08k
         UOOAGBqaHDhvhqS+9lciqUX7Z4rYVScO0Y7pjTckSil2jD7mbISOnR4Zy1VrvM/rwZoa
         cMASDq4Wyrlvd4ORy6ItFrUSwrXysU4qy6J5winobIIqDqt1inMfUnkwZNsazkb3Fwxt
         V6RA==
X-Gm-Message-State: AHYfb5hoAQPFmCdFtr5jchH4rqNOE2ptL7+EJ9hdF5G0+TDWz/ycuBJg
	bYFLl0eMjgM+cIIL
X-Google-Smtp-Source: ADKCNb4fcZCwlX+fVqL92esObigMQugK4Rd6cj6y4EqnC2yvVJNhAgl0MY1+LZRlM+Cjm7FSYzpZAg==
X-Received: by 10.99.96.20 with SMTP id u20mr3153167pgb.150.1504298736686;
        Fri, 01 Sep 2017 13:45:36 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.201.194 with SMTP id z185ls2281658iof.6.gmail; Fri, 01 Sep
 2017 13:45:35 -0700 (PDT)
X-Received: by 10.31.115.202 with SMTP id o193mr1885712vkc.81.1504298735444;
        Fri, 01 Sep 2017 13:45:35 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1504298735; cv=none;
        d=google.com; s=arc-20160816;
        b=l/i4Yz80WVz1+TUiu4UZV+aVYTbQIwyZBqcfWOdSJOVHx6iR+lke8WrD6huuhxAYD3
         Vg8+WnnqObTsZeoFHBYqc1FpF2vXpM2gHyuW3KHoG5VEXu99S/h+6znySNzAEDWyuYqn
         LuzHB/aajjPy2nLxGkkvinjucrexTZUEXfVHRT2/k5zbCPZT0ge6jFfEZZ8WqxpZX6jN
         vFRwfoqypxAuXi0jvliI1xA4fCXT2bSK+lmpaX8IGSCyASOAlRRX7NGDEYtUtPyra82k
         hSfgsGn7HiseedqP2WTMywQtFtZnrmFYVsl8qF+GCtG6y+J9kEvpLGhEm9nK545p10Y1
         fKFA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=gW8MnpE1yycMLj9W7554VMpBhMXuV0u14ncEbajhNus=;
        b=nUF/YtXJXT97TS7S2jT0G01VcIePSgw966f3PK7WdX5BiJUrlvr0rin6Uyyv+Fnrbp
         tx+qLB/oiw1/Lbd245hhKXAs8KAT+nGczJc5jan8iy0sPG1UvPdL29XzrptSloVBrInj
         V5EX4b8+Y0mCarwwR0AgEri7H/OZxql3Km95n9LLYdwrXbQW/2kD2NIfzU5S1jlNT2Ld
         srTLy7PtWTSVqaTAFPupOinRJ51Mzw1yGraAAmJpM6JDqEgRGdA7suMga3rrXKKj0ijj
         5psqquWYAIIj6wFI7q9bRZ7PgG0doPUpxRz3JXSuMWcsw/vy5+ZTXJEi+xEGwnbFmZFU
         K7yQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=TypytRIr;
       spf=pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id l125sor698390vkh.27.2017.09.01.13.45.35
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 01 Sep 2017 13:45:35 -0700 (PDT)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.31.109.3 with SMTP id i3mr1983994vkc.114.1504298734965; Fri,
 01 Sep 2017 13:45:34 -0700 (PDT)
Original-Received: by 10.103.103.135 with HTTP; Fri, 1 Sep 2017 13:45:34 -0700 (PDT)
In-Reply-To: <CAGg_6+P1nWqSwTQWAWt8jJ6YEM7zKjDp1xzK56OT+iAc5ayzhQ@mail.gmail.com>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=TypytRIr;       spf=pass
 (google.com: domain of ville.voutilainen@gmail.com designates 209.85.220.41
 as permitted sender) smtp.mailfrom=ville.voutilainen@gmail.com;
       dmarc=pass (p=NONE sp=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:34257
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/34257>

On 1 September 2017 at 23:42, Nevin Liber <nevin@eviloverlord.com> wrote:
>> I have a follow-up question: did you consider the alternative where
>> the caller of the new constructor must pass an rvalue reference
>> to a std::string, in which case there would be most likely a much
>> smaller allocation, as in the case of a dynamically
>> allocated string that doesn't fit into SSO, there would be none, and
>> in the SSO case, a very small allocation that
>> is not dynamic?
>
>
> I don't think an rvalue reference to a std::string helps.  As was recently
> pointed out to me [exception]p2: Each standard library class T that derives
> from class exception shall have a publicly accessible copy constructor and a
> publicly accessible copy assignment operator that do not exit with an
> exception.
>
> std::string doesn't meet that requirement (and cannot, since we effectively
> no long allow a reference counted std::string implementation as of C++11),
> so bad_alloc cannot hold one.

Just make the copy operation terminate() if it fails to copy a string.
;) Flippant ideas
aside, this is a fairly important thing to consider in the scope of
this proposal, good
catc.. err, finding.

-- 
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/CAFk2RUYH3MitS%2B1HXMJkBsRPAvyV4VaX%2BnxiNj00ozF%3DcbfwRQ%40mail.gmail.com.

.
