220 18817 <CA+jCFLu=mau8v+XJxAg7eUwk=uLXdXLhhGTV9KsOxT=CjtzqfQ@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Christopher Jefferson <chris@bubblescope.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Compressing std::optional
Date: Fri, 26 Jun 2015 21:20:00 +0100
Lines: 35
Approved: news@gmane.org
Message-ID: <CA+jCFLu=mau8v+XJxAg7eUwk=uLXdXLhhGTV9KsOxT=CjtzqfQ@mail.gmail.com>
References: <4359ebfb-5e20-42c1-84a0-16ef6201db33@isocpp.org>
	<33303ec4-d4c3-4080-a7bb-346496e38114@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1435350013 23957 80.91.229.3 (26 Jun 2015 20:20:13 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 26 Jun 2015 20:20:13 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCF5NPH6QMFRB4XHW2WAKGQEXLN7KFI@isocpp.org Fri Jun 26 22:20:09 2015
Return-path: <std-proposals+bncBCF5NPH6QMFRB4XHW2WAKGQEXLN7KFI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f199.google.com ([209.85.212.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCF5NPH6QMFRB4XHW2WAKGQEXLN7KFI@isocpp.org>)
	id 1Z8a6a-0007NE-EL
	for gclcip-std-proposals@m.gmane.org; Fri, 26 Jun 2015 22:20:09 +0200
Original-Received: by wicnd19 with SMTP id nd19sf7890868wic.0
        for <gclcip-std-proposals@m.gmane.org>; Fri, 26 Jun 2015 13:20:03 -0700 (PDT)
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:date
         :message-id:subject:from:to:content-type:content-transfer-encoding
         :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=SPsp5tkmTN1tsJFLqg+TjOGpZeT1mjLYSEQqeMAkTZ0=;
        b=VOFPoOkwi/4bJ5lS25HDS4uTvfkuI58cP9IKtZVMdJTyRDQf+dsTVke3db8PrJmPxX
         l0laLbjpz1kRT4WoEjZe5bSLXxqsxEpSsRSjtLjvBiSRrLrbi5zGJpZSxfu+1qPKXFau
         JcfExjvbvpotdTdxGUVsNtrkoxwXMGeFKuE7C3A2/gHpEMaT27F6cY10dntq0sM20YhE
         xo4lnDvM4ZgT+JM8JqZqXVWkaSSoLxYYR3NOHuDuGSZ4quRiyB5o36xXrq6xn0eaD0kM
         G8io36FsTSjvudGucHWXZ1a9cbbKdaLVfSiXSAjGkCqbXD/bjqJThyMlK30pqpcn45de 
X-Gm-Message-State: ALoCoQmKNSnXepFKPeheVJd4oHx5Xz6usQrgDu94xCci/EENb25Orl7iuI4xcdA1m+jbsg+wH0dr
X-Received: by 10.152.88.70 with SMTP id be6mr2228010lab.9.1435350002978;
        Fri, 26 Jun 2015 13:20:02 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.4.1 with SMTP id g1ls521983lag.46.gmail; Fri, 26 Jun 2015
 13:20:01 -0700 (PDT)
X-Received: by 10.112.136.166 with SMTP id qb6mr3246496lbb.54.1435350001574;
        Fri, 26 Jun 2015 13:20:01 -0700 (PDT)
Original-Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42])
        by mx.google.com with ESMTPS id qo3si28281723lbb.122.2015.06.26.13.20.00
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 26 Jun 2015 13:20:00 -0700 (PDT)
Received-SPF: neutral (google.com: 209.85.215.42 is neither permitted nor denied by best guess record for domain of chris@bubblescope.net) client-ip=209.85.215.42;
Original-Received: by laar3 with SMTP id r3so8166085laa.0
        for <std-proposals@isocpp.org>; Fri, 26 Jun 2015 13:20:00 -0700 (PDT)
X-Received: by 10.152.6.166 with SMTP id c6mr3202827laa.62.1435350000567; Fri,
 26 Jun 2015 13:20:00 -0700 (PDT)
Original-Received: by 10.112.13.198 with HTTP; Fri, 26 Jun 2015 13:20:00 -0700 (PDT)
In-Reply-To: <33303ec4-d4c3-4080-a7bb-346496e38114@isocpp.org>
X-Original-Sender: chris@bubblescope.net
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 209.85.215.42 is neither permitted nor denied by best guess
 record for domain of chris@bubblescope.net) smtp.mail=chris@bubblescope.net
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:18817
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/18817>

On 26 June 2015 at 21:14, Andrzej Krzemie=C5=84ski <akrzemi1@gmail.com> wro=
te:

> The main criticism of this proposal was that it affects the optional's
> semantics:
>
> optional<double, nan_optional_storage> od {2.3};
> double d =3D compute_val();
>
> assert (od); // contains value
> *od =3D d;
> assert (od); // contains value?
>
> The second assertion always holds in normal optional. In the "optimized"
> version, it depends on the value of d.

I have used an 'optimised optional' of the type suggested in this
paper for years. At some point I decided to forbid this case -- a user
should be completely unable to tell any space optimisation is being
performed (except the object is smaller obviously). That does mean you
can't compress types such as int or double.

Chris

--=20

---=20
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 e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.
