220 40234 <CAOHCbitYKvMhz1kkjZCk5Ep1vkFU9ZUwH7kZ+m9_tyG=ueEdcw@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:11 -0400
Lines: 106
Approved: news@gmane.org
Message-ID: <CAOHCbitYKvMhz1kkjZCk5Ep1vkFU9ZUwH7kZ+m9_tyG=ueEdcw@mail.gmail.com>
References: <7b85d688-9013-407d-b7d3-10d28494e960@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="00000000000065b7e50576ddeedc"
X-Trace: blaine.gmane.org 1538070319 3801 195.159.176.226 (27 Sep 2018 17:45:19 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 27 Sep 2018 17:45:19 +0000 (UTC)
To: Standard Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUZ5QWKNQIKXL5U3UCRUBEO267K6@isocpp.org Thu Sep 27 19:45:15 2018
Return-path: <std-proposals+bncBCUZ5QWKNQIKXL5U3UCRUBEO267K6@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi1-f198.google.com ([209.85.167.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUZ5QWKNQIKXL5U3UCRUBEO267K6@isocpp.org>)
	id 1g5aLi-0000tR-TG
	for gclcip-std-proposals@m.gmane.org; Thu, 27 Sep 2018 19:45:15 +0200
Original-Received: by mail-oi1-f198.google.com with SMTP id m21-v6sf725957oic.7
        for <gclcip-std-proposals@m.gmane.org>; Thu, 27 Sep 2018 10:47:25 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1538070444; cv=pass;
        d=google.com; s=arc-20160816;
        b=UAcC1LipNWUj3U8nOLYCZWwojsJIqX1sZ+MNX8ICFyuljCjRY9ZTXDlNt5fqccBkDR
         kC93ghId72/aW00nCR6t8YH2bROWWow3JQSimOos5dxc1jQcUGBLY4g7wuYV3BKfMpa0
         ZgO4CFyi7PGe+eJML4PgXM47sQcwsL5nJO/IFNN+yKeCWVjzmO/am6wAZbtW7gVN265o
         OAUSIcJqTyDGiOXHylxJIg1yP8Hezh9rB/NwqESUlJsfKz/6KOSTJ/3RH513D03Rcofh
         GnPNbWnLsgSlwUtAkgQup/JUBfB6dv0yUGk24ie9WMIHOzV4KrHsv+D8CiicvaEgImU4
         acUQ==
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:in-reply-to:references:mime-version:dkim-signature;
        bh=iKnIeIgL39kyGU/Goo+OrX0T+8ZzFEpor9Ku1yGQMCY=;
        b=sTDIgjzFGj2cnRxkBXDKHWkRfeXZvw9hj/7jnCOQeTr2V8IcJKvJVVNExWddooyKxU
         udYkX9QzUomzmo1STH1llaKcRM9xAxya/XJmhzmMf9JFN2rXfk1MMEZgQjBda0rF7U+B
         z8Ig9k386RV2DAi0ntG+mPUi8XnIQchbUm3pvElcXhARUmMkEfB5RRJEcAJibluSHXbJ
         UQr4ZJ24meurlkI5ptwRNBGhPAM8x0K+2XVtVETe9y/sWKtk3r9KeDpyxRL7+OLTmZZt
         vOtctrcMQoy+rYt3mHOC1oVJkWApM+D8jUdR5/vlhWFR4ePU+PYoGxFImPkAhCdLYJBT
         LIGg==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=jTb4ZnM6;
       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:in-reply-to: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=iKnIeIgL39kyGU/Goo+OrX0T+8ZzFEpor9Ku1yGQMCY=;
        b=P51i7aKUNpEtoCduGjVAmA8JaVUuSVlhf/75J5TGpu7Affg0bBlbbbXwonUFyeWiAs
         /ZbVklZhO21OWTa4Isr6d5q4oDfdNTv/Egpp5AojsRolsCC7rUfiOppwDGaDt02T63UH
         Ej+Fb1rJoPpmGyW2jLYRvRPcpxjXKIUgLJIpxIxj0ES8boPE96BL4yh4O25FR1R0fU3e
         WgUhroD2YB/GaoIzvzBbIKHkLpi0tF6gSju7xHwYtRL4od7ubPikG89zg+a1AGi3PqTT
         xizEzQ6eUxeAec31UOA3Upd8vG3zo8u4Vm25bzh5N0Lv44IBHfuPcKwdO9uMt0gblWjx
         LgvQ==
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:in-reply-to: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=iKnIeIgL39kyGU/Goo+OrX0T+8ZzFEpor9Ku1yGQMCY=;
        b=LUINGexdxDg8b+k2OjFkpBbjQbPw5J7NPJUcn+Eme9sEGTqYEcH1Fjc7V5rzw6d11Y
         A+ujH58CGAcV/TODfTlbPyK6rxQYCQRtTb+wVNaxhjdOV9QTeLDzEoBKg0Sh6eMlcJWV
         MBrxm43S51GwaWJ/iysKCqOFfV0T+j5PtdnaO/31lVMA0jcd87zhHVx00FerRPM0eSeh
         1Qjxc1SnNxP/ZcF/cjzmNdufzL4xB1/LQusM7hAvZtzr+HJIx4yI9caLuvpfdjjAG+GF
         xyOxnk9pl9ro9oGpGEkaLA+9b/K6QmRUsuZ8xaZXY61iBZtzx7wcalKE8D4wPXSNOQj3
         dr/g==
X-Gm-Message-State: ABuFfogOioAlo/vvKp5j0LkVhex/m3Y60QAgHlL1bCAcMA9VmtYLj7EX
	EzeQ0D3SXJ9myjPEqQvOIH60ow==
X-Google-Smtp-Source: ACcGV62dQIbgISA326/F4v+VJPxy0rZnJZ0M3x96k6JtGm/2CLWojj+NrW7Gu+EdBKDWG3dCDKPnmA==
X-Received: by 2002:a9d:5b78:: with SMTP id e53-v6mr11461282otj.2.1538070444707;
        Thu, 27 Sep 2018 10:47:24 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a9d:b89:: with SMTP id 9-v6ls1581430oth.3.gmail; Thu, 27 Sep
 2018 10:47:23 -0700 (PDT)
X-Received: by 2002:a9d:550d:: with SMTP id l13-v6mr7850072oth.83.1538070443535;
        Thu, 27 Sep 2018 10:47:23 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1538070443; cv=none;
        d=google.com; s=arc-20160816;
        b=n3gQf9gEta7kF6j5NeAtLoQOjYj5vptaxx9PzDmDNwNTd/G3xY7KlYJzOHPUthtF6U
         1Dq8oc53wHpjhsXCErsAwaaCjPu4MWeyozHySE7wgn5P71l3tbaYDlNuFMvCO+kjy0jv
         vfV1Vp4avZKW84ECTpK9uYVAyEM4ND0k5xT4dYmt6Sw8bz4plxTMvQZ4nS+8zbX6v85z
         vfTfj//imKYj/w44ZGzKfbJb1Faf627ypkejEtraZfNgtRzCtrDou6GaYe4TUfJ1dOnU
         f0aUl4l9tbxbgr5ZLcVQ25sy20e61MSmqXYdqnVqSPtvmwW4NLo4T/eA+kmGuLlKnBiC
         bbbA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature;
        bh=h5mXssoB4Xb4Yfyhzj9eSRoTzwLDG4bobNIf8RGt6wM=;
        b=Aq3h8gThtDNZeS1+5e98IXGJjv6si5oW+7cMIrlj4VH/cdEXddkw3ePXTs+yrsjBEw
         HaC1qdlDtesyU25lc8KOGiA1uJgN5ff0beMwGm75OM+orUD5IgFFeVp2LlTc1qlfTE59
         hvZ3nRhcQVJm9ZXBy2g3DZ/rymqu03Dn83s4Eq9aY7toNhXCow5WCJXjbsMUTKoWOH6S
         OWhD/AXhynlKyfctouoWdcnTtp5j65LdtU6KtPojMVl+W9yzAQAgZ9t+2tCEdK0tOo/w
         k+iTqSTwiu5OuVGcCDT1NRMfuOTWmGtfY6gyyT0VfRZBAuwu7vw5HizDYdtgjIgkwxT1
         8UHA==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=jTb4ZnM6;
       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 b5-v6sor1095886oiy.36.2018.09.27.10.47.23
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Thu, 27 Sep 2018 10:47:23 -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:bdc4:: with SMTP id n187-v6mr3886088oif.3.1538070443045;
 Thu, 27 Sep 2018 10:47:23 -0700 (PDT)
In-Reply-To: <7b85d688-9013-407d-b7d3-10d28494e960@isocpp.org>
X-Original-Sender: tvaneerd@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=jTb4ZnM6;       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:40234
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40234>

--00000000000065b7e50576ddeedc
Content-Type: text/plain; charset="UTF-8"

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

-- 
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/CAOHCbitYKvMhz1kkjZCk5Ep1vkFU9ZUwH7kZ%2Bm9_tyG%3DueEdcw%40mail.gmail.com.

--00000000000065b7e50576ddeedc
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">We could argue about the order of params, and what std::be=
tween(x, -100, 0) means, or you could look at std::clamp().<br></div><br><d=
iv class=3D"gmail_quote"><div dir=3D"ltr">On Thu, Sep 27, 2018 at 11:53 AM =
Addy &lt;<a href=3D"mailto:aclaure@gmail.com">aclaure@gmail.com</a>&gt; wro=
te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I do this patt=
ern 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()` that would take tw=
o arguments and an optional third (compare function) argument.</div><div><b=
r></div><div>Similar to this:=C2=A0<a href=3D"https://gist.github.com/marti=
nmoene/9410391" target=3D"_blank">https://gist.github.com/martinmoene/94103=
91</a><br></div><div><br></div><div>templated&lt;typename T, typename Compa=
re&gt;</div><div>bool std::between(T lower, T upper, Compare comp)</div><di=
v>{</div><div>=C2=A0 =C2=A0 return comp(lower) &amp;&amp; comp(upper);</div=
><div>}</div><div><br></div><div>Does anything like this exist? Should I pr=
opose 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>

<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/CAOHCbitYKvMhz1kkjZCk5Ep1vkFU9ZUwH7kZ=
%2Bm9_tyG%3DueEdcw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbitYKvMh=
z1kkjZCk5Ep1vkFU9ZUwH7kZ%2Bm9_tyG%3DueEdcw%40mail.gmail.com</a>.<br />

--00000000000065b7e50576ddeedc--

.
