220 40235 <CAOHCbis2t0Dboe3+M23gS9i8zW4+LFWzM9PfTGmkiGUKEQ+BGQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Tony V E <tvaneerd@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: std::between ?
Date: Thu, 27 Sep 2018 13:47:45 -0400
Lines: 124
Approved: news@gmane.org
Message-ID: <CAOHCbis2t0Dboe3+M23gS9i8zW4+LFWzM9PfTGmkiGUKEQ+BGQ@mail.gmail.com>
References: <7b85d688-9013-407d-b7d3-10d28494e960@isocpp.org> <CAOHCbitYKvMhz1kkjZCk5Ep1vkFU9ZUwH7kZ+m9_tyG=ueEdcw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="0000000000006774a60576ddf0fa"
X-Trace: blaine.gmane.org 1538070351 5756 195.159.176.226 (27 Sep 2018 17:45:51 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 27 Sep 2018 17:45:51 +0000 (UTC)
To: Standard Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUZ5QWKNQIM3L5U3UCRUBFGWZ3GS@isocpp.org Thu Sep 27 19:45:47 2018
Return-path: <std-proposals+bncBCUZ5QWKNQIM3L5U3UCRUBFGWZ3GS@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ot1-f70.google.com ([209.85.210.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUZ5QWKNQIM3L5U3UCRUBFGWZ3GS@isocpp.org>)
	id 1g5aMF-0001Pp-E2
	for gclcip-std-proposals@m.gmane.org; Thu, 27 Sep 2018 19:45:47 +0200
Original-Received: by mail-ot1-f70.google.com with SMTP id 13-v6sf4201572oth.6
        for <gclcip-std-proposals@m.gmane.org>; Thu, 27 Sep 2018 10:47:58 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1538070477; cv=pass;
        d=google.com; s=arc-20160816;
        b=xz/dSeKGFsKeU9xnyotHcwWAM1+ARMaDSQPkZX38N+7FZUbmgvOVDxUZA/SvhJRFm9
         J6TjWrkysq2tDEUafk9LGRawrbnRwBNTeU8iIq8oO9cX50lDix2WhFRBwveAIdLbe0z7
         7MFDUCKBMCx3xZB1byWc71j2gqqtDYWK6bXg43U4lPW+aooPm3ygBacU345gGf8iv4vb
         IRBH/zXHe977XczNAfBmVPwtcpVXwTRun7x52dgf0L7k17dWwuSa43LilJn5Tyr5XBMo
         4WEP6tkItV7ws+LIL4ONcehvk6BCdo59XNAPbKtDtg9Kr6CzFJAt2a+nOO/ZqLzH7mVy
         mG9A==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:mime-version:dkim-signature;
        bh=Q6Rjd8oGeJN5S/uVyKYyv65sXM0oxEmy5q6AkBWixY0=;
        b=LL0zBe5iNri0Z5mDReJYkX48a2Kz95rj2LbscDxoaT2YLBfPVc+8A8blRy37VxkKET
         rb6REQ0hs3cxgqJP4qdaYrl5Z+cdh7jRHlbEfMSZj2Q2Z+/YOPhTrKkT3eHcLa7P7YDr
         ZYQ75xLMFNnn1r/XF7zRuxzUMhBdAb9f1a7ZTvLGt6i7M8BdlaBOGTrjYl92jJDSg8cc
         dKX7csvVej4i22BF/sN8knwC0p+QLsBX6FaGl/mquiFUmR0TewIl9JQVvE4erM5iTt6W
         WAPyWBQ4dRZFoLQMWkIGxzxWIuqxBwnzwP2gEUNwK+K55cWMKV87BS1lCg/Int6dmVmu
         sPAg==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=U2awOCmj;
       spf=pass (google.com: domain of tvaneerd@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tvaneerd@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:from:date:message-id:subject: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;
        bh=Q6Rjd8oGeJN5S/uVyKYyv65sXM0oxEmy5q6AkBWixY0=;
        b=ztAYKA9ZP0sqSIZ9VBKyNP0mCjUanJD7yJ6PRk6eXOf614ByTyV+cY8syMeAEzAkUZ
         ppe3waUH9UTgqccTiNVv/kXQkKFLVCci5O2Ijw6fSyPPEhka7FJSN+p8MEAjHcg8dKg9
         JibATcYgX/oYNfWB4kcs+OYyNimnpNnp7cnMKpBqFvlaRXYL5mbq9fkwNggx7++vPKSI
         mgfX+iExXpKHr+e+/f7DiJsJ2VOwmPNmjGrIjub1i8bJusR23hUAPzkxj5Y0ankwG1Kc
         iP+lbi1A13J643DsnfYqLp0I7QAGNO105Tl7zrNO4c+al4vRMZIQy0zJpVxEYosriaUF
         iQKA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:from:date:message-id
         :subject:to:x-original-sender:x-original-authentication-results
         :reply-to:precedence:mailing-list:list-id:x-spam-checked-in-group
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=Q6Rjd8oGeJN5S/uVyKYyv65sXM0oxEmy5q6AkBWixY0=;
        b=h6pkmxvrk+qJF+/YGIxuQGQjkjJs0aN8s9owzBzQnSpLimnmwfm4rA4WvXwVDHacdG
         QnOcjKW2RFPK4zGH9xfNoobhbjEfsXcoA9q4NC6ilB5qUXKPYmE8lGguJSXo6OtxwpX6
         U/mnqJnNHfJo8vLFytFnRB82UxGY7mDhWIcNQha8LgOQxLJb1ysLdNrDuyJnyQPp5/oK
         hMtJs8SoU2EhaEawfgOeSlfpiIxQ1+W/ukrAN1azGsMyNb241yt+PADoy8sn9wDmMEWC
         HO93DdbWimtSY99riJqSMRPZkSBb3l0a90Pt9ffecy1CxsIzWgPSLhnQEVe5Y9duUgnR
         ju1g==
X-Gm-Message-State: ABuFfogwhhK2fFbZ8eVhDqleugY5LdjGxDtSz0gbIkiJpArTZvXpyGzk
	rPXXVP1pclgFWiySrPYyB0oFiA==
X-Google-Smtp-Source: ACcGV61Dmue/wllC5r9UwN5yil1JR4FvojP91ria+MM3oqtH5+/k1HD5SKf+psfaH+riFM7ideGUzQ==
X-Received: by 2002:aca:ded5:: with SMTP id v204-v6mr10707330oig.7.1538070477768;
        Thu, 27 Sep 2018 10:47:57 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:aca:5ec6:: with SMTP id s189-v6ls3347296oib.3.gmail; Thu, 27
 Sep 2018 10:47:57 -0700 (PDT)
X-Received: by 2002:aca:e144:: with SMTP id y65-v6mr524294oig.90.1538070477029;
        Thu, 27 Sep 2018 10:47:57 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1538070477; cv=none;
        d=google.com; s=arc-20160816;
        b=isD2Gbe0/DJOkWsdlbziK+NvGpgmVY9XF61jzI03mKEOMNuRzAvYtmFNnoEuGNH7l6
         vPsHY1VrAt6QO1WBnrGDwPuS8bysFl+UNVgZ4qb1xsAGWoO1XBRSan9c1f0Kr7EOkT/X
         Z4HMQhdp16Xt6brYQ8nk3QF7xvIReihENYFpWceW8XzwZdcjyyUdSlAX2+q32LUbnGcJ
         6CGPHOS+uMzVil+J9vofKkno92UAx55zc4G8e3cxz/wLLtydMwAQeoX82Yc/vkpMGQwZ
         e2pvslU3cqjlCWyU3ENIVsCkX5zruYxUx68VEBCamnQNhYQYmqU8WRxi2t0SL21sDSR+
         47Qw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:mime-version
         :dkim-signature;
        bh=U7ix4RbmF/PzOr5WqZUUGJAWBEgKE0Ggig2V7PU2nDo=;
        b=G8iPZ6D0t9nEeXHP0QhHxnnQ+fRZR5NQz4ZE2u7B1pg7v3OiNY3sgwrO8L5bErnfkU
         MHLlW0dvUw4CTTBhJrvfvwr5rmtcPuxnbV1ugMuOhaZ+C5kQjCkSb++NeAwpZxByKWbq
         4FgnaQL8iFZN7pEp7TZpcRWSfMrfngwjbro563+8f/gMrXHq7cIJhJ33zdZtJ+GmSyLM
         QTQ98UfCn+6Up3yB5H5F4MiwpPMHJP2N9UcFXvJ/fyBLYutmSMwIZNPijHFZzWrbEtkP
         BpOiqf3he01sG0cjeNwbLL0n9jZiRwr7h6Du+K8NLQnugAZjURL+i5rvNQBoPvv11xSh
         Fxhw==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=U2awOCmj;
       spf=pass (google.com: domain of tvaneerd@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tvaneerd@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id v25-v6sor1251410oiv.2.2018.09.27.10.47.56
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Thu, 27 Sep 2018 10:47:57 -0700 (PDT)
Received-SPF: pass (google.com: domain of tvaneerd@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:aca:5cd4:: with SMTP id q203-v6mr3524070oib.217.1538070476713;
 Thu, 27 Sep 2018 10:47:56 -0700 (PDT)
X-Original-Sender: tvaneerd@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=U2awOCmj;       spf=pass
 (google.com: domain of tvaneerd@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=tvaneerd@gmail.com;       dmarc=pass (p=NONE
 sp=QUARANTINE dis=NONE) header.from=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: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:40235
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40235>

--0000000000006774a60576ddf0fa
Content-Type: text/plain; charset="UTF-8"

Darn, I meant std::between(x, 100, -100);

On Thu, Sep 27, 2018 at 1:47 PM Tony V E <tvaneerd@gmail.com> wrote:

> We could argue about the order of params, and what std::between(x, -100,
> 0) means, or you could look at std::clamp().
>
> On Thu, Sep 27, 2018 at 11:53 AM Addy <aclaure@gmail.com> wrote:
>
>> I do this pattern often:
>>
>> if (0 < x && x < 100)
>>
>> And would love a simple `std::between()` that would take two arguments
>> and an optional third (compare function) argument.
>>
>> Similar to this: https://gist.github.com/martinmoene/9410391
>>
>> templated<typename T, typename Compare>
>> bool std::between(T lower, T upper, Compare comp)
>> {
>>     return comp(lower) && comp(upper);
>> }
>>
>> Does anything like this exist? Should I propose it!?
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/7b85d688-9013-407d-b7d3-10d28494e960%40isocpp.org
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/7b85d688-9013-407d-b7d3-10d28494e960%40isocpp.org?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Be seeing you,
> Tony
>


-- 
Be seeing you,
Tony

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbis2t0Dboe3%2BM23gS9i8zW4%2BLFWzM9PfTGmkiGUKEQ%2BBGQ%40mail.gmail.com.

--0000000000006774a60576ddf0fa
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><br></div><div><br></div><div>Darn, I meant std::betw=
een(x, 100, -100);<br></div></div><br><div class=3D"gmail_quote"><div dir=
=3D"ltr">On Thu, Sep 27, 2018 at 1:47 PM Tony V E &lt;<a href=3D"mailto:tva=
neerd@gmail.com">tvaneerd@gmail.com</a>&gt; wrote:<br></div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex"><div dir=3D"ltr">We could argue about the order of params, =
and what std::between(x, -100, 0) means, or you could look at std::clamp().=
<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu, Sep 27, 2=
018 at 11:53 AM Addy &lt;<a href=3D"mailto:aclaure@gmail.com">aclaure@gmail=
..com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr=
">I do this pattern often:<div><br></div><div>if (0 &lt; x &amp;&amp; x &lt=
; 100)</div><div><br></div><div>And would love a simple `std::between()` th=
at would take two arguments and an optional third (compare function) argume=
nt.</div><div><br></div><div>Similar to this:=C2=A0<a href=3D"https://gist.=
github.com/martinmoene/9410391" target=3D"_blank">https://gist.github.com/m=
artinmoene/9410391</a><br></div><div><br></div><div>templated&lt;typename T=
, typename Compare&gt;</div><div>bool std::between(T lower, T upper, Compar=
e comp)</div><div>{</div><div>=C2=A0 =C2=A0 return comp(lower) &amp;&amp; c=
omp(upper);</div><div>}</div><div><br></div><div>Does anything like this ex=
ist? Should I propose it!?</div></div>

<p></p>

-- <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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/7b85d688-9013-407d-b7d3-10d28494e960%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/7b85d688-9013-=
407d-b7d3-10d28494e960%40isocpp.org</a>.<br>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div>Be=
 seeing you,<br></div>Tony<br></div></div></blockquote></div><br clear=3D"a=
ll"><br>-- <br><div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D=
"gmail_signature"><div dir=3D"ltr"><div>Be seeing you,<br></div>Tony<br></d=
iv></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOHCbis2t0Dboe3%2BM23gS9i8zW4%2BLFWz=
M9PfTGmkiGUKEQ%2BBGQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbis2t0=
Dboe3%2BM23gS9i8zW4%2BLFWzM9PfTGmkiGUKEQ%2BBGQ%40mail.gmail.com</a>.<br />

--0000000000006774a60576ddf0fa--

.
