220 19973 <e883a019-bd93-44d3-bc0e-3943f7329b9e@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Daryle Walker <darylew@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Should GCD/LCM take variable numbers of arguments?
Date: Sat, 22 Aug 2015 21:51:08 -0700 (PDT)
Lines: 111
Approved: news@gmane.org
Message-ID: <e883a019-bd93-44d3-bc0e-3943f7329b9e@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_834_813212632.1440305468854"
X-Trace: ger.gmane.org 1440305475 28384 80.91.229.3 (23 Aug 2015 04:51:15 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 23 Aug 2015 04:51:15 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDS6X4FNQMPBBPVC4WXAKGQEKPVWYNA@isocpp.org Sun Aug 23 06:51:15 2015
Return-path: <std-proposals+bncBDS6X4FNQMPBBPVC4WXAKGQEKPVWYNA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pd0-f200.google.com ([209.85.192.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDS6X4FNQMPBBPVC4WXAKGQEKPVWYNA@isocpp.org>)
	id 1ZTNFQ-0003Y3-PT
	for gclcip-std-proposals@m.gmane.org; Sun, 23 Aug 2015 06:51:12 +0200
Original-Received: by pdfx2 with SMTP id x2sf220713186pdf.2
        for <gclcip-std-proposals@m.gmane.org>; Sat, 22 Aug 2015 21:51:11 -0700 (PDT)
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=7hzoWPZOkMNz6qbfjTFDeQ1JTpNxKSu6HdZJTMn6Oeo=;
        b=XGO83XbX/qcKfcaXGqMcMERNbmEPS2MJ1SVpTlbvYTy2P9ETbYWug37hIq1XMhfrsD
         5VIzYoNrSQKIem1b1AHymqDc8VDKiLwAMHsyk7U73zt/hpZciCy47i3uM+GZicshyQjL
         hTr9X8/y1JIBsbqqdAH7AlWnJhpoTe1gqwwmsVGS4KETlhVHs2jdyrtpzVKHWi0SHkrC
         Kfe/1rya5gQq07fN9PWB8nBE3CjZg3Vh5AZhqZKpGjBMYhMh+t0lm33as5WWLc/JY4XX
         J9fWycqxxivB7KVot+qDFn9n0i1/5L/rBelvoq6IkxiAeRdphB00uF0WyVVK9ydTiR/J
         FgQg==
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=7hzoWPZOkMNz6qbfjTFDeQ1JTpNxKSu6HdZJTMn6Oeo=;
        b=CfV931KMUVDogppOyfaMwsSktJcSx/cMXvP9dP5S4gP/hVgs43m4I1IOSiH4OmpdJj
         4sK3wfCt4ztnBnaFiiaGGmXYZeAqLQTr5RO5W0ZuVD0L22j32A8Zz5Z9NMBjIqeKt4Ox
         yo7S6vt0MLAnBqUR1oDX4uXQ1B4XOk9MNzEKFWy8ny9p76SkMF6F3X6qKuK0R7oiusbz
         /wxINGxuqFmYaon5nFtbawJ1qxSTwgXRtS4jIi82hCDNbbsm6ogMXLjjqcuoPDDqbcyk
         R1X2G15aUH7kH3hp0XKEWsALExWJHhcObCV5fpqSrOID/ehCL9MAXZiIqwmkowWnmY4V
         2eAQ==
X-Gm-Message-State: ALoCoQk/xLYhEt5nPWAutI7qMR6cRVngPlrtdAaNi6WOUlPaqD/FDTqxS1vRnC04QS3R605rv0jA
X-Received: by 10.68.104.161 with SMTP id gf1mr15363183pbb.11.1440305471240;
        Sat, 22 Aug 2015 21:51:11 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.31.148 with SMTP id f142ls529605iof.72.gmail; Sat, 22 Aug
 2015 21:51:10 -0700 (PDT)
X-Received: by 10.50.4.72 with SMTP id i8mr160835igi.7.1440305470273;
        Sat, 22 Aug 2015 21:51:10 -0700 (PDT)
X-Original-Sender: darylew@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:19973
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19973>

------=_Part_834_813212632.1440305468854
Content-Type: multipart/alternative; 
	boundary="----=_Part_835_2132862396.1440305468855"

------=_Part_835_2132862396.1440305468855
Content-Type: text/plain; charset=UTF-8

I recently saw descriptions of GCD and LCM as part of the Library 
Fundamentals v2 paper (N4529), the original paper (N4601), and 
cppreference.com. I'm wondering if those functions should take variable 
numbers of arguments. I mean like:

<typename T>
constexpr T gcd(T x);  // returns |x|
<typename T, typename U>
constexpr common_type_t<T, U> gcd(T x, U y);  // current definition
<typename T, typename U, typename V, typename... W>
constexpr common_type_t<T, U, V, W...> gcd(T x, U y, V z, W ...a);  // 
returns gcd(x, gcd(y, z, a...))


// And similar for "lcm"


Good idea?...

-- 

--- 
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_835_2132862396.1440305468855
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I recently saw descriptions of GCD and LCM as part of the =
Library Fundamentals v2 paper (N4529), the original paper (N4601), and cppr=
eference.com. I&#39;m wondering if those functions should take variable num=
bers of arguments. I mean like:<div><br></div><div class=3D"prettyprint" st=
yle=3D"background-color: rgb(250, 250, 250); border: 1px solid rgb(187, 187=
, 187); word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"s=
ubprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">&l=
t;typename</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #606;" class=3D"styled-by-prettify">T</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">&gt;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>constexpr T gcd(T x)=
; =C2=A0// returns |x|<br></span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">&lt;typename</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">T</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
, </span><span style=3D"color: #606;" class=3D"styled-by-prettify">typename=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">U</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">&gt;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>constexpr common_type_t</span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">&lt;T</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">, </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">U</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> gcd(T x, U y); =C2=A0// current definition=
<br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">&lt;ty=
pename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #606;" class=3D"styled-by-prettify">T</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">, </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">U</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">, </span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">V</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>, </span><span style=3D"color: #606;" class=3D"styled-by-prettify">typenam=
e</span><span style=3D"color: #000;" class=3D"styled-by-prettify">... </spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">W</span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>constexpr common_type_t<=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">&lt;T</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">, </span><span s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">U</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">, </span><span style=3D"color: #6=
06;" class=3D"styled-by-prettify">V</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">, </span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">W</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">...</span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> gcd(=
T x, U y, V z, W ...a); =C2=A0// returns gcd(x, gcd(y, z, a...))<br><br><br=
>// And similar for &quot;lcm&quot;<br></span></div></code></div><div><br><=
br></div><div>Good idea?...</div><div><br></div></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_835_2132862396.1440305468855--
------=_Part_834_813212632.1440305468854--

.
