220 22822 <91a92c5c-60fe-4d94-b831-cd940cd3e56a@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: interface constraints for a template
Date: Sun, 22 Nov 2015 07:56:32 -0800 (PST)
Lines: 82
Approved: news@gmane.org
Message-ID: <91a92c5c-60fe-4d94-b831-cd940cd3e56a@isocpp.org>
References: <58bd5a73-1b31-45cf-8141-eb01093417ea@isocpp.org>
 <48aa536a-b112-4f40-96cc-7625e233d244@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_53_1034410841.1448207792197"
X-Trace: ger.gmane.org 1448207800 28918 80.91.229.3 (22 Nov 2015 15:56:40 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Sun, 22 Nov 2015 15:56:40 +0000 (UTC)
Cc: sergeikrivonos@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBMOLY6ZAKGQEWFB7QXQ@isocpp.org Sun Nov 22 16:56:36 2015
Return-path: <std-proposals+bncBCEKFTV6ZUMBBMOLY6ZAKGQEWFB7QXQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f71.google.com ([209.85.220.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBMOLY6ZAKGQEWFB7QXQ@isocpp.org>)
	id 1a0X0E-0006Ze-Nz
	for gclcip-std-proposals@m.gmane.org; Sun, 22 Nov 2015 16:56:34 +0100
Original-Received: by pacej9 with SMTP id ej9sf5208086pac.0
        for <gclcip-std-proposals@m.gmane.org>; Sun, 22 Nov 2015 07:56:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references: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=XiJPbgCoLKSUcskFJY36kzfKAFMtzKRXv7kx8fP3Wh4=;
        b=lfV5HlD444pmGy+uGq3cqymTIVqF7aPMeodcobhv8rT/a1l5OSjwCG3EhCjXQul2C6
         FW+IUdU6BjQLDbt/LvwrGmqk1ckceWgORgwnrfA+02fyT8VzI847A2hF81LhDWopHrJB
         2bkXmDj+dCt+SrPAumqHK/beCeyho+JhzA7Lyi4ckuNPeLVyDcofw8MSRSaHRJEZQA95
         cSi3iDpZI1h0ZPvn5NoDMDita+LEZGKTkOheUHuc4tT2WBdCC8WAu4TphJEQYRArwIPN
         xjeL7O4MmLZlpIw+XEht+EoxQltUZ+5MoJTAWGaItHesuYuBUpocxW/8w2dsG8WrTCCz
         +QUQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references: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=XiJPbgCoLKSUcskFJY36kzfKAFMtzKRXv7kx8fP3Wh4=;
        b=uXbb1CLLa3wHVWaYD2AFCpYcB3LRO6fLiNSxLZaubs8kH4JidO+dDb7VOaSVq9K4/k
         ejQxcR3/m55sxydmCIXv6LKrVqCbToFKzOKO7/KC6fiDoBTN61ymWwFPV0gNY9oczF0F
         fxrCjo0uK3OlumbS6nLTjjrIB+QIqJX0Lv4xfeGLhfF4mp9/I2OoYQ0daLxZCeKJoQqu
         YWBUe2vE1CUFKmmQ2R7YUNkSOLwVnHlvQYk6i66NFpq86VTuguhN3fnVOxiugFwUJ2xc
         57zLS+h9jUNVhoVX5MbulyiVMTO+GdhMqON6aZuQ1oZ1n0/Vf1bttaclhKQANt/U+ilj
         e9KQ==
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:cc:message-id:in-reply-to
         :references: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=XiJPbgCoLKSUcskFJY36kzfKAFMtzKRXv7kx8fP3Wh4=;
        b=lN5DAyVbn1uWwZTTm87zu+IGKkO69Kt5TBpB3jLUfy4Z9UpuJ2PXg3/0/g05O8mRSP
         4InA88k4vYzQB9E4DNb63UkgzcJ+SItUPFcBr5wmGdsYP1t0eqn9IV/R+AUHSntIRGkX
         xMsfIAXLp5fFMeTUX+MJs++nyB39sneEYSSavRzXqBhhqBVfHLAxdfBV26ZwW/5WtqQc
         VfXXJYqdAlYKxOhXP6UOHcKQYcyk/i7/N8833Eax3vcwaLzIIXZ8fGiSGAMryYWFi3hx
         Gv4we73bDNZRej/xalYOchW5DvD2DjhDHTHS9r62UIofGRHtT8kKIqBHRJ4dJYbgXs6Y
         rhVA==
X-Gm-Message-State: ALoCoQnuLCYP/PD+BdsITOPJip5loHRXMiMn89+yvB3IArLTV+ZvnDMWWrV1cPvH0qASMp8EKxQX
X-Received: by 10.66.124.196 with SMTP id mk4mr20549307pab.23.1448207793985;
        Sun, 22 Nov 2015 07:56:33 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.128.94 with SMTP id b91ls1297677iod.95.gmail; Sun, 22 Nov
 2015 07:56:33 -0800 (PST)
X-Received: by 10.50.20.162 with SMTP id o2mr235563ige.7.1448207793278;
        Sun, 22 Nov 2015 07:56:33 -0800 (PST)
In-Reply-To: <48aa536a-b112-4f40-96cc-7625e233d244@isocpp.org>
X-Original-Sender: jmckesson@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:22822
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/22822>

------=_Part_53_1034410841.1448207792197
Content-Type: multipart/alternative; 
	boundary="----=_Part_54_704085495.1448207792197"

------=_Part_54_704085495.1448207792197
Content-Type: text/plain; charset=UTF-8



On Sunday, November 22, 2015 at 10:55:28 AM UTC-5, Nicol Bolas wrote:
>
> We call those `concepts 
> <http://en.cppreference.com/w/cpp/language/constraints>`.
>
> However, I think it's silly to constrain a function based on a base class. 
> Constrain it based on the *interface* provided by that base class. Why 
> does it matter if the user derived from that class or not? What matters is 
> whether the class they provide offers the proper interface?
>
> If you wanted to constrain the parameter on a base class, you should take 
> the base class itself as a parameter and not use a template parameter at 
> all.
>

Not to mention, you're using a *virtual function*. The whole point of that 
is that you can call it from a base class pointer and get a call to the 
method in the derived class. Using template polymorphism on top of virtual 
polymorphism makes no sense.

-- 

--- 
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_54_704085495.1448207792197
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<br><br>On Sunday, November 22, 2015 at 10:55:28 AM UTC-5, Nicol Bolas wrot=
e:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;b=
order-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">We call tho=
se `<a href=3D"http://en.cppreference.com/w/cpp/language/constraints" targe=
t=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.go=
ogle.com/url?q\75http%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Flanguage%2Fco=
nstraints\46sa\75D\46sntz\0751\46usg\75AFQjCNFpVVvWH2Yf7orQMnYg0VVlbsWVpw&#=
39;;return true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\7=
5http%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Flanguage%2Fconstraints\46sa\7=
5D\46sntz\0751\46usg\75AFQjCNFpVVvWH2Yf7orQMnYg0VVlbsWVpw&#39;;return true;=
">concepts</a>`.<br><br>However, I think it&#39;s silly to constrain a func=
tion based on a base class. Constrain it based on the <i>interface</i> prov=
ided by that base class. Why does it matter if the user derived from that c=
lass or not? What matters is whether the class they provide offers the prop=
er interface?<br><br>If you wanted to constrain the parameter on a base cla=
ss, you should take the base class itself as a parameter and not use a temp=
late parameter at all.<br></div></blockquote><div><br>Not to mention, you&#=
39;re using a <i>virtual function</i>. The whole point of that is that you =
can call it from a base class pointer and get a call to the method in the d=
erived class. Using template polymorphism on top of virtual polymorphism ma=
kes no sense.<br></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_54_704085495.1448207792197--
------=_Part_53_1034410841.1448207792197--

.
