220 10599 <67EC0741-C576-4E2B-AA57-04D7280DEEB5@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: overloading on function template parameters that
 don't appear as function parameters
Date: Sat, 10 May 2014 16:07:32 +0800
Lines: 81
Approved: news@gmane.org
Message-ID: <67EC0741-C576-4E2B-AA57-04D7280DEEB5@gmail.com>
References: <536CDAF5.4020407@wanadoo.fr>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_F54A9CD0-A87B-40BD-BA80-F2974602C7BB"
X-Trace: ger.gmane.org 1399709268 18069 80.91.229.3 (10 May 2014 08:07:48 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sat, 10 May 2014 08:07:48 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBSV4W6NQKGQEUNTKUOA@isocpp.org Sat May 10 10:07:40 2014
Return-path: <std-proposals+bncBCW25A7E3QCRBSV4W6NQKGQEUNTKUOA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ve0-f197.google.com ([209.85.128.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBSV4W6NQKGQEUNTKUOA@isocpp.org>)
	id 1Wj2Jo-0006Fp-9V
	for gclcip-std-proposals@m.gmane.org; Sat, 10 May 2014 10:07:40 +0200
Original-Received: by mail-ve0-f197.google.com with SMTP id db11sf16948924veb.0
        for <gclcip-std-proposals@m.gmane.org>; Sat, 10 May 2014 01:07:39 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:message-id:mime-version:subject:date
         :references:to:in-reply-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:content-type;
        bh=qBYv77Q5YTN2OCBUBjhfErPqmeuLDBD5v2tBgagQzsU=;
        b=Kq+uouOfYOIUsVj4WkNpwvU+ty1mBb/cBrvCxWVO9ix9Ja3wUKPaMaViUqUHBLxgTN
         Edgm5u1fWVmY8B96EzkNMC91EiPIUNPL+W9UhFoWSErukQFaV/OGar0oNV/majQRwUFZ
         tbHH33ixuAeK9KnXHRz82s5zTeMS9dGqU4UMIK662p3yBwtxw6kq+BhE82RqALn53liC
         j+d9+kDjYU4+85ituiBHFhj+3cKNRyPX64WaeQJGhyS7/M5gOOgQjAW4gHImxan8YVJZ
         FpU3A74ZNXyJw/e0CemMgRNrYQAmgH7gj+I4MKRz0l8Gs7ryQPa5PZlxjHTlzsOybCW2
         zA1w==
X-Gm-Message-State: ALoCoQmBaVY3WdFR97dhxumcCoq5hstHsl27SDRZnJBT/yx4tG5x7QIV9whKyUaOMSRXRnO/NX3f
X-Received: by 10.236.109.169 with SMTP id s29mr6648736yhg.43.1399709259482;
        Sat, 10 May 2014 01:07:39 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.11.4 with SMTP id m4ls818385igb.4.gmail; Sat, 10 May 2014
 01:07:38 -0700 (PDT)
X-Received: by 10.50.111.138 with SMTP id ii10mr18650796igb.34.1399709258420;
        Sat, 10 May 2014 01:07:38 -0700 (PDT)
Original-Received: from mail-ie0-x231.google.com (mail-ie0-x231.google.com [2607:f8b0:4001:c03::231])
        by mx.google.com with ESMTPS id qd1si2471728igb.20.2014.05.10.01.07.38
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 10 May 2014 01:07:38 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:4001:c03::231 as permitted sender) client-ip=2607:f8b0:4001:c03::231;
Original-Received: by mail-ie0-f177.google.com with SMTP id rp18so4751971iec.8
        for <std-proposals@isocpp.org>; Sat, 10 May 2014 01:07:38 -0700 (PDT)
X-Received: by 10.50.112.202 with SMTP id is10mr18570389igb.7.1399709258260;
        Sat, 10 May 2014 01:07:38 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.150])
        by mx.google.com with ESMTPSA id u2sm5026696igs.10.2014.05.10.01.07.35
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Sat, 10 May 2014 01:07:37 -0700 (PDT)
In-Reply-To: <536CDAF5.4020407@wanadoo.fr>
X-Mailer: Apple Mail (2.1874)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:4001:c03::231 as permitted
 sender) smtp.mail=potswa@gmail.com;       dkim=pass header.i=@gmail.com;
       dmarc=pass (p=NONE 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-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: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:10599
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/10599>

--Apple-Mail=_F54A9CD0-A87B-40BD-BA80-F2974602C7BB
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On 2014-05-09, at 9:41 PM, Vicente J. Botet Escriba <vicente.botet@wanadoo.=
fr> wrote:

> Is this the correct way to define this generic interface?

I don't think it's generic at all. exception_ptr is a different animal from=
 exception, so make_error should not be able to produce both.

> Do you see any failures I have not identified in the design?
> Do you know of a better way to manage with this kind of factory functions=
?

You seem to have reinvented tag dispatching. In general, a function templat=
e with "partial specializations" will need some form of dispatching, either=
 by tags or SFINAE, and either at the interface overload set or behind a di=
spatcher wrapper function as you did.

None of this seems like a big deal to me. On one hand, you hit a case where=
 you want function template partial specialization. On the other hand, in t=
his case it's a code smell that the interface is overextended.

--=20

---=20
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 e=
mail 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-proposa=
ls/.

--Apple-Mail=_F54A9CD0-A87B-40BD-BA80-F2974602C7BB
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;05&ndash;09, at 9:41 PM, Vicente J. Botet Escriba &lt;<a href=3D"mail=
to:vicente.botet@wanadoo.fr">vicente.botet@wanadoo.fr</a>&gt; wrote:</div><=
br class=3D"Apple-interchange-newline"><blockquote type=3D"cite">Is this th=
e correct way to define this generic interface?<br></blockquote><div><br></=
div><div>I don&rsquo;t think it&rsquo;s generic at all.&nbsp;<font face=3D"=
Courier">exception_ptr</font> is a different animal from&nbsp;<font face=3D=
"Courier">exception</font>, so <font face=3D"Courier">make_error</font> sho=
uld not be able to produce both.</div><br><blockquote type=3D"cite">Do you =
see any failures I have not identified in the design?<br>Do you know of a b=
etter way to manage with this kind of factory functions?<br></blockquote><d=
iv><br></div><div>You seem to have reinvented tag dispatching. In general, =
a function template with &ldquo;partial specializations&rdquo; will need so=
me form of dispatching, either by tags or SFINAE, and either at the interfa=
ce overload set or behind a dispatcher wrapper function as you did.</div></=
div><br><div>None of this seems like a big deal to me. On one hand, you hit=
 a case where you want function template partial specialization. On the oth=
er hand, in this case it&rsquo;s a code smell that the interface is overext=
ended.</div><div><br></div></body></html>

<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 />

--Apple-Mail=_F54A9CD0-A87B-40BD-BA80-F2974602C7BB--

.
