220 4239 <CAGg_6+PTyNK6rTAdC3NKLOnLR3g0WfyqgNKmHz-9edMOdjnVNA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: Nevin Liber <nevin@eviloverlord.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Fixing Standard Library relational operators (was:
 Re: optional Rev.4 (N3672): What was the rationale to remove
 !=, >=, ...)
Date: Fri, 3 May 2013 09:27:13 -0500
Lines: 126
Approved: news@gmane.org
Message-ID: <CAGg_6+PTyNK6rTAdC3NKLOnLR3g0WfyqgNKmHz-9edMOdjnVNA@mail.gmail.com>
References: <CAGg_6+NTws7QyEAsEUd308yx4LncpD_r6x4yJEJy5RN2w6v2Hw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=047d7bb050824982d904dbd12847
X-Trace: ger.gmane.org 1367591283 11308 80.91.229.3 (3 May 2013 14:28:03 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 3 May 2013 14:28:03 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCE35H5S6IDBB34SR6GAKGQEDA4CH3Y@isocpp.org Fri May 03 16:28:03 2013
Return-path: <std-proposals+bncBCE35H5S6IDBB34SR6GAKGQEDA4CH3Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-gg0-f197.google.com ([209.85.161.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCE35H5S6IDBB34SR6GAKGQEDA4CH3Y@isocpp.org>)
	id 1UYGxt-0002Ol-DT
	for gclcip-std-proposals@m.gmane.org; Fri, 03 May 2013 16:28:01 +0200
Original-Received: by mail-gg0-f197.google.com with SMTP id w6sf2435568ggk.8
        for <gclcip-std-proposals@m.gmane.org>; Fri, 03 May 2013 07:28:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=x-received:x-beenthere:x-received:received-spf:x-received
         :mime-version:sender:in-reply-to:references:from:date:message-id
         :subject: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=Yvrn3HcuuNlYeAkmW2siI101LptjkHSSGdlFhwHdv5c=;
        b=IpvpqB9ev5vN8FJdvKGUBU1x0SqbK37iN34j+ISrvRuLVdd9wwGdnaEUuwoyC1eI4c
         5AWOAnJ0Gud5X1uRx2f/brFSJGlEDZZk0RzbUiGwm4lro9rlGDobg2quWKB07XNDmd8U
         Pdu4MS9YWgaHFwJ4aS5f5qRcuJOKMWsf849Abl9gyk7IYSLagL8++h7D2lNW726ZL5lN
         foBCIVJ6bwa8eze8GLPfGR8vyaal7m7MZNucLAHWM7cNoEtUclp8Z7d0m+tfDvZ5Pt+A
         pGsNhyjfEa0V0sMqZ0qCASBYsF8B6Nnz2r1Za3dbXtciKyBY5kBrE 
X-Received: by 10.236.91.109 with SMTP id g73mr8245203yhf.23.1367591280366;
        Fri, 03 May 2013 07:28:00 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.86.232 with SMTP id s8ls1139327qez.94.gmail; Fri, 03 May
 2013 07:27:58 -0700 (PDT)
X-Received: by 10.49.35.243 with SMTP id l19mr14105434qej.56.1367591278007;
        Fri, 03 May 2013 07:27:58 -0700 (PDT)
Original-Received: from mail-qe0-f49.google.com (mail-qe0-f49.google.com [209.85.128.49])
        by mx.google.com with ESMTPS id v12si3367249qct.186.2013.05.03.07.27.57
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Fri, 03 May 2013 07:27:57 -0700 (PDT)
Received-SPF: pass (google.com: domain of nliber@gmail.com designates 209.85.128.49 as permitted sender) client-ip=209.85.128.49;
Original-Received: by mail-qe0-f49.google.com with SMTP id 7so919516qeb.36
        for <std-proposals@isocpp.org>; Fri, 03 May 2013 07:27:57 -0700 (PDT)
X-Received: by 10.49.50.162 with SMTP id d2mr14263290qeo.17.1367591277386;
 Fri, 03 May 2013 07:27:57 -0700 (PDT)
Original-Sender: nliber@gmail.com
Original-Received: by 10.49.24.169 with HTTP; Fri, 3 May 2013 07:27:13 -0700 (PDT)
In-Reply-To: <CAGg_6+NTws7QyEAsEUd308yx4LncpD_r6x4yJEJy5RN2w6v2Hw@mail.gmail.com>
X-Original-Sender: nevin@eviloverlord.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of nliber@gmail.com designates 209.85.128.49 as permitted sender)
 smtp.mail=nliber@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:4239
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/4239>

--047d7bb050824982d904dbd12847
Content-Type: text/plain; charset=ISO-8859-1

On 2 May 2013 16:19, Nevin Liber <nevin@eviloverlord.com> wrote:

> operator< should be implemented in terms of operator< of the underlying
> component(s)
> operator== should be implemented in terms of operator== of the underlying
> component(s)
> std::less should be implemented in terms of std::less of the underlying
> component(s)
> std::equal_to should be implemented in terms of std::equal_to of the
> underlying component(s)
>
> operator>, operator<=, operator>= should be written in terms of operator<
> operator!= should be written in terms of operator==
> std::greater, std::less_equal, std::greater_equal should be written in
> terms of std::less
> std::not_equal_to should be written in terms of std::equal_to
>

The other, simpler possibility is to not specialize the arithmetic
operations:

operator< should be implemented in terms of std::less of the underlying
component(s)
operator== should be implemented in terms of std::equal_to of the
underlying component(s)

operator>, operator<=, operator>= should be written in terms of operator<
operator!= should be written in terms of operator==

This may have surprising results for those who, for instance, think
operator< and std::less should do different things (the only place in the
standard which does this as far as I know is for pointers, and that is only
because C doesn't give them a total ordering), but I see that being as
insane as NaN.

Thoughts?
-- 
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

-- 

--- 
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.



--047d7bb050824982d904dbd12847
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 2 May 2013 16:19, Nevin Liber <span dir=3D"ltr">&lt;<a href=3D"mailto:ne=
vin@eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com</a>&gt;</spa=
n> wrote:<br><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



operator&lt; should be implemented in terms of operator&lt; of the underlyi=
ng component(s)<br><div class=3D"gmail_quote"><div>operator=3D=3D should be=
 implemented in terms of operator=3D=3D of the underlying component(s)<br>s=
td::less should be implemented in terms of std::less of the underlying comp=
onent(s)<br>




std::equal_to should be implemented in terms of std::equal_to of the underl=
ying component(s)<br><br>operator&gt;, operator&lt;=3D, operator&gt;=3D sho=
uld be written in terms of operator&lt;<br>operator!=3D should be written i=
n terms of operator=3D=3D<br>




std::greater, std::less_equal, std::greater_equal should be written in term=
s of std::less<br>std::not_equal_to should be written in terms of std::equa=
l_to<span></span></div></div></blockquote><div><br>The other, simpler possi=
bility is to not specialize the arithmetic operations:<br>



<br>operator&lt; should be implemented in terms of std::less of the underly=
ing component(s)<br>operator=3D=3D should be implemented in terms of std::e=
qual_to of the underlying component(s)<br><br>operator&gt;, operator&lt;=3D=
, operator&gt;=3D should be written in terms of operator&lt;<br>



operator!=3D should be written in terms of operator=3D=3D<br><br>This may h=
ave surprising results for those who, for instance, think operator&lt; and =
std::less should do different things (the only place in the standard which =
does this as far as I know is for pointers, and that is only because C does=
n&#39;t give them a total ordering), but I see that being as insane as NaN.=
<br>


<br>Thoughts?<br>
</div></div>-- <br>=A0Nevin &quot;:-)&quot; Liber=A0 &lt;mailto:<a href=3D"=
mailto:nevin@eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com</a>=
&gt;=A0 <a href=3D"tel:%28847%29%20691-1404" value=3D"+18476911404" target=
=3D"_blank">(847) 691-1404</a>

<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/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--047d7bb050824982d904dbd12847--

.
