220 2124 <CAFk2RUZyZA0LLUNuVNcnibv+qBF69jMytWQL3tkp-Kp21oEU+A@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: optional<T>, one more value or two states
Date: Thu, 24 Jan 2013 15:38:21 +0200
Lines: 27
Approved: news@gmane.org
Message-ID: <CAFk2RUZyZA0LLUNuVNcnibv+qBF69jMytWQL3tkp-Kp21oEU+A@mail.gmail.com>
References: <CAGsORuC1ADLXgS9AZZiTo=knmhT-+9Yj+82v+b8Nq_WJpb1fOg@mail.gmail.com>
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 1359034705 22660 80.91.229.3 (24 Jan 2013 13:38:25 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 24 Jan 2013 13:38:25 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC5JHI7A7ALRBTPSQSEAKGQEECBL25Q@isocpp.org Thu Jan 24 14:38:45 2013
Return-path: <std-proposals+bncBC5JHI7A7ALRBTPSQSEAKGQEECBL25Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ob0-f199.google.com ([209.85.214.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRBTPSQSEAKGQEECBL25Q@isocpp.org>)
	id 1TyN0q-00069X-2S
	for gclcip-std-proposals@m.gmane.org; Thu, 24 Jan 2013 14:38:40 +0100
Original-Received: by mail-ob0-f199.google.com with SMTP id wc18sf4995556obb.10
        for <gclcip-std-proposals@m.gmane.org>; Thu, 24 Jan 2013 05:38:22 -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=b7HKT5QFRdWblxgcu+Ku3dysmCRAAw/hM+n1PgArYk4=;
        b=DTBWTcKABQBC3F1AZ/pfHd0QgHWL5hoUUIUXCEAyXN8ja7rxnEt+1Np5c8iXN2W7dw
         KWoAkGQLOyY0saF0/jXe/Cq0WcSa+z5HdwIMLSaHKLnJjN73BYJg8R6JFFeTaXPSgNNX
         DjQQmIiSIhsY6niL2ErgLaOflKmBB9XGmnx0tbo5Ckug2T2R8nRDaKgyxToaj/GqJxYN
         AEMmRr3N9rJ6vtuPlVGCh/x0Hb4m7D2eSMjCZe+dtBtWQNtaxXqsk/BKtPcOYGWSsmmp
         WqPdWExqMuLiz2awqi0+r0ylAGvHyiS2Z17NQFjoJE+Wddt0x 
X-Received: by 10.182.167.35 with SMTP id zl3mr576270obb.5.1359034702040;
        Thu, 24 Jan 2013 05:38:22 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.52.40 with SMTP id q8ls103024obo.17.gmail; Thu, 24 Jan
 2013 05:38:21 -0800 (PST)
X-Received: by 10.60.19.133 with SMTP id f5mr1466180oee.105.1359034701618;
        Thu, 24 Jan 2013 05:38:21 -0800 (PST)
X-Received: by 10.60.19.133 with SMTP id f5mr1466178oee.105.1359034701600;
        Thu, 24 Jan 2013 05:38:21 -0800 (PST)
Original-Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180])
        by mx.google.com with ESMTPS id aa2si9125950obc.57.2013.01.24.05.38.21
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Thu, 24 Jan 2013 05:38:21 -0800 (PST)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 209.85.214.180 as permitted sender) client-ip=209.85.214.180;
Original-Received: by mail-ob0-f180.google.com with SMTP id wd20so9325218obb.25
        for <std-proposals@isocpp.org>; Thu, 24 Jan 2013 05:38:21 -0800 (PST)
X-Received: by 10.60.24.97 with SMTP id t1mr1485051oef.6.1359034701494; Thu,
 24 Jan 2013 05:38:21 -0800 (PST)
Original-Received: by 10.76.108.82 with HTTP; Thu, 24 Jan 2013 05:38:21 -0800 (PST)
In-Reply-To: <CAGsORuC1ADLXgS9AZZiTo=knmhT-+9Yj+82v+b8Nq_WJpb1fOg@mail.gmail.com>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of ville.voutilainen@gmail.com designates 209.85.214.180 as permitted
 sender) smtp.mail=ville.voutilainen@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:2124
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/2124>

On 24 January 2013 15:25, Zhihao Yuan <lichray@gmail.com> wrote:
> My own point of view:
> If optional<T> is an extended type T, then:
> optional<int> x = 0;  // implicitly convertible
> optional<int>(3) == 3;  // since T is a sub-range of optional<T>
> optional<int>(nullopt) == optional<int>(nullopt);  // same extended value
> If optional<T> is a T with two states, then:
> optional<int> x(0);  // explicitly convertible
> optional<int>(3) == make_optional(3);  // since T is not "T with states"
> optional<int>(nullopt) != optional<int>(nullopt);  // meaningless states
> Comments wanted.

I initially thought implicit conversions from T to optional<T> are a bad idea.
I have since cured that problem in my head, there's no 'danger' involved in
it. boost::optional has such implicit conversions, and I see no reason
to do it differently for std::optional.

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To post to this group, send email to std-proposals@isocpp.org.
To unsubscribe from this group, send email to std-proposals+unsubscribe@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



.
