220 40231 <7b85d688-9013-407d-b7d3-10d28494e960@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Addy <aclaure@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: std::between ?
Date: Thu, 27 Sep 2018 08:53:21 -0700 (PDT)
Lines: 64
Approved: news@gmane.org
Message-ID: <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/mixed; 
	boundary="----=_Part_380_506474107.1538063601171"
X-Trace: blaine.gmane.org 1538063477 22762 195.159.176.226 (27 Sep 2018 15:51:17 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 27 Sep 2018 15:51:17 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDLLNENJZQGRB4XZWPOQKGQE3SHOWBY@isocpp.org Thu Sep 27 17:51:13 2018
Return-path: <std-proposals+bncBDLLNENJZQGRB4XZWPOQKGQE3SHOWBY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb1-f199.google.com ([209.85.219.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDLLNENJZQGRB4XZWPOQKGQE3SHOWBY@isocpp.org>)
	id 1g5YZN-0005oK-ED
	for gclcip-std-proposals@m.gmane.org; Thu, 27 Sep 2018 17:51:13 +0200
Original-Received: by mail-yb1-f199.google.com with SMTP id y12-v6sf1056139ybg.23
        for <gclcip-std-proposals@m.gmane.org>; Thu, 27 Sep 2018 08:53:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=ZE2dYeGjO3jF4cdW6BFSlcV6OR7YdJeZWvH1pnGb0C8=;
        b=rzg0V99d/FL/URcc5xVWbEpIKO9SyZgMEQEM+1zkdUR+nj78DkzT9Ah1b2fswr6CBB
         zXSjvdV6vdNYgDVHWjMaq/3WkS2M5scG+uPUOcimHAY1KwhLxAE8hgzTubzj17j4W4iT
         aJeN1CNIVbLt9Iu2bR4cQMWsBXf1BGppWXsoqawxa4seMAVOnjlG776cgKp2mHLdbEVS
         1d/ezlK/Kb9ruLZImQ2Ov1GzuH5YjgCBobU35rN4uc2kmOyZd2Yl8rPX24RkKHbIpf3b
         27wPHS4hTVW4A3emrQGK1L1eTwv/QSvASNfcVsjpvZ88cSS3O0pJs/IWQb9JF/d6DQf8
         2Ekg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:subject:mime-version:x-original-sender
         :reply-to:precedence:mailing-list:list-id:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=ZE2dYeGjO3jF4cdW6BFSlcV6OR7YdJeZWvH1pnGb0C8=;
        b=uiYCSxz3gIepPywXbD5MqaeFCoS7rpJZdExulC8SNTZPYSQoCTML4d0U/E/4dtK9Th
         g4OuApJqbyavtICywRO0kCm/YemVamYasLVzyggM7JY/Te5U+/Pe7ayZxp6Bt5kh2hRu
         n4W6VFczQiZAa+neSmOtKVquIxQ/8EEZIHJbtf3z0fWy5OtjDxZIDehNYZ9P5keDBw1g
         aS2I/yVe7XvhynZXA9ATrq+y/SP6d3qpkNQpRoUICKK0Gwm/S8lj2AkDAy6tVwEo5HB5
         04oXFw3fbGn1wsU00WCDPBAtv6witnGoLz1NVtL1/DRWy4S8bsJ3AJXXXCygXN1x+q8I
         M7fQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:subject:mime-version
         :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=ZE2dYeGjO3jF4cdW6BFSlcV6OR7YdJeZWvH1pnGb0C8=;
        b=AfA46gQYqmksOWNniPyXYhYDxPJc8TpmSP2ng2jbsGhqEk7wskuhq8qRfsoRmUv0op
         8JA5XzplNFWukowj5Rg93wICr94lmQiUMIvpLkzOBzJ0DlAvFwLURAhEGJr2kj9szvhV
         MCYMwhDa27EF4lu1Wt1buQM4rbyrNbWk8SK3c7Mfou2UFYrhRQ/CojMRyGVz05R9laUe
         oG9b6Juzps+jmnRenyK/SRR0HFdUnFhlgYppPHIISJzvfijicdsmFdhvApq+pttnC0/v
         1NOTw4ew9acJ0Js9f7z/Ma8AOFgaXgnRZv13z+kZr/WOxm3PAXaVk+A6gWE47egcOsfL
         OD3w==
X-Gm-Message-State: ABuFfogQL/+E5cTttqi6ZU3qwgDtviXvzxpnnVe0mKTxe/wxosxPkAL6
	3owMZkBeJgaLyo3wnIBDF/TW1Q==
X-Google-Smtp-Source: ACcGV60DBI8IykHgmatgkDd+VlT6sDghaOsBEB4urK0Q5tD1ezM2Qd0Pnr4wWRu9CaL3bn2tA1/tCQ==
X-Received: by 2002:a25:a122:: with SMTP id z31-v6mr2176017ybh.85.1538063603564;
        Thu, 27 Sep 2018 08:53:23 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:73d5:: with SMTP id o204-v6ls1535866ywc.6.gmail; Thu, 27
 Sep 2018 08:53:22 -0700 (PDT)
X-Received: by 2002:a0d:ea0b:: with SMTP id t11-v6mr126309ywe.6.1538063601888;
        Thu, 27 Sep 2018 08:53:21 -0700 (PDT)
X-Original-Sender: aclaure@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:40231
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40231>

------=_Part_380_506474107.1538063601171
Content-Type: multipart/alternative; 
	boundary="----=_Part_381_1840869567.1538063601171"

------=_Part_381_1840869567.1538063601171
Content-Type: text/plain; charset="UTF-8"

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.

------=_Part_381_1840869567.1538063601171
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<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()` that would take two arguments and an optional third (compare f=
unction) argument.</div><div><br></div><div>Similar to this:=C2=A0https://g=
ist.github.com/martinmoene/9410391<br></div><div><br></div><div>templated&l=
t;typename T, typename Compare&gt;</div><div>bool std::between(T lower, T u=
pper, Compare comp)</div><div>{</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 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">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/7b85d688-9013-407d-b7d3-10d28494e960%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7b85d688-9013-407d-b7d3-10d28494e960=
%40isocpp.org</a>.<br />

------=_Part_381_1840869567.1538063601171--

------=_Part_380_506474107.1538063601171--

.
