220 6152 <52275A58.502@wanadoo.fr> article
Path: news.gmane.org!not-for-mail
From: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: std::degenerate<> class template :
 primitive/enum types with a special "undefined" value
Date: Wed, 04 Sep 2013 18:05:44 +0200
Lines: 157
Approved: news@gmane.org
Message-ID: <52275A58.502@wanadoo.fr>
References: <18ab4801-260a-4228-8a7b-a71248b624e2@isocpp.org> <db1afcb0-7243-48f9-8b7b-fb0e9dbe99e6@isocpp.org> <77a1bdf8-1e0d-4294-b528-d08ba5403c98@isocpp.org> <023111c2-c983-407d-918f-39be42aa2949@isocpp.org> <cb3ab0e2-bea1-4741-997a-c3b3102cef7d@isocpp.org> <88ef15f1-6942-476e-b26c-6873ef6e6f0b@isocpp.org> <01900060-3aac-4645-a4a8-93b4e8760e42@isocpp.org> <5e63fe81-ab33-4bbb-ab4c-305f8b90140a@isocpp.org> <51a05a5a-ad56-4ffa-81d8-759953a93766@isocpp.org> <787f2f45-1fbc-4ce5-90fc-d8f0d8c2b8f4@isocpp.org> <6da8e8d3-7c26-4841-bc3f-40dd0715e92b@isocpp.org> <5226D6A4.4040707@wanadoo.fr> <90eb2850-ff75-47b6-979d-ac7400146b0b@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="------------070808090102030307020204"
X-Trace: ger.gmane.org 1378310751 4367 80.91.229.3 (4 Sep 2013 16:05:51 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 4 Sep 2013 16:05:51 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDH67CONY4PBBYFUTWIQKGQE3V5FJJI@isocpp.org Wed Sep 04 18:05:53 2013
Return-path: <std-proposals+bncBDH67CONY4PBBYFUTWIQKGQE3V5FJJI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f200.google.com ([209.85.217.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDH67CONY4PBBYFUTWIQKGQE3V5FJJI@isocpp.org>)
	id 1VHFab-0002KQ-DN
	for gclcip-std-proposals@m.gmane.org; Wed, 04 Sep 2013 18:05:53 +0200
Original-Received: by mail-lb0-f200.google.com with SMTP id y6sf518523lbh.7
        for <gclcip-std-proposals@m.gmane.org>; Wed, 04 Sep 2013 09:05:53 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=message-id:date:from:user-agent:mime-version:to:subject:references
         :in-reply-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:content-type;
        bh=rkVkJX5/uc9pSKl+PlZ9uNhtgEtIFtWmKcHdz7nVcq4=;
        b=IsS0qr4dvwkAB+fQ8PY61GqYZl70NYY+SCPh8DTDV77iFBEdNvPSwacbdr2itIcFl+
         XAmuedDqfzSw5nUmfnCn6dltNYn32acS07kAB/Q8yMninryjW38Wkme2ByJY7OqfXy5h
         PgFhoqF2DG6ZSLwcJ94EZ1rA1fACwREP3DKIpCNYd5gVRnaKsi72sRiB+vkzR+8Qv+qr
         eOibzOZBn4/F3dipXsoiTVLjm7RhB6B3B9qPFCu+20DpA8qqbDMFiKszwiNzdYbfhsge
         t8MgmeUXHTkbonhVB81swHiDENlmUteiBgpmaTfZQPSm3XZOZ21C5rZy/8J9TvhDfTVj
         xMlA==
X-Received: by 10.112.141.232 with SMTP id rr8mr662010lbb.11.1378310752853;
        Wed, 04 Sep 2013 09:05:52 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.2.39 with SMTP id 7ls20412lar.11.gmail; Wed, 04 Sep 2013
 09:05:51 -0700 (PDT)
X-Received: by 10.152.116.82 with SMTP id ju18mr674897lab.54.1378310751882;
        Wed, 04 Sep 2013 09:05:51 -0700 (PDT)
Original-Received: from smtp.smtpout.orange.fr (smtp10.smtpout.orange.fr. [80.12.242.132])
        by mx.google.com with ESMTP id 6si10917280lay.88.1969.12.31.16.00.00;
        Wed, 04 Sep 2013 09:05:51 -0700 (PDT)
Received-SPF: neutral (google.com: 80.12.242.132 is neither permitted nor denied by best guess record for domain of vicente.botet@wanadoo.fr) client-ip=80.12.242.132;
Original-Received: from pc3.home ([2.10.128.70])
	by mwinf5d20 with ME
	id M45n1m0031XFuXW0345pJW; Wed, 04 Sep 2013 18:05:51 +0200
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
In-Reply-To: <90eb2850-ff75-47b6-979d-ac7400146b0b@isocpp.org>
X-Original-Sender: vicente.botet@wanadoo.fr
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 80.12.242.132 is neither permitted nor denied by best guess
 record for domain of vicente.botet@wanadoo.fr) smtp.mail=vicente.botet@wanadoo.fr
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>, <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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:6152
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/6152>

This is a multi-part message in MIME format.
--------------070808090102030307020204
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 04/09/13 14:37, Nicol Bolas a =E9crit :
>
>
> On Tuesday, September 3, 2013 11:43:48 PM UTC-7, Vicente J. Botet=20
> Escriba wrote:
>
>     Le 04/09/13 06:48, the.ultim...@gmail.com <javascript:> a =E9crit :
>
>     What do you think about defining the degenerate class empty
>
>     template <typename T, typename DegenerateValue>
>     struct degenerate
>     {
>       typedef T value_type;
>       typedef DegenerateValue degenerate_value_type;
>     };
>
>     and use it to make  specialization of optional
>
>     template <typename T, typename DegenerateValue>
>     struct optional <degenerate<T,DegenerateValue>>
>     {
>      // include here the degenerated specialization
>     }
>
>     In this way optional doesn't changes its interface (preserv only
>     one template parameter), and we are able to have
>
>     optional<T>
>
>     and
>
>     optional<degenerate<Player, integral_constant<Player, Player(-1)>>
>
>
> That seems way too much like a kludge. Sure, you can `template using=3D`=
=20
> your way around it, but we shouldn't /have/ to do things like that=20
> just to make something useable. What is so wrong with just making=20
> `optional<T, Tester>` as a variation? We do something similar for=20
> `unique_ptr`.
>
There is nothing wrong. Just this must be done quickly as once in C++14=20
it would be not so easy to change the std::optional interface. My=20
suggestion could be adopted just after c++14 is released.

Vicente

--=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/.

--------------070808090102030307020204
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dwindows-1252"
      http-equiv=3D"Content-Type">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">Le 04/09/13 14:37, Nicol Bolas a
      =E9crit=A0:<br>
    </div>
    <blockquote
      cite=3D"mid:90eb2850-ff75-47b6-979d-ac7400146b0b@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr"><br>
        <br>
        On Tuesday, September 3, 2013 11:43:48 PM UTC-7, Vicente J.
        Botet Escriba wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
          0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
          <div bgcolor=3D"#FFFFFF" text=3D"#000000">
            <div>Le 04/09/13 06:48, <a moz-do-not-send=3D"true"
                href=3D"javascript:" target=3D"_blank"
                gdf-obfuscated-mailto=3D"BxWDbIdhIawJ">the.ultim...@gmail.c=
om</a>
              a =E9crit=A0:<br>
            </div>
            <br>
            What do you think about defining the degenerate class empty<br>
            <br>
            template &lt;typename T, typename DegenerateValue&gt;<br>
            struct degenerate<br>
            {<br>
            =A0 typedef T value_type;<br>
            =A0 typedef DegenerateValue degenerate_value_type;<br>
            };<br>
            <br>
            and use it to make=A0 specialization of optional<br>
            <br>
            template &lt;typename T, typename DegenerateValue&gt;<br>
            struct optional &lt;degenerate&lt;T,DegenerateValue&gt;<wbr>&gt=
;<br>
            {<br>
            =A0// include here the degenerated specialization<br>
            }<br>
            <br>
            In this way optional doesn't changes its interface (preserv
            only one template parameter), and we are able to have <br>
            <br>
            optional&lt;T&gt;<br>
            <br>
            and<br>
            <br>
            optional&lt;degenerate&lt;Player,
            integral_constant&lt;Player, Player(-1)&gt;&gt;<br>
          </div>
        </blockquote>
        <div><br>
          That seems way too much like a kludge. Sure, you can `template
          using=3D` your way around it, but we shouldn't <i>have</i> to
          do things like that just to make something useable. What is so
          wrong with just making `optional&lt;T, Tester&gt;` as a
          variation? We do something similar for `unique_ptr`.<br>
          <br>
        </div>
      </div>
    </blockquote>
    There is nothing wrong. Just this must be done quickly as once in
    C++14 it would be not so easy to change the std::optional interface.
    My suggestion could be adopted just after c++14 is released.<br>
    <br>
    Vicente
  </body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--------------070808090102030307020204--

.
