220 18820 <CA+jCFLtsxoyM2s5+hnkwGGYpBNyRAtbxfLROaNTTG67oQ-S5PQ@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:49:24 +0100
Lines: 56
Approved: news@gmane.org
Message-ID: <CA+jCFLtsxoyM2s5+hnkwGGYpBNyRAtbxfLROaNTTG67oQ-S5PQ@mail.gmail.com>
References: <4359ebfb-5e20-42c1-84a0-16ef6201db33@isocpp.org>
	<33303ec4-d4c3-4080-a7bb-346496e38114@isocpp.org>
	<CA+jCFLu=mau8v+XJxAg7eUwk=uLXdXLhhGTV9KsOxT=CjtzqfQ@mail.gmail.com>
	<CAOHCbiv9J9S=U02d=P3jrDN8WD1dLpoWsfz3Jmot7LV7JHQAVw@mail.gmail.com>
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 1435351770 19753 80.91.229.3 (26 Jun 2015 20:49:30 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 26 Jun 2015 20:49:30 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCF5NPH6QMFRBVPVW2WAKGQEHJIG3GA@isocpp.org Fri Jun 26 22:49:30 2015
Return-path: <std-proposals+bncBCF5NPH6QMFRBVPVW2WAKGQEHJIG3GA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f197.google.com ([209.85.212.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCF5NPH6QMFRBVPVW2WAKGQEHJIG3GA@isocpp.org>)
	id 1Z8aYw-0004pi-MT
	for gclcip-std-proposals@m.gmane.org; Fri, 26 Jun 2015 22:49:26 +0200
Original-Received: by wiws10 with SMTP id s10sf8093886wiw.2
        for <gclcip-std-proposals@m.gmane.org>; Fri, 26 Jun 2015 13:49:26 -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=7CAJ9ibolANtHoFK0rY5MvhpII1sFdJWY1lECSlUqMw=;
        b=T4AMaDARafzoaBdu+S9TWMPbrgE4QCmwRECM858Zfcmye4umhLO56s61AoKNVKUbWP
         CzdAJQN64iz48KBbPIHFFzHhDzz1c8b5RUukUpSMzH87AXxrOJK5eDKBDaN/vQ04+M06
         dsyAvgwkjlJRKF3Gm/309rALsaMfWAU8a2nOasYzGsNbkbEXCwjDNCrPFMVr1f8kDu8s
         Zk9Gx+oCaq4feL9vnv8txktMYt57F4NNCw0SlDawadhsy/H1WluVtGmw9b2PK1tD6t/r
         Q/767Zich61t7DkWuFo7Yy1ocSxa8DUswUUikXBs6gYQ+rcKcr9djdBS2cCwibPPyd1H 
X-Gm-Message-State: ALoCoQlbtoMlvqaeKHjLTI1vuG9aVcmuPstEKuYApIRHeEbWxcGf+a9YKkcomtkX9stswpMy8rG7
X-Received: by 10.112.40.45 with SMTP id u13mr2364704lbk.0.1435351766238;
        Fri, 26 Jun 2015 13:49:26 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.29.36 with SMTP id g4ls615994lah.33.gmail; Fri, 26 Jun
 2015 13:49:24 -0700 (PDT)
X-Received: by 10.112.125.65 with SMTP id mo1mr3377003lbb.0.1435351764688;
        Fri, 26 Jun 2015 13:49:24 -0700 (PDT)
Original-Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182])
        by mx.google.com with ESMTPS id pt2si28354474lbb.46.2015.06.26.13.49.24
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 26 Jun 2015 13:49:24 -0700 (PDT)
Received-SPF: neutral (google.com: 209.85.217.182 is neither permitted nor denied by best guess record for domain of chris@bubblescope.net) client-ip=209.85.217.182;
Original-Received: by lbbwc1 with SMTP id wc1so71301760lbb.2
        for <std-proposals@isocpp.org>; Fri, 26 Jun 2015 13:49:24 -0700 (PDT)
X-Received: by 10.152.246.37 with SMTP id xt5mr3232033lac.83.1435351764193;
 Fri, 26 Jun 2015 13:49:24 -0700 (PDT)
Original-Received: by 10.112.13.198 with HTTP; Fri, 26 Jun 2015 13:49:24 -0700 (PDT)
In-Reply-To: <CAOHCbiv9J9S=U02d=P3jrDN8WD1dLpoWsfz3Jmot7LV7JHQAVw@mail.gmail.com>
X-Original-Sender: chris@bubblescope.net
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 209.85.217.182 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:18820
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/18820>

On 26 June 2015 at 21:22, Tony V E <tvaneerd@gmail.com> wrote:
>
>
> On Fri, Jun 26, 2015 at 4:20 PM, Christopher Jefferson
> <chris@bubblescope.net> wrote:
>>
>> On 26 June 2015 at 21:14, Andrzej Krzemie=C5=84ski <akrzemi1@gmail.com> =
wrote:
>>
>> > 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 "optimize=
d"
>> > 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
>
>
> In what cases *can* you compress then?

Any type where at least one bit pattern isn't used in a valid object.

Personally, I mainly compress containers (std::vector, std::list,
std::map, etc.).

I know on any system I care about malloc is never going to return
(void*)1, so any object which contains a pointer can assign that value
to a pointer to represent disengaged.

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/.

.
