220 17473 <9a923017-a97e-4bed-bcf3-decabf30ecae@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Columbo <r.hl@gmx.net>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: In-class definition of pure virtual functions
Date: Thu, 23 Apr 2015 03:27:59 -0700 (PDT)
Lines: 157
Approved: news@gmane.org
Message-ID: <9a923017-a97e-4bed-bcf3-decabf30ecae@isocpp.org>
References: <eec88219-93b2-4c36-b4b2-8c7aa96afa60@isocpp.org>
 <55377A89.7000807@gmail.com>
 <06dcb70f-d339-477f-9b03-38e4e57c90da@isocpp.org>
 <CAGg_6+PRfC1qegoXMEPhgSCM6uO3dVkxH+uLjNAOY3JOR-WvOQ@mail.gmail.com>
 <CANu6V4WmWstk0txR6iXuu_oqDDexOViV2-1Yfzk5z8PEG=TOZw@mail.gmail.com>
 <CAGg_6+ObH-qe+P1ss+vV2MpAsQF5qJsEoEATR7CBo+6DJSq2mQ@mail.gmail.com>
 <CANu6V4WK_hMKt+dgRJpJu2FPGxFEoGU96P07KFMbNW+SwwLimw@mail.gmail.com>
 <CAGg_6+N+gXTH99af6TaDXTh6OHzKafz7G4_E9tCzzMcUVBC1dg@mail.gmail.com>
 <CANu6V4XWnoWdjZzjtYYyeQg1xSaBr9CJ8oHOMsOOF-yB+5L9Qg@mail.gmail.com>
 <CAD6_Qj9chFt5mLs8HaKoJFesx2Jz65Whw2YOVH0vpZA5PsYSzQ@mail.gmail.com>
 <CANu6V4VnbPGXxoGyiwb5WuZBxxFKQqrzZGLY7A9oCAhb2wj_8w@mail.gmail.com>
 <CAD6_Qj-LDzqueQg8dk4QFZ0kAV-7wZNpb5+xEhxRbEUaC03Qqw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_207_712141927.1429784879451"
X-Trace: ger.gmane.org 1429784884 24930 80.91.229.3 (23 Apr 2015 10:28:04 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 23 Apr 2015 10:28:04 +0000 (UTC)
Cc: dibeas@ieee.org
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDRN5RPSR4MRBMES4OUQKGQEVM3HCIQ@isocpp.org Thu Apr 23 12:28:03 2015
Return-path: <std-proposals+bncBDRN5RPSR4MRBMES4OUQKGQEVM3HCIQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vn0-f70.google.com ([209.85.216.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDRN5RPSR4MRBMES4OUQKGQEVM3HCIQ@isocpp.org>)
	id 1YlEMV-00028S-42
	for gclcip-std-proposals@m.gmane.org; Thu, 23 Apr 2015 12:28:03 +0200
Original-Received: by vnbf1 with SMTP id f1sf5498355vnb.1
        for <gclcip-std-proposals@m.gmane.org>; Thu, 23 Apr 2015 03:28:01 -0700 (PDT)
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:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=SqEThxr3AMPfAxWDxd3g9+iYG1JAmMZI0rj8ZVaY8Lo=;
        b=iLaTqfsx/vhtmyqoP45qzYDAyUIynXQzkX7CFBR+PwmGLOgEGi/afOHfywWMjee5XU
         tKqhlJjE+oIl5WQAf/3N1eF8zLR+Y9Uf1wrhj2RZxHdWinnw5SgwTNQ8jkIGcVOQM0fj
         rFxab8MffwWhz1E+YwR3+6Bky5qrikVhmTso2k++NwIACdSmoAj2RfKulgy1SvIRXcsm
         J+fPN/WQit+6oUCqP7zBKLiZPjCzOqRu1CLZzC65jlObf7UNkcyeRTDOE5JhRkfJm6BN
         9PbgyNMcjlQOC7aKxRsGcnQoWiUgfnbSVTdMg5JaDWM19jB7iNMHGPQ6kaK7M9/+ALOw
         j99g==
X-Gm-Message-State: ALoCoQnDNsSp6l55Om+qwwiWbO9bMJzSZJxuKYGEFiuYBANqru4GST4PdeJCMGrdNdm82e2jfmiX
X-Received: by 10.236.199.72 with SMTP id w48mr2849530yhn.58.1429784881284;
        Thu, 23 Apr 2015 03:28:01 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.86.72 with SMTP id o66ls1104362qgd.6.gmail; Thu, 23 Apr
 2015 03:28:00 -0700 (PDT)
X-Received: by 10.140.93.226 with SMTP id d89mr22278qge.38.1429784880341;
        Thu, 23 Apr 2015 03:28:00 -0700 (PDT)
In-Reply-To: <CAD6_Qj-LDzqueQg8dk4QFZ0kAV-7wZNpb5+xEhxRbEUaC03Qqw@mail.gmail.com>
X-Original-Sender: R.HL@gmx.net
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: <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:17473
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/17473>

------=_Part_207_712141927.1429784879451
Content-Type: multipart/alternative; 
	boundary="----=_Part_208_1043002358.1429784879451"

------=_Part_208_1043002358.1429784879451
Content-Type: text/plain; charset=UTF-8

Let me get this straight. The only (substantial) difference between
struct A1 { virtual void f(); };
and 
struct A2 { virtual void f() = 0; }
is that A2 is *abstract* and derived classes are forced to override and 
define f to be able to be a most-derived class - right? However, I can 
provide an in-class definition for A1::foo:
struct A1 { virtual void f(){} };
7.1.2/3 specifies that this is equivalent to
struct A1 { virtual void f(); };
inline void A1::f() {}
So this would cause the same problems as
struct A1 { virtual void f() = 0 {}; };
However, for the sake of consistency, even though in-class definitions 
might not be optimal - wouldn't it still be feasible to make those 
available for pure virtual functions?
Assuredly there is a reason that VC++ allows this?

-- 

--- 
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_208_1043002358.1429784879451
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Let me get this straight. The only (substantial) differenc=
e between<br><div class=3D"prettyprint" style=3D"background-color: rgb(250,=
 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-w=
idth: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
A1 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">virtual</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> f</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">();</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br></span></div></code></div>and <br><div class=3D"prettyprint" style=3D"b=
ackground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bord=
er-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"=
prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> A2 </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
virtual</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">void</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> f</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"styl=
ed-by-prettify">0</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></c=
ode></div>is that A2 is <i>abstract</i> and derived classes are forced to o=
verride and define f to be able to be a most-derived class - right? However=
, I can provide an in-class definition for A1::foo:<br><div class=3D"pretty=
print" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187=
, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;=
"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> A1 </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">virtual</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> f<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(){}</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span></div></code></div>7.1.=
2/3 specifies that this is equivalent to<br><div class=3D"prettyprint" styl=
e=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187)=
; border-style: solid; border-width: 1px; word-wrap: break-word;"><code cla=
ss=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008=
;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> A1 </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">virtual</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">void</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> f</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">();</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">inline</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">void</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> A1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">f</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">()</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">{}</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span></div></code></div>So this would=
 cause the same problems <code>as</code><code class=3D"prettyprint"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br></span></code><div c=
lass=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-=
color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wra=
p: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><=
span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> A1 </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">virtual</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">void</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> f</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">{};</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span></div></code></div>However, for the sake of consistency, =
even though in-class definitions might not be optimal - wouldn't it still b=
e feasible to make those available for pure virtual functions?<br>Assuredly=
 there is a reason that VC++ allows this?<br><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_208_1043002358.1429784879451--
------=_Part_207_712141927.1429784879451--

.
