220 2355 <CAHOE3yeF6KBBz7a1uw58oA3Shh_w0HFGiLtUGEd4ntJAKBauew@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Daniel James <dnljms@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: optional<T>, one more value or two states
Date: Sun, 27 Jan 2013 20:27:56 +0000
Lines: 42
Approved: news@gmane.org
Message-ID: <CAHOE3yeF6KBBz7a1uw58oA3Shh_w0HFGiLtUGEd4ntJAKBauew@mail.gmail.com>
References: <CAGsORuC1ADLXgS9AZZiTo=knmhT-+9Yj+82v+b8Nq_WJpb1fOg@mail.gmail.com>
	<CAFk2RUZyZA0LLUNuVNcnibv+qBF69jMytWQL3tkp-Kp21oEU+A@mail.gmail.com>
	<CAGsORuB-Qkx-LaXj2jO4yLrwN524kiJONSg7oczkQZHYaJ6ASg@mail.gmail.com>
	<d360a952-28ae-4d57-bb20-96fd08725a0b@isocpp.org>
	<CAPXezF_JggyMaXjGS9r1EAGVu1NhQBEyGEXB8tKmVqgFfjoCeg@mail.gmail.com>
	<CALJmx62zJd_tZ=XYL7TaSkRN6432SObwH9YS87eLX-h_pMuFYQ@mail.gmail.com>
	<CAOHCbivAK0ypmMhrhJ3zKpF8BHu3h_rUNzeao-HnibJkC-qqGw@mail.gmail.com>
	<ef15483d-5665-4da3-9b79-aefd3c725e1b@isocpp.org>
	<CAOHCbithEUfm+w_06V71=hpkqGUJvqiyDFqD7fesfgLy4uUieg@mail.gmail.com>
	<2c2b9360-8e5e-422d-9b85-124bd947b004@isocpp.org>
	<123b9f65-12fd-4285-bb6c-cfee383d4552@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1359318478 629 80.91.229.3 (27 Jan 2013 20:27:58 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 27 Jan 2013 20:27:58 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCGPB3VVUAGBBTM3S2EAKGQEKF3ENVI@isocpp.org Sun Jan 27 21:28:16 2013
Return-path: <std-proposals+bncBCGPB3VVUAGBBTM3S2EAKGQEKF3ENVI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ee0-f70.google.com ([74.125.83.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCGPB3VVUAGBBTM3S2EAKGQEKF3ENVI@isocpp.org>)
	id 1TzYpr-0002pX-BJ
	for gclcip-std-proposals@m.gmane.org; Sun, 27 Jan 2013 21:28:15 +0100
Original-Received: by mail-ee0-f70.google.com with SMTP id l10sf2308655eei.5
        for <gclcip-std-proposals@m.gmane.org>; Sun, 27 Jan 2013 12:27:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:x-received:received-spf
         :mime-version:x-received:in-reply-to:references:date:message-id
         :subject:from:to:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-google-group-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=wQv472lY+TgwJLd3SjqoV7LI7PKSd49TusvvsNz2ZxA=;
        b=CQerCyolsQJ1IClDE2a/MZBssN+1jUWqWbpbLLqbz20Sh473Ec0G8GAhRAtJseSFFy
         mSitLgUX0YUAlN53El2cvLmzGxQmLqL2w5j7V0Ds44UOPBVbviG/nJLNuIcu7OLXxAJe
         jmWRX174DhcxFAUFFRW0F1Tpbdz2YLsIlhY3w3EoSHcwHlHMWjIbUfcu0986O3pZYSZC
         3Q8JaI1PiordQWinW6UT5MUAsIsQmn4/wY1TzHlnqkfSfb0CqYlCN92Bb8mF6cnl7DwB
         6yJ6cY8qTeWANb6Ko8Hwn+k20GXwh5/ZmVfSmhmQ8wAUbk4ff 
X-Received: by 10.180.8.4 with SMTP id n4mr1116819wia.0.1359318477507;
        Sun, 27 Jan 2013 12:27:57 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.180.8.193 with SMTP id t1ls742858wia.14.canary; Sun, 27 Jan
 2013 12:27:57 -0800 (PST)
X-Received: by 10.194.76.237 with SMTP id n13mr17697391wjw.57.1359318477100;
        Sun, 27 Jan 2013 12:27:57 -0800 (PST)
X-Received: by 10.194.76.237 with SMTP id n13mr17697390wjw.57.1359318477083;
        Sun, 27 Jan 2013 12:27:57 -0800 (PST)
Original-Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e])
        by mx.google.com with ESMTPS id y6si482133wiv.90.2013.01.27.12.27.57
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sun, 27 Jan 2013 12:27:57 -0800 (PST)
Received-SPF: pass (google.com: domain of dnljms@gmail.com designates 2a00:1450:400c:c03::22e as permitted sender) client-ip=2a00:1450:400c:c03::22e;
Original-Received: by mail-we0-f174.google.com with SMTP id r6so1097476wey.19
        for <std-proposals@isocpp.org>; Sun, 27 Jan 2013 12:27:57 -0800 (PST)
X-Received: by 10.180.92.36 with SMTP id cj4mr6262059wib.23.1359318477013;
 Sun, 27 Jan 2013 12:27:57 -0800 (PST)
Original-Received: by 10.194.46.7 with HTTP; Sun, 27 Jan 2013 12:27:56 -0800 (PST)
In-Reply-To: <123b9f65-12fd-4285-bb6c-cfee383d4552@isocpp.org>
X-Original-Sender: dnljms@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of dnljms@gmail.com designates 2a00:1450:400c:c03::22e as permitted
 sender) smtp.mail=dnljms@gmail.com;       dkim=pass header.i=@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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post?hl=en>,
 <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?hl=en&topic=25838>,
 <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe?hl=en>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:2355
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/2355>

On 26 January 2013 18:01, Olaf van der Spek <olafvdspek@gmail.com> wrote:
> Op vrijdag 25 januari 2013 21:20:36 UTC+1 schreef Nicol Bolas het volgende:
>
>> And can be NULL.
>>
>> No, it can be empty, not NULL. `optional` is a container.
>
>
> Is it?
> The C++ container concept has a lot of requirements that optional doesn't
> meet.

But it could easily be changed to meet them. 'Optional' is a container
(in the wider sense) with a maximum of 1 element. It is not in any
sense a pointer. In fact, std::optional probably should meet the basic
container requirements, as it would allow it to be used with generic
functions.

>  I think using operator* is natural.

But it does currently imply certain semantics. The current situation
is that if you write:

    auto x = y;
    *x = 2;

Then for any standard type this is equivalent to assigning '2' to
whatever y points to. By using 'operator*' in std::optional, the
semantics of 'operator*' will be changed. That shouldn't be done
lightly, especially since with templates and 'auto' a type is defined
by the functions and operators that it supports..

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



.
