220 22277 <a0cb8cc4-b7e2-46e7-a0ae-f9cf931b20e9@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Morwenn <morwenn29@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Thoughts about P0100R0
Date: Thu, 5 Nov 2015 14:17:46 -0800 (PST)
Lines: 91
Approved: news@gmane.org
Message-ID: <a0cb8cc4-b7e2-46e7-a0ae-f9cf931b20e9@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_993_370600272.1446761866902"
X-Trace: ger.gmane.org 1446761871 29971 80.91.229.3 (5 Nov 2015 22:17:51 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 5 Nov 2015 22:17:51 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC2ZP4V74IFBBDFL56YQKGQEZWEN77Q@isocpp.org Thu Nov 05 23:17:50 2015
Return-path: <std-proposals+bncBC2ZP4V74IFBBDFL56YQKGQEZWEN77Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ig0-f198.google.com ([209.85.213.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC2ZP4V74IFBBDFL56YQKGQEZWEN77Q@isocpp.org>)
	id 1ZuSqr-0006oS-9t
	for gclcip-std-proposals@m.gmane.org; Thu, 05 Nov 2015 23:17:49 +0100
Original-Received: by igcui1 with SMTP id ui1sf61593617igc.2
        for <gclcip-std-proposals@m.gmane.org>; Thu, 05 Nov 2015 14:17:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:subject:mime-version:content-type
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=x7urZHTcR/OIVyfr2Uh0I3f/Iv/kY5UkmISwiU+Fv8Y=;
        b=EBuzt/pT+9l4wWVHxUVvR0FrnjFMpjCdVBz/VmQaS3D0Q4TNB5dtU5GWFFZSGBAAVg
         I9xs5hVUY8KiLNvIrJBQeAIkotn8hwZB5Tx8qYH/PGIavx+mbVc/iYlLy+DHJjVW1+LE
         0JAIZHsp5sqNEHW5+sRdo8drOWQyEWIRNG0k1HcfWYjH+9H1nQk3TV+10qdB/x29vKOm
         uj+r+k8Pdh1e3O2QZIGkS/2s4WtQW+m21QnAt/tBSFlGw6g2Ov7TcMVl57kfiVzgmV5T
         UxNC0As/n2KPMX0jm4iGwdS2Yc7Ce1dBPEszdv0Mjne0bMPpIJJ2guYKVHsLakNy5rxu
         WdYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:subject:mime-version
         :content-type:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=x7urZHTcR/OIVyfr2Uh0I3f/Iv/kY5UkmISwiU+Fv8Y=;
        b=RyQdHnYNPmPlLvZ8902LYWNoI7ggXhWqgwpmniePWdoqN58Y6ID1n3oHU21iOXeBgp
         N/tkifMB7XFlp20ndJcrKeEZiAQJM+t4TcQSBrurqEi4lTwUYciyedXY9LvH7WEOQHmx
         xYEVSA9jndk+B4Ag1xra4Eufgj78+zhUXks2L1iWeQjGvFajXOe0rHh4cJRlYHt7b33C
         GReZgdSIE+MybvniXdnoSfEBH3icAuZ47SXRPTIxFriYsQfSAK/2/h8FPOwPBKxzMWQ/
         o1HEqgTkDIMPdyh+UhwWl+WHVGFjx8XeLFykFvTApElhnsSstnyIkD4KAzCy0XR6Ed/k
         Z0Kg==
X-Gm-Message-State: ALoCoQl7qrSbH6vFevGiAitsTNs5QzZuYl0godJFqw+WrHKQb79FPKJF4aNPeevSj2dD9BrwVTQn
X-Received: by 10.182.226.195 with SMTP id ru3mr8322727obc.12.1446761868555;
        Thu, 05 Nov 2015 14:17:48 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.61.135 with SMTP id p7ls285905igr.14.canary; Thu, 05 Nov
 2015 14:17:47 -0800 (PST)
X-Received: by 10.50.3.41 with SMTP id 9mr158368igz.7.1446761867946;
        Thu, 05 Nov 2015 14:17:47 -0800 (PST)
X-Original-Sender: morwenn29@gmail.com
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:22277
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/22277>

------=_Part_993_370600272.1446761866902
Content-Type: multipart/alternative; 
	boundary="----=_Part_994_2086772886.1446761866902"

------=_Part_994_2086772886.1446761866902
Content-Type: text/plain; charset=UTF-8

Among other things, P0100R0 proposes to add the following strongly-typed 
enumerations to the standard library:

enum class partial_ordering { less, unordered, greater };
enum class weak_ordering { less, equivalent, greater };
enum class total_ordering { less, equal, greater };


I think that the idea is great but that these enumerations would benefit 
from an explicit conversion to int where the three values would be equal to 
-1, 0 and 1.
It would allow to have strong typing by default but the ability to 
interface with old APIs that rely on the values -1, 0 and 1. While some of 
this old APIs only check the values, other ones do some arithmetic with the 
returned values (I have seen multiplications, but also additions in the 
wild) and changing every API would be a bit bothersome.

Basically, I propose to change the enumerations as follows:

enum class partial_ordering: int { less = -1, unordered = 0, greater = 1 };
enum class weak_ordering: int { less = -1, equivalent = 0, greater = 1 };
enum class total_ordering: int { less = -1, equal = 0, greater = 1 };


Any opinion about that?

Morwenn.

-- 

--- 
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/.

------=_Part_994_2086772886.1446761866902
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Among other things, P0100R0 proposes to add the following =
strongly-typed enumerations to the standard library:<br><font size=3D"2"><s=
pan style=3D"font-family: courier new,monospace;"><br></span></font><pre><f=
ont size=3D"2"><span style=3D"font-family: courier new,monospace;"><code>en=
um class partial_ordering { less, unordered, greater };
enum class weak_ordering { less, equivalent, greater };
enum class total_ordering { less, equal, greater };</code></span></font></p=
re><br>I think that the idea is great but that these enumerations would ben=
efit from an explicit conversion to int where the three values would be equ=
al to -1, 0 and 1.<br>It would allow to have strong typing by default but t=
he ability to interface with old APIs that rely on the values -1, 0 and 1. =
While some of this old APIs only check the values, other ones do some arith=
metic with the returned values (I have seen multiplications, but also addit=
ions in the wild) and changing every API would be a bit bothersome.<br><br>=
Basically, I propose to change the enumerations as follows:<br><br><pre><fo=
nt size=3D"2"><span style=3D"font-family: courier new,monospace;"><code>enu=
m class partial_ordering: int { less =3D -1, unordered =3D 0, greater =3D 1=
 };
enum class weak_ordering: int { less =3D -1, equivalent =3D 0, greater =3D =
1 };
enum class total_ordering: int { less =3D -1, equal =3D 0, greater =3D 1 };=
</code></span></font></pre><font size=3D"2"><span style=3D"font-family: cou=
rier new,monospace;"></span></font><br>Any opinion about that?<br><br>Morwe=
nn.<br><br></div>

<p></p>

-- <br />
<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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<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 />

------=_Part_994_2086772886.1446761866902--
------=_Part_993_370600272.1446761866902--

.
