Topic: Polymorphism-agnostic programming" via terse syntax
Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Sun, 24 Dec 2017 13:24:50 -0800 (PST)
Raw View
------=_Part_14355_1373992596.1514150690132
Content-Type: multipart/alternative;
boundary="----=_Part_14356_1638374437.1514150690134"
------=_Part_14356_1638374437.1514150690134
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
I have recently become interested in the possibility of using Concepts=20
terse syntax to enable a sort of "polymorphism-agnostic" coding style,=20
where for example
bool is_highway_safe(const Vehicle& v)
{
return v.wheels() >=3D 4;
}
can be either a classically-polymorphic-function or a tersely defined=20
generic-function-template, depending on the definition of `Vehicle` e.g. in=
=20
a header file.
Here's a trivial example:
https://wandbox.org/permlink/IvShMRyVnwU7Uvuo
#define IFP(...) // or reverse these
#define IFG(...) __VA_ARGS__ // or reverse these
IFG(
template<class V>
concept bool Vehicle =3D requires(const V& v) {
{ v.wheels() } -> int;=20
};
)
IFP(
struct Vehicle {
virtual int wheels() const =3D 0;
};
)
struct Car IFP(: public Vehicle) {
int wheels() const IFP(override) { return 4; }
};
struct Bike IFP(: public Vehicle) {
int wheels() const IFP(override) { return 2; }
};
bool is_highway_safe(const Vehicle& v) {
return v.wheels() >=3D 4;
}
int main() {
Car c;
Bike b;
assert(is_highway_safe(c));
assert(not is_highway_safe(b));
}
If I could extend this programming style all the way out to e.g. the=20
definitions of class (template) member functions, then I'd have something=
=20
pretty cool. Unfortunately, it seems that the terse syntax for *function=
=20
templates* does not generalize to a terse syntax for member *functions of=
=20
class templates*. Example:
https://wandbox.org/permlink/YUeWRVhNDR0FAunf
IFP(
struct DemolitionDerby {
using V1 =3D Vehicle;
using V2 =3D Vehicle;
)
IFG(
template<Vehicle V1, Vehicle V2>
struct DemolitionDerby {
)
V1 *v1;
V2 *v2;
DemolitionDerby(V1& v1, V2& v2) : v1(&v1), v2(&v2) {}
int winner() const;
};
=20
IFG(template<class V1, class V2>)
int DemolitionDerby IFG(<V1,V2>) ::winner() const {
return v1->wheels() > v2->wheels() ? 1 : 2;
}
int main() {
Car c;
Bike b;
DemolitionDerby dd(b, c);
assert(dd.winner() =3D=3D 2);
}
Does anyone see a way to harmonize this latter example, so that it doesn't=
=20
need so much IFG(...) boilerplate? Ideally the amount of boilerplate=20
required would be O(1), just on the class definition, and not on any of the=
=20
member function definitions; then I could take my existing=20
classically-polymorphic codebase and recompile it with O(1) effort to=20
produce a generic-programming templated version.
(Please assume that this would in fact be a good idea in my case, and=20
wouldn't run into any really deep architectural problems. I'm aware that if=
=20
my original code's Vehicle *v1, *v2; had been Vehicle *vs[2]; instead, I'd=
=20
have had serious problems. Let's assume that either I don't have such=20
problems, or I'm willing to do the design work to patch them up; I'm just=
=20
unwilling to maintain a codebase containing so many instances of=20
IFP()/IFG().)
Basically, if we *assume for the sake of argument* that C++2a is going to=
=20
get something like Concepts TS terse syntax, then I'd like to explore, in=
=20
this thread, what other syntactic innovations would be necessary in order=
=20
to make my DemolitionDerby example look cleaner.
=E2=80=93Arthur
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/5ec84628-4acf-4f40-83ce-4734f049aa7f%40isocpp.or=
g.
------=_Part_14356_1638374437.1514150690134
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div style=3D"font-family: arial, sans-serif;">I have rece=
ntly become interested in the possibility of using Concepts terse syntax to=
enable a sort of "polymorphism-agnostic" coding style, where for=
example</div><div style=3D"font-family: arial, sans-serif;"><br></div><div=
style=3D"font-family: arial, sans-serif;"><div>=C2=A0 =C2=A0 bool is_highw=
ay_safe(const Vehicle& v)</div><div>=C2=A0 =C2=A0 {</div><div>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 return v.wheels() >=3D 4;</div><div>=C2=A0 =C2=A0 }=
<span class=3D"sewz9cbuys30qp"></span><span class=3D"sewhnp14sd8jmtw"></spa=
n></div></div><div style=3D"font-family: arial, sans-serif;"><br></div><div=
style=3D"font-family: arial, sans-serif;">can be either a classically-poly=
morphic-function or a tersely defined generic-function-template, depending =
on the definition of `Vehicle` e.g. in a header file.</div><div style=3D"fo=
nt-family: arial, sans-serif;"><br></div><div style=3D"font-family: arial, =
sans-serif;">Here's a trivial example:</div><div style=3D"font-family: =
arial, sans-serif;"><a href=3D"https://wandbox.org/permlink/IvShMRyVnwU7Uvu=
o" style=3D"color: rgb(17, 85, 204);">https://wandbox.org/permlink/IvShMRyV=
nwU7Uvuo</a><span class=3D"sewz9cbuys30qp"></span><span class=3D"sewhnp14sd=
8jmtw"></span><br></div><div style=3D"font-family: arial, sans-serif;"><br>=
</div><div style=3D"font-family: arial, sans-serif;"><div class=3D"prettypr=
int" style=3D"background-color: rgb(250, 250, 250); border: 1px solid rgb(1=
87, 187, 187); word-wrap: break-word;"><code class=3D"prettyprint"><div cla=
ss=3D"subprettyprint"><span style=3D"color: #800;" class=3D"styled-by-prett=
ify">#define</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> IFP</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(...=
)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: #800;=
" class=3D"styled-by-prettify">// or reverse these</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">#define</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> IFG</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(...)</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> __VA_ARGS__ =C2=A0</span><span style=3D"color: #800;" =
class=3D"styled-by-prettify">// or reverse these</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br><br>IFG</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;" class=
=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> V</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">concept=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">bool</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">Vehicle</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> requires</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">const</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> V</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">&</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> v<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><sp=
an 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"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> v</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">wheels</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </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"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">int</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> <br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>IFP</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Vehicle</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;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #0=
08;" 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">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> wheels</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">con=
st</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">Car</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> IFP</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(:</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">public</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-b=
y-prettify">Vehicle</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">)</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"><br>=C2=A0 =C2=A0 =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> wheels</span><sp=
an 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">const</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> IFP</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">override</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">return</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #066;" class=3D"styled-by-prettify">4</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: #660;" class=3D"style=
d-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">Bike</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> IFP</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(:</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">public</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">Vehicle</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> wheels</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: #008=
;" class=3D"styled-by-prettify">const</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> IFP</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">override</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"styled-by-prettify">{</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">return</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">2</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"styled-by=
-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">bool</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> is_highway_safe</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">Vehicle</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> v</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><font color=3D"#000000"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span></font><span style=3D"color:=
#660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">return</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> v</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">wheels</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">()</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">>=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #066;" class=3D"styled-by-prettify">4</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> main</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">()</span><font color=3D"#000000"><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span></font><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" clas=
s=3D"styled-by-prettify">Car</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> c</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">Bike</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> b</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">assert=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">is_highway_safe</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">c</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">));</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">assert</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">not</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> is_highway_safe</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">b</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">));</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}=
</span></div></code></div><div><br></div><div><br></div></div><div style=3D=
"font-family: arial, sans-serif;">If I could extend this programming style =
all the way out to e.g. the definitions of class (template) member function=
s, then I'd have something pretty cool. =C2=A0Unfortunately, it seems t=
hat the terse syntax for=C2=A0<i>function templates</i>=C2=A0does not gener=
alize to a terse syntax for member=C2=A0<i>functions of class templates</i>=
.. Example:</div><div style=3D"font-family: arial, sans-serif;"><a href=3D"h=
ttps://wandbox.org/permlink/YUeWRVhNDR0FAunf" style=3D"color: rgb(17, 85, 2=
04);">https://wandbox.org/permlink/YUeWRVhNDR0FAunf</a></div><div style=3D"=
font-family: arial, sans-serif;"><br></div><div style=3D"font-family: arial=
, sans-serif;"><div class=3D"prettyprint" style=3D"background-color: rgb(25=
0, 250, 250); border: 1px solid rgb(187, 187, 187); word-wrap: break-word;"=
><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">IFP</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">DemolitionDerby</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">using</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
V1 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">Vehicle</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> V2 </span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">Vehicle</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>IF=
G</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">template</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"=
color: #606;" class=3D"styled-by-prettify">Vehicle</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> V1</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: #606;" class=3D"style=
d-by-prettify">Vehicle</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> V2</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">DemolitionDerby</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 V1 </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">*</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">v1</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>=C2=A0 =C2=A0 V2 </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">v2</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">DemolitionDerby</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">V1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> v1</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> V2</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> v2</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"styled-by=
-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> v1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(&=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">v1</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">),</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> v2</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(&</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">v2</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>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> winner</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">const</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 <br>IFG</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> V1</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> V=
2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>)</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">DemolitionDerby</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> IFG</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">(<</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">V1</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">V2</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">>)</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">winner</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: #008;" class=3D"styled-by-prettify">const</span><font color=3D"#000000"=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></font><=
span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">return</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> v1</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">-></span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">wheels</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=
"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> v2</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">-></span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">wheels</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"styled-by-prettify">?</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">1</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-b=
y-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettif=
y">2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> main</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">()</span><font color=3D"#000000"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span></font><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">Car</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> c</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">Bike</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> b</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">DemolitionDerby</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> dd</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">b</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> c</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">assert</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">dd</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">winner</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">=3D=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">2</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code></div><=
div><br></div></div><div style=3D"font-family: arial, sans-serif;"><br></di=
v><div><span style=3D"font-family: arial, sans-serif;">Does anyone see a wa=
y to harmonize this latter example, so that it doesn't need so much IFG=
(...) boilerplate? =C2=A0Ideally the amount of boilerplate required would b=
e O(1), just on the class definition, and not on any of the member function=
definitions; then I could take my existing classically-polymorphic codebas=
e and recompile it with O(1) effort to produce a generic-programming templa=
ted version.</span></div><div><span style=3D"font-family: arial, sans-serif=
;"><br></span></div><div><span style=3D"font-family: arial, sans-serif;">(P=
lease assume that this would in fact be a good idea in my case, and wouldn&=
#39;t run into any really deep architectural problems. I'm aware that i=
f my original code's=C2=A0</span><font face=3D"courier new, monospace">=
Vehicle *v1, *v2;</font><font face=3D"arial, sans-serif"> had been </font><=
font face=3D"courier new, monospace">Vehicle *vs[2];</font><font face=3D"ar=
ial, sans-serif"> instead, I'd have had serious problems. Let's ass=
ume that either I don't have such problems, or I'm willing to do th=
e design work to patch them up; I'm just unwilling to maintain a codeba=
se containing so many instances of IFP()/IFG().)</font></div><div><font fac=
e=3D"arial, sans-serif"><br></font></div><div><font face=3D"arial, sans-ser=
if">Basically, if we <i><b>assume for the sake of argument</b></i> that C++=
2a is going to get something like Concepts TS terse syntax, then I'd li=
ke to explore, in this thread, what other syntactic innovations would be ne=
cessary in order to make my </font><font face=3D"courier new, monospace">De=
molitionDerby</font><font face=3D"arial, sans-serif"> example look cleaner.=
</font></div><div><font face=3D"arial, sans-serif"><br></font></div><div><s=
pan style=3D"font-family: arial, sans-serif;">=E2=80=93Arthur</span><br></d=
iv></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/5ec84628-4acf-4f40-83ce-4734f049aa7f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5ec84628-4acf-4f40-83ce-4734f049aa7f=
%40isocpp.org</a>.<br />
------=_Part_14356_1638374437.1514150690134--
------=_Part_14355_1373992596.1514150690132--
.
Author: Laurent LA RIZZA <the.ultimate.koala@gmail.com>
Date: Sun, 24 Dec 2017 14:54:43 -0800 (PST)
Raw View
------=_Part_14143_125732042.1514156083559
Content-Type: multipart/alternative;
boundary="----=_Part_14144_187475080.1514156083560"
------=_Part_14144_187475080.1514156083560
Content-Type: text/plain; charset="UTF-8"
Just for the sake of homogeneity, you could start by rewriting the
beginning as :
IFG(template<Vehicle V1, Vehicle V2>)
struct DemolitionDerby {
IFP(
using V1 = Vehicle;
using V2 = Vehicle;
)
If I understand well, "making cleaner" mens you want to actually hide
whether you're using a concept or an interface to abstract your Vehicle
types and have some vocabulary that means "Abstract N types either through
interfaces or concepts".
Then, in the concepts case, since you'll eventually hide the concepts
syntax, do you really need terse syntax? The following works :
IFG(template<class V1, class V2>
requires Vehicle<V1> && Vehicle<V2>
)
int DemolitionDerby IFG(<V1,V2>) ::winner() const
{
return v1->wheels() > v2->wheels() ? 1 : 2;
}
and is consistent with:
IFG(template<class V1, class V2>
requires Vehicle<V1> && Vehicle<V2>
)
struct DemolitionDerby {
IFP(
using V1 = Vehicle;
using V2 = Vehicle;
)
Does this help?
--
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/e275706f-289f-4b4c-a61a-3cba684293fd%40isocpp.org.
------=_Part_14144_187475080.1514156083560
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Just for the sake of homogeneity, you could start by rewri=
ting the beginning as :<br><br><code><span style=3D"color:#000">IFG</span><=
span style=3D"color:#660">(</span><span style=3D"color:#000"></span><span s=
tyle=3D"color:#008">template</span><span style=3D"color:#660"><</span><s=
pan style=3D"color:#606">Vehicle</span><span style=3D"color:#000"> V1</span=
><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#606">Vehicle</span><span style=3D"color:#000"> V2</span><=
span style=3D"color:#660">></span><span style=3D"color:#000"></span><spa=
n style=3D"color:#008">)<br>struct</span><span style=3D"color:#000"> </span=
><span style=3D"color:#606">DemolitionDerby</span><span style=3D"color:#000=
"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br=
></span><span style=3D"color:#660"></span></code><code><span style=3D"color=
:#660"><code><span style=3D"color:#000">IFP</span><span style=3D"color:#660=
">(</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">=
</span></code></span></code><code><span style=3D"color:#660"><code><span st=
yle=3D"color:#000">=C2=A0 =C2=A0 </span><span style=3D"color:#008">using</s=
pan><span style=3D"color:#000"> V1 </span><span style=3D"color:#660">=3D</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#606">Vehicle</=
span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#008">using</span><span style=3D"col=
or:#000"> V2 </span><span style=3D"color:#660">=3D</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#606">Vehicle</span><span style=3D"co=
lor:#660">;</span><span style=3D"color:#000"><br></span><span style=3D"colo=
r:#660"></span></code>)</span><span style=3D"color:#000"><br></span></code>=
<br>If I understand well, "making cleaner" mens you want to actua=
lly hide whether you're using a concept or an interface to abstract you=
r Vehicle types and have some vocabulary that means "Abstract N types =
either through interfaces or concepts".<br><br>Then, in the concepts c=
ase, since you'll eventually hide the concepts syntax, do you really ne=
ed terse syntax? The following works :<br><br>IFG(template<class V1, cla=
ss V2><br>requires Vehicle<V1> && Vehicle<V2><br>)<b=
r>int DemolitionDerby IFG(<V1,V2>) ::winner() const<br>{<br>=C2=A0=C2=
=A0=C2=A0 return v1->wheels() > v2->wheels() ? 1 : 2;<br>}<br><br>=
and is consistent with:<br><br><code><span style=3D"color:#000">IFG</span><=
span style=3D"color:#660">(</span><span style=3D"color:#000"></span><span s=
tyle=3D"color:#008">template</span><span style=3D"color:#660"><class</sp=
an><span style=3D"color:#000"> V1</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> class</span><span style=3D"color:#000"> V2</spa=
n><span style=3D"color:#660">></span><span style=3D"color:#000"></span><=
span style=3D"color:#008"><br>requires Vehicle<V1> && Vehicle=
<V2><br>)<br>struct</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#606">DemolitionDerby</span><span style=3D"color:#000"> </span=
><span style=3D"color:#660">{</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#660"></span></code><code><span style=3D"color:#660"><c=
ode><span style=3D"color:#000">IFP</span><span style=3D"color:#660">(</span=
><span style=3D"color:#000"><br></span><span style=3D"color:#008"></span></=
code></span></code><code><span style=3D"color:#660"><code><span style=3D"co=
lor:#000">=C2=A0 =C2=A0 </span><span style=3D"color:#008">using</span><span=
style=3D"color:#000"> V1 </span><span style=3D"color:#660">=3D</span><span=
style=3D"color:#000"> </span><span style=3D"color:#606">Vehicle</span><spa=
n style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0=
</span><span style=3D"color:#008">using</span><span style=3D"color:#000"> =
V2 </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> =
</span><span style=3D"color:#606">Vehicle</span><span style=3D"color:#660">=
;</span><span style=3D"color:#000"><br></span><span style=3D"color:#660"></=
span></code>)</span><span style=3D"color:#000"><br></span></code><br>Does t=
his help?<br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/e275706f-289f-4b4c-a61a-3cba684293fd%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e275706f-289f-4b4c-a61a-3cba684293fd=
%40isocpp.org</a>.<br />
------=_Part_14144_187475080.1514156083560--
------=_Part_14143_125732042.1514156083559--
.
Author: "Arthur O'Dwyer" <arthur.j.odwyer@gmail.com>
Date: Sun, 24 Dec 2017 22:29:02 -0800
Raw View
--f4030438d210494466056124485d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Sun, Dec 24, 2017 at 2:54 PM, Laurent LA RIZZA <
the.ultimate.koala@gmail.com> wrote:
> Just for the sake of homogeneity, you could start by rewriting the
> beginning as :
>
> IFG(template<Vehicle V1, Vehicle V2>)
> struct DemolitionDerby {
> IFP(
> using V1 =3D Vehicle;
> using V2 =3D Vehicle;
> )
>
Agreed. Good point.
> If I understand well, "making cleaner" mens you want to actually hide
> whether you're using a concept or an interface to abstract your Vehicle
> types and have some vocabulary that means "Abstract N types either throug=
h
> interfaces or concepts".
>
> Then, in the concepts case, since you'll eventually hide the concepts
> syntax, do you really need terse syntax?
>
Can you clarify what you mean by "since you'll eventually hide the concepts
syntax"?
In my first `bool is_highway_safe(const Vehicle&)` example, I don't need to
make up any macros or use my IFP()/IFG() alternatives; the terse Concepts
TS syntax just works, out of the box, for generic programming just as well
as it worked for classically polymorphic programming.
> The following works :
>
> IFG(template<Vehicle V1, Vehicle V2>)
> int DemolitionDerby IFG(<V1, V2>) ::winner() const {
> return v1->wheels() > v2->wheels() ? 1 : 2;
}
>
and is consistent with:
>
> IFG(template<Vehicle V1, Vehicle V2>)
> struct DemolitionDerby {
> IFP(
> using V1 =3D Vehicle;
> using V2 =3D Vehicle;
> )
>
True, but.
In the non-member function case (`is_highway_safe`), I didn't need to
decorate *any* function definition with IFP()/IFG() cruft:
bool is_highway_safe(const Vehicle& v) {
return v.wheels() >=3D 4;
}
In that case I needed to cruft up the definition of Vehicle itself (of
course), and minorly cruft up Bike and Car, which inherit/model Vehicle;
but I didn't need to cruft up the *users* of Vehicle (namely,
`is_highway_safe` and `main`). The *users* got to write code that looked
polymorphic, but was secretly generic.
But in the DemolitionDerby use-case, I *do* need to cruft up the users of
Vehicle (namely, `DemolitionDerby` and `DemolitionDerby::winner`). My
IFG()/IFP() macros make the cruft relatively easy on the eyes, but it's
still cruft.
=E2=80=93Arthur
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CADvuK0Lvkw2OFU4Nftkt2bKtOi5ZKaZwrBru-ga4A_HFksp=
TTA%40mail.gmail.com.
--f4030438d210494466056124485d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sun, Dec 24, 2017 at 2:54 PM, Laurent LA RIZZA <span di=
r=3D"ltr"><<a href=3D"mailto:the.ultimate.koala@gmail.com" target=3D"_bl=
ank">the.ultimate.koala@gmail.com</a>></span> wrote:<br><div class=3D"gm=
ail_extra"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div d=
ir=3D"ltr">Just for the sake of homogeneity, you could start by rewriting t=
he beginning as :<br><br><code><span style=3D"color:#000">IFG</span><span s=
tyle=3D"color:#660">(</span><span style=3D"color:#000"></span><span style=
=3D"color:#008">template</span><span style=3D"color:#660"><</span><span =
style=3D"color:#606">Vehicle</span><span style=3D"color:#000"> V1</span><sp=
an style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#606">Vehicle</span><span style=3D"color:#000"> V2</span><span=
style=3D"color:#660">></span><span style=3D"color:#000"></span><span st=
yle=3D"color:#008">)<br>struct</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#606">DemolitionDerby</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br></s=
pan><span style=3D"color:#660"></span></code><code><span style=3D"color:#66=
0"><code><span style=3D"color:#000">IFP</span><span style=3D"color:#660">(<=
/span><span style=3D"color:#000"><br></span><span style=3D"color:#008"></sp=
an></code></span></code><span class=3D""><code><span style=3D"color:#660"><=
code><span style=3D"color:#000">=C2=A0 =C2=A0 </span><span style=3D"color:#=
008">using</span><span style=3D"color:#000"> V1 </span><span style=3D"color=
:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#6=
06">Vehicle</span><span style=3D"color:#660">;</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">using</span><span =
style=3D"color:#000"> V2 </span><span style=3D"color:#660">=3D</span><span =
style=3D"color:#000"> </span><span style=3D"color:#606">Vehicle</span><span=
style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#660"></span></code>)</span></code><br></span></div></blockqu=
ote><div><br></div><div>Agreed. Good point.</div><div><br></div><div>=C2=A0=
</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">If I understand well,=
"making cleaner" mens you want to actually hide whether you'=
re using a concept or an interface to abstract your Vehicle types and have =
some vocabulary that means "Abstract N types either through interfaces=
or concepts".<br><br>Then, in the concepts case, since you'll eve=
ntually hide the concepts syntax, do you really need terse syntax?</div></b=
lockquote><div><br></div><div>Can you clarify what you mean by "since =
you'll eventually hide the concepts syntax"?</div><div><br></div><=
div>In my first `bool is_highway_safe(const Vehicle&)` example, I don&#=
39;t need to make up any macros or use my IFP()/IFG() alternatives; the ter=
se Concepts TS syntax just works, out of the box, for generic programming j=
ust as well as it worked for classically polymorphic programming.</div><div=
>=C2=A0<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"> The follo=
wing works :<span class=3D""><br><br></span><span class=3D""><span class=3D=
"" style=3D"font-family:monospace"><span style=3D"color:rgb(0,0,0)">IFG</sp=
an><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,=
0,0)"></span><span style=3D"color:rgb(0,0,136)">template</span><span style=
=3D"color:rgb(102,102,0)"><</span><span style=3D"color:rgb(0,0,136)">Veh=
icle<span class=3D"sewx4xpsz6jdi7g"></span><span class=3D"sew9necu9jg9xnw">=
</span></span><span style=3D"color:rgb(0,0,0)">=C2=A0V1</span><span style=
=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)">=C2=A0</=
span><span style=3D"color:rgb(0,0,136)">Vehicle<span class=3D"sewx4xpsz6jdi=
7g"></span><span class=3D"sew9necu9jg9xnw"></span></span><span style=3D"col=
or:rgb(0,0,0)">=C2=A0V2</span><span style=3D"color:rgb(102,102,0)">></sp=
an></span><span style=3D"font-family:monospace;color:rgb(102,102,0)">)<span=
class=3D"sewx4xpsz6jdi7g"></span><span class=3D"sew9necu9jg9xnw"></span></=
span><span style=3D"font-family:monospace;color:rgb(0,0,136)"><br></span><s=
pan class=3D"" style=3D"font-family:monospace"><span style=3D"color:rgb(0,0=
,136)">int=C2=A0</span></span></span><span style=3D"color:rgb(102,0,102);fo=
nt-family:monospace">DemolitionDerby=C2=A0</span><span class=3D"" style=3D"=
font-family:monospace"><span style=3D"color:rgb(0,0,0)">IFG</span><span sty=
le=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(102,102,0)">&l=
t;</span><span style=3D"color:rgb(0,0,0)">V1</span><span style=3D"color:rgb=
(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)">=C2=A0</span><span st=
yle=3D"color:rgb(0,0,0)">V2</span><span style=3D"color:rgb(102,102,0)">>=
</span></span><span style=3D"font-family:monospace;color:rgb(102,102,0)">) =
::</span><span style=3D"color:rgb(0,0,0);font-family:monospace;font-size:13=
px">winner<span class=3D"sewx4xpsz6jdi7g"></span><span class=3D"sew9necu9jg=
9xnw"></span></span><span style=3D"font-family:monospace;color:rgb(102,102,=
0)">()=C2=A0</span><span style=3D"color:rgb(0,0,136);font-family:monospace"=
>const=C2=A0</span><span style=3D"color:rgb(102,102,0);font-family:monospac=
e;font-size:13px">{</span></div><span style=3D"font-size:13px;margin:0px;pa=
dding:0px;border:0px;font-family:monospace;color:rgb(0,0,0)">=C2=A0=C2=A0 =
=C2=A0</span><span style=3D"font-size:13px;margin:0px;padding:0px;border:0p=
x;font-family:monospace;color:rgb(0,0,136)">return</span><span style=3D"fon=
t-size:13px;margin:0px;padding:0px;border:0px;font-family:monospace;color:r=
gb(0,0,0)">=C2=A0v1</span><span style=3D"font-size:13px;margin:0px;padding:=
0px;border:0px;font-family:monospace;color:rgb(102,102,0)">-></span><spa=
n style=3D"font-size:13px;margin:0px;padding:0px;border:0px;font-family:mon=
ospace;color:rgb(0,0,0)">wheels</span><span style=3D"font-size:13px;margin:=
0px;padding:0px;border:0px;font-family:monospace;color:rgb(102,102,0)">()</=
span><span style=3D"font-size:13px;margin:0px;padding:0px;border:0px;font-f=
amily:monospace;color:rgb(0,0,0)">=C2=A0</span><span style=3D"font-size:13p=
x;margin:0px;padding:0px;border:0px;font-family:monospace;color:rgb(102,102=
,0)">>=C2=A0</span><span style=3D"font-size:13px;margin:0px;padding:0px;=
border:0px;font-family:monospace;color:rgb(0,0,0)">v2</span><span style=3D"=
font-size:13px;margin:0px;padding:0px;border:0px;font-family:monospace;colo=
r:rgb(102,102,0)">-></span><span style=3D"font-size:13px;margin:0px;padd=
ing:0px;border:0px;font-family:monospace;color:rgb(0,0,0)">wheels</span><sp=
an style=3D"font-size:13px;margin:0px;padding:0px;border:0px;font-family:mo=
nospace;color:rgb(102,102,0)">() ?=C2=A0<span style=3D"color:rgb(0,102,102)=
">1<span class=3D"sewx4xpsz6jdi7g"></span><span class=3D"sew9necu9jg9xnw"><=
/span></span>=C2=A0:=C2=A0</span><span style=3D"color:rgb(0,102,102);font-f=
amily:monospace;font-size:13px">2<span class=3D"sewx4xpsz6jdi7g"></span><sp=
an class=3D"sew9necu9jg9xnw"></span></span><span style=3D"color:rgb(102,102=
,0);font-family:monospace;font-size:13px">;</span>=C2=A0</blockquote><block=
quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc=
solid;padding-left:1ex"><span style=3D"color:rgb(102,102,0);font-family:mo=
nospace;font-size:13px">}</span></blockquote><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr">=C2=A0</div></blockquote><div><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-=
color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir=
=3D"ltr">and is consistent with:<br><br><code><span class=3D""><span style=
=3D"color:rgb(0,0,0)">IFG</span><span style=3D"color:rgb(102,102,0)">(</spa=
n><span style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,0,136)=
">template</span><span style=3D"color:rgb(102,102,0)"><</span><span styl=
e=3D"color:rgb(0,0,136)">Vehicle<span class=3D"sewx4xpsz6jdi7g"></span><spa=
n class=3D"sew9necu9jg9xnw"></span></span><span style=3D"color:rgb(0,0,0)">=
=C2=A0V1</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"=
color:rgb(0,0,0)">=C2=A0</span><span style=3D"color:rgb(0,0,136)">Vehicle<s=
pan class=3D"sewx4xpsz6jdi7g"></span><span class=3D"sew9necu9jg9xnw"></span=
></span><span style=3D"color:rgb(0,0,0)">=C2=A0V2</span><span style=3D"colo=
r:rgb(102,102,0)">></span></span><span style=3D"color:rgb(102,102,0)">)<=
span class=3D"sewx4xpsz6jdi7g"></span><span class=3D"sew9necu9jg9xnw"></spa=
n></span><span style=3D"color:rgb(0,0,136)"><br>struct</span><span style=3D=
"color:rgb(0,0,0)">=C2=A0</span><span style=3D"color:rgb(102,0,102)">Demoli=
tionDerby</span><span style=3D"color:rgb(0,0,0)">=C2=A0</span><span style=
=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br></sp=
an><span style=3D"color:rgb(102,102,0)"></span></code><code><span style=3D"=
color:rgb(102,102,0)"><code><span style=3D"color:rgb(0,0,0)">IFP</span>(<sp=
an style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,136)"=
></span></code></span></code><span class=3D""><code><span style=3D"color:rg=
b(102,102,0)"><code><span style=3D"color:rgb(0,0,0)">=C2=A0 =C2=A0=C2=A0</s=
pan><span style=3D"color:rgb(0,0,136)">using</span><span style=3D"color:rgb=
(0,0,0)">=C2=A0V1=C2=A0</span>=3D<span style=3D"color:rgb(0,0,0)">=C2=A0</s=
pan><span style=3D"color:rgb(102,0,102)">Vehicle</span>;<span style=3D"colo=
r:rgb(0,0,0)"><br>=C2=A0 =C2=A0=C2=A0</span><span style=3D"color:rgb(0,0,13=
6)">using</span><span style=3D"color:rgb(0,0,0)">=C2=A0V2=C2=A0</span>=3D<s=
pan style=3D"color:rgb(0,0,0)">=C2=A0</span><span style=3D"color:rgb(102,0,=
102)">Vehicle</span>;<span style=3D"color:rgb(0,0,0)"><br></span></code>)</=
span></code><br></span></div></blockquote><div><span class=3D"sewx4xpsz6jdi=
7g"></span><span class=3D"sew9necu9jg9xnw"></span><br></div></div><div>True=
, but.</div><div>In the non-member function case (`is_highway_safe`), I did=
n't need to decorate <i>any</i> function definition with IFP()/IFG() cr=
uft:</div><div><br></div><div><span style=3D"margin:0px;padding:0px;border:=
0px;font-family:monospace;font-size:13px;color:rgb(0,0,136)">=C2=A0 =C2=A0=
=C2=A0</span><span style=3D"color:rgb(0,0,136);font-family:monospace;font-s=
ize:13px">b<span class=3D"sewx4xpsz6jdi7g"></span><span class=3D"sew9necu9j=
g9xnw"></span></span><span style=3D"font-size:13px;margin:0px;padding:0px;b=
order:0px;font-family:monospace;color:rgb(0,0,136)">ool</span><span style=
=3D"font-size:13px;margin:0px;padding:0px;border:0px;font-family:monospace;=
color:rgb(0,0,0)">=C2=A0is_highway_safe</span><span style=3D"font-size:13px=
;margin:0px;padding:0px;border:0px;font-family:monospace;color:rgb(102,102,=
0)">(</span><span style=3D"font-size:13px;margin:0px;padding:0px;border:0px=
;font-family:monospace;color:rgb(0,0,136)">const</span><span style=3D"font-=
size:13px;margin:0px;padding:0px;border:0px;font-family:monospace;color:rgb=
(0,0,0)">=C2=A0</span><span style=3D"font-size:13px;margin:0px;padding:0px;=
border:0px;font-family:monospace;color:rgb(102,0,102)">Vehicle</span><span =
style=3D"font-size:13px;margin:0px;padding:0px;border:0px;font-family:monos=
pace;color:rgb(102,102,0)">&</span><span style=3D"font-size:13px;margin=
:0px;padding:0px;border:0px;font-family:monospace;color:rgb(0,0,0)">=C2=A0v=
</span><span style=3D"font-size:13px;margin:0px;padding:0px;border:0px;font=
-family:monospace;color:rgb(102,102,0)">)</span><font color=3D"#000000" sty=
le=3D"font-size:13px;margin:0px;padding:0px;border:0px;font-family:monospac=
e">=C2=A0</font><span style=3D"font-size:13px;margin:0px;padding:0px;border=
:0px;font-family:monospace;color:rgb(102,102,0)">{</span></div><div><span s=
tyle=3D"margin:0px;padding:0px;border:0px;font-family:monospace;font-size:1=
3px;color:rgb(0,0,0)">=C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0</span><span style=
=3D"margin:0px;padding:0px;border:0px;font-family:monospace;font-size:13px;=
color:rgb(0,0,136)">return</span><span style=3D"margin:0px;padding:0px;bord=
er:0px;font-family:monospace;font-size:13px;color:rgb(0,0,0)">=C2=A0v</span=
><span style=3D"margin:0px;padding:0px;border:0px;font-family:monospace;fon=
t-size:13px;color:rgb(102,102,0)">.</span><span style=3D"margin:0px;padding=
:0px;border:0px;font-family:monospace;font-size:13px;color:rgb(0,0,0)">whee=
ls</span><span style=3D"margin:0px;padding:0px;border:0px;font-family:monos=
pace;font-size:13px;color:rgb(102,102,0)">()</span><span style=3D"margin:0p=
x;padding:0px;border:0px;font-family:monospace;font-size:13px;color:rgb(0,0=
,0)">=C2=A0</span><span style=3D"margin:0px;padding:0px;border:0px;font-fam=
ily:monospace;font-size:13px;color:rgb(102,102,0)">>=3D</span><span styl=
e=3D"margin:0px;padding:0px;border:0px;font-family:monospace;font-size:13px=
;color:rgb(0,0,0)">=C2=A0</span><span style=3D"margin:0px;padding:0px;borde=
r:0px;font-family:monospace;font-size:13px;color:rgb(0,102,102)">4</span><s=
pan style=3D"margin:0px;padding:0px;border:0px;font-family:monospace;font-s=
ize:13px;color:rgb(102,102,0)">;</span><span style=3D"margin:0px;padding:0p=
x;border:0px;font-family:monospace;font-size:13px;color:rgb(0,0,0)"><br></s=
pan><span style=3D"margin:0px;padding:0px;border:0px;font-family:monospace;=
font-size:13px;color:rgb(102,102,0)">=C2=A0 =C2=A0 }<span class=3D"sewx4xps=
z6jdi7g"></span><span class=3D"sew9necu9jg9xnw"></span></span><br></div><di=
v>=C2=A0</div><div>In that case I needed to cruft up the definition of Vehi=
cle itself (of course), and minorly cruft up Bike and Car, which inherit/mo=
del Vehicle; but I didn't need to cruft up the <i>users</i>=C2=A0of Veh=
icle (namely, `is_highway_safe` and `main`). The <i>users</i> got to write =
code that looked polymorphic, but was secretly generic.</div><div><br></div=
><div>But in the DemolitionDerby use-case, I <i>do</i> need to cruft up the=
users of Vehicle (namely, `DemolitionDerby` and `DemolitionDerby::winner`)=
.. My IFG()/IFP() macros make the cruft relatively easy on the eyes, but it&=
#39;s still cruft.</div><div><br></div><div>=E2=80=93Arthur</div></div></di=
v></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CADvuK0Lvkw2OFU4Nftkt2bKtOi5ZKaZwrBru=
-ga4A_HFkspTTA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CADvuK0Lvkw2OFU4N=
ftkt2bKtOi5ZKaZwrBru-ga4A_HFkspTTA%40mail.gmail.com</a>.<br />
--f4030438d210494466056124485d--
.
Author: la.rizza.l.et.j@gmail.com
Date: Sun, 31 Dec 2017 02:05:41 -0800 (PST)
Raw View
------=_Part_32410_1108258733.1514714741506
Content-Type: multipart/alternative;
boundary="----=_Part_32411_602577646.1514714741507"
------=_Part_32411_602577646.1514714741507
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Le lundi 25 d=C3=A9cembre 2017 07:29:06 UTC+1, Arthur O'Dwyer a =C3=A9crit =
:
>
> Can you clarify what you mean by "since you'll eventually hide the=20
> concepts syntax"?
>
>
You are using IFP and IFG to select between defining/using concepts or ABCs=
=20
to get a polymorphic abstraction. IFP and IFG are used all around, so will=
=20
need at some point to be hidden by another set of abstractions that=20
encompass both cases without mentioning either IFP or IFG. That's what I=20
meant by "you'll eventually hide the concepts syntax". But it might not be=
=20
related to what you're actually looking for.
=20
> In my first `bool is_highway_safe(const Vehicle&)` example, I don't need=
=20
> to make up any macros or use my IFP()/IFG() alternatives; the terse=20
> Concepts TS syntax just works, out of the box, for generic programming ju=
st=20
> as well as it worked for classically polymorphic programming.
>
.... But in the DemolitionDerby use-case, I *do* need to cruft up the users=
=20
> of Vehicle (namely, `DemolitionDerby` and `DemolitionDerby::winner`). My=
=20
> IFG()/IFP() macros make the cruft relatively easy on the eyes, but it's=
=20
> still cruft.
>
The difference between the two is that in the case that works, the template=
=20
parameters refer to the function whereas in the case that does not work,=20
the template parameters refers to the class. You would not have the problem=
=20
if you defined the DD<>::winner function body in the class template body. I=
=20
may be wrong, but if you want your class to be a class template in the "IFG=
=20
active" case, should not the function be defined in the header anyway, and=
=20
be declared inline? More, it's shorter.
Not that I want to dodge the problem, but I must confess that I'm out of=20
ideas. You're trying to declare a function alternatively as a member of=20
class or as a member of a class template. Maybe try to make DemolitionDerby=
=20
a "parameterless template" instead of a class in the "IFP active" case.
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/b87a254e-d119-49a4-a31c-00295b27d3e8%40isocpp.or=
g.
------=_Part_32411_602577646.1514714741507
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>Le lundi 25 d=C3=A9cembre 2017 07:29:06 UTC+1, Art=
hur O'Dwyer a =C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div></div><div>Can =
you clarify what you mean by "since you'll eventually hide the con=
cepts syntax"?</div><div><br></div></div></div></div></blockquote><div=
><br></div><div>You are using IFP and IFG to select between defining/using =
concepts or ABCs to get a polymorphic abstraction. IFP and IFG are used all=
around, so will need at some point to be hidden by another set of abstract=
ions that encompass both cases without mentioning either IFP or IFG. That&#=
39;s what I meant by "you'll eventually hide the concepts syntax&q=
uot;. But it might not be related to what you're actually looking for.<=
br></div><div> =C2=A0 <br></div><blockquote class=3D"gmail_quote" style=3D"=
margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;=
"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div></div><div>In my fi=
rst `bool is_highway_safe(const Vehicle&)` example, I don't need to=
make up any macros or use my IFP()/IFG() alternatives; the terse Concepts =
TS syntax just works, out of the box, for generic programming just as well =
as it worked for classically polymorphic programming.</div></div></div></di=
v></blockquote><div><br></div><div><br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddi=
ng-left: 1ex;"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div>...=C2=
=A0But in the DemolitionDerby use-case, I <i>do</i> need to cruft up the us=
ers of Vehicle (namely, `DemolitionDerby` and `DemolitionDerby::winner`). M=
y IFG()/IFP() macros make the cruft relatively easy on the eyes, but it'=
;s still cruft.</div></div></div></div></blockquote><div><br></div>The diff=
erence between the two is that in the case that works, the template paramet=
ers refer to the function whereas in the case that does not work, the templ=
ate parameters refers to the class. You would not have the problem if you d=
efined the DD<>::winner function body in the class template body. I m=
ay be wrong, but if you want your class to be a class template in the "=
;IFG active" case, should not the function be defined in the header an=
yway, and be declared inline? More, it's shorter.<br><br>Not that I wan=
t to dodge the problem, but I must confess that I'm out of ideas. You&#=
39;re trying to declare a function alternatively as a member of class or as=
a member of a class template. Maybe try to make DemolitionDerby a "pa=
rameterless template" instead of a class in the "IFP active"=
case.<br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/b87a254e-d119-49a4-a31c-00295b27d3e8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b87a254e-d119-49a4-a31c-00295b27d3e8=
%40isocpp.org</a>.<br />
------=_Part_32411_602577646.1514714741507--
------=_Part_32410_1108258733.1514714741506--
.
Author: Laurent LA RIZZA <the.ultimate.koala@gmail.com>
Date: Sun, 31 Dec 2017 02:23:20 -0800 (PST)
Raw View
------=_Part_32748_1778503638.1514715800641
Content-Type: multipart/alternative;
boundary="----=_Part_32749_1682330100.1514715800642"
------=_Part_32749_1682330100.1514715800642
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Le lundi 25 d=C3=A9cembre 2017 07:29:06 UTC+1, Arthur O'Dwyer a =C3=A9crit =
:
>
> Can you clarify what you mean by "since you'll eventually hide the=20
> concepts syntax"?
>
>
You are using IFP and IFG to select between defining/using concepts or ABCs=
=20
to get a polymorphic abstraction. IFP and IFG are used all around, so will=
=20
need at some point to be hidden by another set of abstractions that=20
encompass both cases without mentioning either IFP or IFG. That's what I=20
meant by "you'll eventually hide the concepts syntax". But it might not be=
=20
related to what you're actually looking for.
=20
> In my first `bool is_highway_safe(const Vehicle&)` example, I don't need=
=20
> to make up any macros or use my IFP()/IFG() alternatives; the terse=20
> Concepts TS syntax just works, out of the box, for generic programming ju=
st=20
> as well as it worked for classically polymorphic programming.
>
.... But in the DemolitionDerby use-case, I *do* need to cruft up the users=
=20
> of Vehicle (namely, `DemolitionDerby` and `DemolitionDerby::winner`). My=
=20
> IFG()/IFP() macros make the cruft relatively easy on the eyes, but it's=
=20
> still cruft.
>
The difference between the two is that in the case that works, the template=
=20
parameters refer to the function whereas in the case that does not work,=20
the template parameters refers to the class. You would not have the problem=
=20
if you defined the DD<>::winner function body in the class template body. I=
=20
may be wrong, but if you want your class to be a class template in the "IFG=
=20
active" case, should not the function be defined in the header anyway, and=
=20
be declared inline? More, it's shorter.
Not that I want to dodge the problem, but I must confess that I'm out of=20
ideas. You're trying to declare a function alternatively as a member of=20
class or as a member of a class template. Maybe try to make DemolitionDerby=
=20
a "parameterless template" instead of a class in the "IFP active" case.=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/07f78e3d-7cd4-49d0-88ea-834dcbd5ca56%40isocpp.or=
g.
------=_Part_32749_1682330100.1514715800642
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div class=3D"F0XO1GC-Db-b">Le lundi 25 d=C3=A9cembre=
2017 07:29:06 UTC+1, Arthur O'Dwyer a =C3=A9crit=C2=A0:<blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc=
solid;padding-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><=
div>Can you clarify what you mean by "since you'll eventually hide=
the concepts syntax"?</div><div><br></div></div></div></div></blockqu=
ote><div><br></div></div><div>You
are using IFP and IFG to select between defining/using concepts or ABCs
to get a polymorphic abstraction. IFP and IFG are used all around, so=20
will need at some point to be hidden by another set of abstractions that
encompass both cases without mentioning either IFP or IFG. That's what=
I
meant by "you'll eventually hide the concepts syntax". But i=
t might not
be related to what you're actually looking for.<br></div><div class=3D=
"F0XO1GC-Db-b"><div> =C2=A0 <br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1e=
x"><div dir=3D"ltr"><div><div class=3D"gmail_quote"><div>In
my first `bool is_highway_safe(const Vehicle&)` example, I don't=
=20
need to make up any macros or use my IFP()/IFG() alternatives; the terse
Concepts TS syntax just works, out of the box, for generic programming=20
just as well as it worked for classically polymorphic programming.</div></d=
iv></div></div></blockquote><div><br></div><div><br></div></div><blockquote=
class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px =
#ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div class=3D"gmail_quot=
e"><div>...=C2=A0But in the DemolitionDerby use-case, I <i>do</i>
need to cruft up the users of Vehicle (namely, `DemolitionDerby` and=20
`DemolitionDerby::winner`). My IFG()/IFP() macros make the cruft=20
relatively easy on the eyes, but it's still cruft.</div></div></div></d=
iv></blockquote><div><br></div>The
difference between the two is that in the case that works, the template
parameters refer to the function whereas in the case that does not=20
work, the template parameters refers to the class. You would not have=20
the problem if you defined the DD<>::winner function body in the=20
class template body. I may be wrong, but if you want your class to be a=20
class template in the "IFG active" case, should not the function =
be=20
defined in the header anyway, and be declared inline? More, it's=20
shorter.<br><br>Not that I want to dodge the problem, but I must confess
that I'm out of ideas. You're trying to declare a function=20
alternatively as a member of class or as a member of a class template.=20
Maybe try to make DemolitionDerby a "parameterless template" inst=
ead of a
class in the "IFP active" case. <br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/07f78e3d-7cd4-49d0-88ea-834dcbd5ca56%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/07f78e3d-7cd4-49d0-88ea-834dcbd5ca56=
%40isocpp.org</a>.<br />
------=_Part_32749_1682330100.1514715800642--
------=_Part_32748_1778503638.1514715800641--
.
Author: Corentin <corentin.jabot@gmail.com>
Date: Mon, 01 Jan 2018 12:01:58 +0000
Raw View
--001a113b1cbe7360760561b5c0b5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Crazy idea, given the current approach regarding meta classes:
Take a set of non virtual class { Base, Inherited... }
For each class make some functions of your choosing virtual.
Inject the generated classes in the namespace under a new name.
It would require to be able to generates or mutate the base specifiers
list.
Maybe even provide a polymorphic_t<T> that gives you the type of the
generated class from the one of the "source" class.
Then you can put different requirements on the nature of the parameters in
DemolitionDerby
Happy new year;
- Corentin
Le dim. 24 d=C3=A9c. 2017 =C3=A0 22:24, Arthur O'Dwyer <arthur.j.odwyer@gma=
il.com> a
=C3=A9crit :
> I have recently become interested in the possibility of using Concepts
> terse syntax to enable a sort of "polymorphism-agnostic" coding style,
> where for example
>
> bool is_highway_safe(const Vehicle& v)
> {
> return v.wheels() >=3D 4;
> }
>
> can be either a classically-polymorphic-function or a tersely defined
> generic-function-template, depending on the definition of `Vehicle` e.g. =
in
> a header file.
>
> Here's a trivial example:
> https://wandbox.org/permlink/IvShMRyVnwU7Uvuo
>
> #define IFP(...) // or reverse these
> #define IFG(...) __VA_ARGS__ // or reverse these
>
> IFG(
> template<class V>
> concept bool Vehicle =3D requires(const V& v) {
> { v.wheels() } -> int;
> };
> )
> IFP(
> struct Vehicle {
> virtual int wheels() const =3D 0;
> };
> )
>
> struct Car IFP(: public Vehicle) {
> int wheels() const IFP(override) { return 4; }
> };
> struct Bike IFP(: public Vehicle) {
> int wheels() const IFP(override) { return 2; }
> };
>
> bool is_highway_safe(const Vehicle& v) {
> return v.wheels() >=3D 4;
> }
>
> int main() {
> Car c;
> Bike b;
> assert(is_highway_safe(c));
> assert(not is_highway_safe(b));
> }
>
>
> If I could extend this programming style all the way out to e.g. the
> definitions of class (template) member functions, then I'd have something
> pretty cool. Unfortunately, it seems that the terse syntax for *function
> templates* does not generalize to a terse syntax for member *functions of
> class templates*. Example:
> https://wandbox.org/permlink/YUeWRVhNDR0FAunf
>
> IFP(
> struct DemolitionDerby {
> using V1 =3D Vehicle;
> using V2 =3D Vehicle;
> )
> IFG(
> template<Vehicle V1, Vehicle V2>
> struct DemolitionDerby {
> )
> V1 *v1;
> V2 *v2;
> DemolitionDerby(V1& v1, V2& v2) : v1(&v1), v2(&v2) {}
> int winner() const;
> };
>
> IFG(template<class V1, class V2>)
> int DemolitionDerby IFG(<V1,V2>) ::winner() const {
> return v1->wheels() > v2->wheels() ? 1 : 2;
> }
>
> int main() {
> Car c;
> Bike b;
> DemolitionDerby dd(b, c);
> assert(dd.winner() =3D=3D 2);
> }
>
>
> Does anyone see a way to harmonize this latter example, so that it doesn'=
t
> need so much IFG(...) boilerplate? Ideally the amount of boilerplate
> required would be O(1), just on the class definition, and not on any of t=
he
> member function definitions; then I could take my existing
> classically-polymorphic codebase and recompile it with O(1) effort to
> produce a generic-programming templated version.
>
> (Please assume that this would in fact be a good idea in my case, and
> wouldn't run into any really deep architectural problems. I'm aware that =
if
> my original code's Vehicle *v1, *v2; had been Vehicle *vs[2]; instead,
> I'd have had serious problems. Let's assume that either I don't have such
> problems, or I'm willing to do the design work to patch them up; I'm just
> unwilling to maintain a codebase containing so many instances of
> IFP()/IFG().)
>
> Basically, if we *assume for the sake of argument* that C++2a is going to
> get something like Concepts TS terse syntax, then I'd like to explore, in
> this thread, what other syntactic innovations would be necessary in order
> to make my DemolitionDerby example look cleaner.
>
> =E2=80=93Arthur
>
> --
> 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/5ec84628-4ac=
f-4f40-83ce-4734f049aa7f%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5ec84628-4a=
cf-4f40-83ce-4734f049aa7f%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CA%2BOm%2BSi1kDSbFJNGZ-EoaDZPsy5cv7c8OGyXpBVeaaU=
n1J%2BBfA%40mail.gmail.com.
--001a113b1cbe7360760561b5c0b5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Crazy idea, given the current approach regarding meta clas=
ses:<div>Take a set of non virtual class { Base, Inherited... }</div><div><=
br></div><div>For each class make some functions of your choosing virtual.<=
/div><div>Inject the generated classes in the namespace under a new name.</=
div><div><br></div><div>It would require to be able to generates or mutate =
the base specifiers list.=C2=A0</div><div><br></div><div>Maybe even provide=
=C2=A0 a polymorphic_t<T> that gives you the type of the generated cl=
ass from the one of the "source" class.=C2=A0</div><div><br></div=
><div>Then you can put different requirements on the nature of the paramete=
rs in DemolitionDerby</div><div><br></div><div>Happy new year;</div><div>- =
Corentin</div><div><br></div><div><br><br><div class=3D"gmail_quote"><div d=
ir=3D"ltr">Le=C2=A0dim. 24 d=C3=A9c. 2017 =C3=A0=C2=A022:24, Arthur O'D=
wyer <<a href=3D"mailto:arthur.j.odwyer@gmail.com">arthur.j.odwyer@gmail=
..com</a>> a =C3=A9crit=C2=A0:<br></div><blockquote class=3D"gmail_quote"=
style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><d=
iv dir=3D"ltr"><div style=3D"font-family:arial,sans-serif">I have recently =
become interested in the possibility of using Concepts terse syntax to enab=
le a sort of "polymorphism-agnostic" coding style, where for exam=
ple</div><div style=3D"font-family:arial,sans-serif"><br></div><div style=
=3D"font-family:arial,sans-serif"><div>=C2=A0 =C2=A0 bool is_highway_safe(c=
onst Vehicle& v)</div><div>=C2=A0 =C2=A0 {</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 return v.wheels() >=3D 4;</div><div>=C2=A0 =C2=A0 }<span clas=
s=3D"m_-2602817339687867812sewz9cbuys30qp"></span><span class=3D"m_-2602817=
339687867812sewhnp14sd8jmtw"></span></div></div><div style=3D"font-family:a=
rial,sans-serif"><br></div><div style=3D"font-family:arial,sans-serif">can =
be either a classically-polymorphic-function or a tersely defined generic-f=
unction-template, depending on the definition of `Vehicle` e.g. in a header=
file.</div><div style=3D"font-family:arial,sans-serif"><br></div><div styl=
e=3D"font-family:arial,sans-serif">Here's a trivial example:</div><div =
style=3D"font-family:arial,sans-serif"><a href=3D"https://wandbox.org/perml=
ink/IvShMRyVnwU7Uvuo" style=3D"color:rgb(17,85,204)" target=3D"_blank">http=
s://wandbox.org/permlink/IvShMRyVnwU7Uvuo</a><span class=3D"m_-260281733968=
7867812sewz9cbuys30qp"></span><span class=3D"m_-2602817339687867812sewhnp14=
sd8jmtw"></span><br></div><div style=3D"font-family:arial,sans-serif"><br><=
/div><div style=3D"font-family:arial,sans-serif"><div class=3D"m_-260281733=
9687867812prettyprint" style=3D"background-color:rgb(250,250,250);border:1p=
x solid rgb(187,187,187);word-wrap:break-word"><code class=3D"m_-2602817339=
687867812prettyprint"><div class=3D"m_-2602817339687867812subprettyprint"><=
span style=3D"color:#800" class=3D"m_-2602817339687867812styled-by-prettify=
">#define</span><span style=3D"color:#000" class=3D"m_-2602817339687867812s=
tyled-by-prettify"> IFP</span><span style=3D"color:#660" class=3D"m_-260281=
7339687867812styled-by-prettify">(...)</span><span style=3D"color:#000" cla=
ss=3D"m_-2602817339687867812styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#800" class=3D"m_-26028=
17339687867812styled-by-prettify">// or reverse these</span><span style=3D"=
color:#000" class=3D"m_-2602817339687867812styled-by-prettify"><br></span><=
span style=3D"color:#800" class=3D"m_-2602817339687867812styled-by-prettify=
">#define</span><span style=3D"color:#000" class=3D"m_-2602817339687867812s=
tyled-by-prettify"> IFG</span><span style=3D"color:#660" class=3D"m_-260281=
7339687867812styled-by-prettify">(...)</span><span style=3D"color:#000" cla=
ss=3D"m_-2602817339687867812styled-by-prettify"> __VA_ARGS__ =C2=A0</span><=
span style=3D"color:#800" class=3D"m_-2602817339687867812styled-by-prettify=
">// or reverse these</span><span style=3D"color:#000" class=3D"m_-26028173=
39687867812styled-by-prettify"><br><br>IFG</span><span style=3D"color:#660"=
class=3D"m_-2602817339687867812styled-by-prettify">(</span><span style=3D"=
color:#000" class=3D"m_-2602817339687867812styled-by-prettify"><br></span><=
span style=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify=
">template</span><span style=3D"color:#660" class=3D"m_-2602817339687867812=
styled-by-prettify"><</span><span style=3D"color:#008" class=3D"m_-26028=
17339687867812styled-by-prettify">class</span><span style=3D"color:#000" cl=
ass=3D"m_-2602817339687867812styled-by-prettify"> V</span><span style=3D"co=
lor:#660" class=3D"m_-2602817339687867812styled-by-prettify">></span><sp=
an style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">=
<br></span><span style=3D"color:#008" class=3D"m_-2602817339687867812styled=
-by-prettify">concept</span><span style=3D"color:#000" class=3D"m_-26028173=
39687867812styled-by-prettify"> </span><span style=3D"color:#008" class=3D"=
m_-2602817339687867812styled-by-prettify">bool</span><span style=3D"color:#=
000" class=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=
=3D"color:#606" class=3D"m_-2602817339687867812styled-by-prettify">Vehicle<=
/span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-p=
rettify"> </span><span style=3D"color:#660" class=3D"m_-2602817339687867812=
styled-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_-260281=
7339687867812styled-by-prettify"> requires</span><span style=3D"color:#660"=
class=3D"m_-2602817339687867812styled-by-prettify">(</span><span style=3D"=
color:#008" class=3D"m_-2602817339687867812styled-by-prettify">const</span>=
<span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettif=
y"> V</span><span style=3D"color:#660" class=3D"m_-2602817339687867812style=
d-by-prettify">&</span><span style=3D"color:#000" class=3D"m_-260281733=
9687867812styled-by-prettify"> v</span><span style=3D"color:#660" class=3D"=
m_-2602817339687867812styled-by-prettify">)</span><span style=3D"color:#000=
" class=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D=
"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">{</span><sp=
an style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">=
<br>=C2=A0 =C2=A0 </span><span style=3D"color:#660" class=3D"m_-26028173396=
87867812styled-by-prettify">{</span><span style=3D"color:#000" class=3D"m_-=
2602817339687867812styled-by-prettify"> v</span><span style=3D"color:#660" =
class=3D"m_-2602817339687867812styled-by-prettify">.</span><span style=3D"c=
olor:#000" class=3D"m_-2602817339687867812styled-by-prettify">wheels</span>=
<span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettif=
y">()</span><span style=3D"color:#000" class=3D"m_-2602817339687867812style=
d-by-prettify"> </span><span style=3D"color:#660" class=3D"m_-2602817339687=
867812styled-by-prettify">}</span><span style=3D"color:#000" class=3D"m_-26=
02817339687867812styled-by-prettify"> </span><span style=3D"color:#660" cla=
ss=3D"m_-2602817339687867812styled-by-prettify">-></span><span style=3D"=
color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </span><spa=
n style=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">i=
nt</span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-b=
y-prettify">;</span><span style=3D"color:#000" class=3D"m_-2602817339687867=
812styled-by-prettify"> <br></span><span style=3D"color:#660" class=3D"m_-2=
602817339687867812styled-by-prettify">};</span><span style=3D"color:#000" c=
lass=3D"m_-2602817339687867812styled-by-prettify"><br></span><span style=3D=
"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">)</span><sp=
an style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">=
<br>IFP</span><span style=3D"color:#660" class=3D"m_-2602817339687867812sty=
led-by-prettify">(</span><span style=3D"color:#000" class=3D"m_-26028173396=
87867812styled-by-prettify"><br></span><span style=3D"color:#008" class=3D"=
m_-2602817339687867812styled-by-prettify">struct</span><span style=3D"color=
:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </span><span sty=
le=3D"color:#606" class=3D"m_-2602817339687867812styled-by-prettify">Vehicl=
e</span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by=
-prettify"> </span><span style=3D"color:#660" class=3D"m_-26028173396878678=
12styled-by-prettify">{</span><span style=3D"color:#000" class=3D"m_-260281=
7339687867812styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"co=
lor:#008" class=3D"m_-2602817339687867812styled-by-prettify">virtual</span>=
<span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettif=
y"> </span><span style=3D"color:#008" class=3D"m_-2602817339687867812styled=
-by-prettify">int</span><span style=3D"color:#000" class=3D"m_-260281733968=
7867812styled-by-prettify"> wheels</span><span style=3D"color:#660" class=
=3D"m_-2602817339687867812styled-by-prettify">()</span><span style=3D"color=
:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </span><span sty=
le=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">const<=
/span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-p=
rettify"> </span><span style=3D"color:#660" class=3D"m_-2602817339687867812=
styled-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_-260281=
7339687867812styled-by-prettify"> </span><span style=3D"color:#066" class=
=3D"m_-2602817339687867812styled-by-prettify">0</span><span style=3D"color:=
#660" class=3D"m_-2602817339687867812styled-by-prettify">;</span><span styl=
e=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"><br></s=
pan><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pre=
ttify">};</span><span style=3D"color:#000" class=3D"m_-2602817339687867812s=
tyled-by-prettify"><br></span><span style=3D"color:#660" class=3D"m_-260281=
7339687867812styled-by-prettify">)</span><span style=3D"color:#000" class=
=3D"m_-2602817339687867812styled-by-prettify"><br><br></span><span style=3D=
"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">struct</spa=
n><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prett=
ify"> </span><span style=3D"color:#606" class=3D"m_-2602817339687867812styl=
ed-by-prettify">Car</span><span style=3D"color:#000" class=3D"m_-2602817339=
687867812styled-by-prettify"> IFP</span><span style=3D"color:#660" class=3D=
"m_-2602817339687867812styled-by-prettify">(:</span><span style=3D"color:#0=
00" class=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=
=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">public</=
span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-pr=
ettify"> </span><span style=3D"color:#606" class=3D"m_-2602817339687867812s=
tyled-by-prettify">Vehicle</span><span style=3D"color:#660" class=3D"m_-260=
2817339687867812styled-by-prettify">)</span><span style=3D"color:#000" clas=
s=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D"color=
:#660" class=3D"m_-2602817339687867812styled-by-prettify">{</span><span sty=
le=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_-260281733968786=
7812styled-by-prettify">int</span><span style=3D"color:#000" class=3D"m_-26=
02817339687867812styled-by-prettify"> wheels</span><span style=3D"color:#66=
0" class=3D"m_-2602817339687867812styled-by-prettify">()</span><span style=
=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </span>=
<span style=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettif=
y">const</span><span style=3D"color:#000" class=3D"m_-2602817339687867812st=
yled-by-prettify"> IFP</span><span style=3D"color:#660" class=3D"m_-2602817=
339687867812styled-by-prettify">(</span><span style=3D"color:#008" class=3D=
"m_-2602817339687867812styled-by-prettify">override</span><span style=3D"co=
lor:#660" class=3D"m_-2602817339687867812styled-by-prettify">)</span><span =
style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </=
span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pr=
ettify">{</span><span style=3D"color:#000" class=3D"m_-2602817339687867812s=
tyled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_-260281733=
9687867812styled-by-prettify">return</span><span style=3D"color:#000" class=
=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D"color:=
#066" class=3D"m_-2602817339687867812styled-by-prettify">4</span><span styl=
e=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">;</span=
><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-pretti=
fy"> </span><span style=3D"color:#660" class=3D"m_-2602817339687867812style=
d-by-prettify">}</span><span style=3D"color:#000" class=3D"m_-2602817339687=
867812styled-by-prettify"><br></span><span style=3D"color:#660" class=3D"m_=
-2602817339687867812styled-by-prettify">};</span><span style=3D"color:#000"=
class=3D"m_-2602817339687867812styled-by-prettify"><br></span><span style=
=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">struct</=
span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-pr=
ettify"> </span><span style=3D"color:#606" class=3D"m_-2602817339687867812s=
tyled-by-prettify">Bike</span><span style=3D"color:#000" class=3D"m_-260281=
7339687867812styled-by-prettify"> IFP</span><span style=3D"color:#660" clas=
s=3D"m_-2602817339687867812styled-by-prettify">(:</span><span style=3D"colo=
r:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </span><span st=
yle=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">publi=
c</span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by=
-prettify"> </span><span style=3D"color:#606" class=3D"m_-26028173396878678=
12styled-by-prettify">Vehicle</span><span style=3D"color:#660" class=3D"m_-=
2602817339687867812styled-by-prettify">)</span><span style=3D"color:#000" c=
lass=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D"co=
lor:#660" class=3D"m_-2602817339687867812styled-by-prettify">{</span><span =
style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"><br=
>=C2=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_-26028173396878=
67812styled-by-prettify">int</span><span style=3D"color:#000" class=3D"m_-2=
602817339687867812styled-by-prettify"> wheels</span><span style=3D"color:#6=
60" class=3D"m_-2602817339687867812styled-by-prettify">()</span><span style=
=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </span>=
<span style=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettif=
y">const</span><span style=3D"color:#000" class=3D"m_-2602817339687867812st=
yled-by-prettify"> IFP</span><span style=3D"color:#660" class=3D"m_-2602817=
339687867812styled-by-prettify">(</span><span style=3D"color:#008" class=3D=
"m_-2602817339687867812styled-by-prettify">override</span><span style=3D"co=
lor:#660" class=3D"m_-2602817339687867812styled-by-prettify">)</span><span =
style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </=
span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pr=
ettify">{</span><span style=3D"color:#000" class=3D"m_-2602817339687867812s=
tyled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_-260281733=
9687867812styled-by-prettify">return</span><span style=3D"color:#000" class=
=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D"color:=
#066" class=3D"m_-2602817339687867812styled-by-prettify">2</span><span styl=
e=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">;</span=
><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-pretti=
fy"> </span><span style=3D"color:#660" class=3D"m_-2602817339687867812style=
d-by-prettify">}</span><span style=3D"color:#000" class=3D"m_-2602817339687=
867812styled-by-prettify"><br></span><span style=3D"color:#660" class=3D"m_=
-2602817339687867812styled-by-prettify">};</span><span style=3D"color:#000"=
class=3D"m_-2602817339687867812styled-by-prettify"><br><br></span><span st=
yle=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">bool<=
/span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-p=
rettify"> is_highway_safe</span><span style=3D"color:#660" class=3D"m_-2602=
817339687867812styled-by-prettify">(</span><span style=3D"color:#008" class=
=3D"m_-2602817339687867812styled-by-prettify">const</span><span style=3D"co=
lor:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </span><span =
style=3D"color:#606" class=3D"m_-2602817339687867812styled-by-prettify">Veh=
icle</span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled=
-by-prettify">&</span><span style=3D"color:#000" class=3D"m_-2602817339=
687867812styled-by-prettify"> v</span><span style=3D"color:#660" class=3D"m=
_-2602817339687867812styled-by-prettify">)</span><font color=3D"#000000"><s=
pan style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"=
> </span></font><span style=3D"color:#660" class=3D"m_-2602817339687867812s=
tyled-by-prettify">{</span><span style=3D"color:#000" class=3D"m_-260281733=
9687867812styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color=
:#008" class=3D"m_-2602817339687867812styled-by-prettify">return</span><spa=
n style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> =
v</span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by=
-prettify">.</span><span style=3D"color:#000" class=3D"m_-26028173396878678=
12styled-by-prettify">wheels</span><span style=3D"color:#660" class=3D"m_-2=
602817339687867812styled-by-prettify">()</span><span style=3D"color:#000" c=
lass=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D"co=
lor:#660" class=3D"m_-2602817339687867812styled-by-prettify">>=3D</span>=
<span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettif=
y"> </span><span style=3D"color:#066" class=3D"m_-2602817339687867812styled=
-by-prettify">4</span><span style=3D"color:#660" class=3D"m_-26028173396878=
67812styled-by-prettify">;</span><span style=3D"color:#000" class=3D"m_-260=
2817339687867812styled-by-prettify"><br></span><span style=3D"color:#660" c=
lass=3D"m_-2602817339687867812styled-by-prettify">}</span><span style=3D"co=
lor:#000" class=3D"m_-2602817339687867812styled-by-prettify"><br><br></span=
><span style=3D"color:#008" class=3D"m_-2602817339687867812styled-by-pretti=
fy">int</span><span style=3D"color:#000" class=3D"m_-2602817339687867812sty=
led-by-prettify"> main</span><span style=3D"color:#660" class=3D"m_-2602817=
339687867812styled-by-prettify">()</span><font color=3D"#000000"><span styl=
e=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </span=
></font><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by=
-prettify">{</span><span style=3D"color:#000" class=3D"m_-26028173396878678=
12styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606" c=
lass=3D"m_-2602817339687867812styled-by-prettify">Car</span><span style=3D"=
color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> c</span><sp=
an style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">=
;</span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by=
-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606" class=3D"m_-=
2602817339687867812styled-by-prettify">Bike</span><span style=3D"color:#000=
" class=3D"m_-2602817339687867812styled-by-prettify"> b</span><span style=
=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">;</span>=
<span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettif=
y"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_-26028173=
39687867812styled-by-prettify">assert</span><span style=3D"color:#660" clas=
s=3D"m_-2602817339687867812styled-by-prettify">(</span><span style=3D"color=
:#000" class=3D"m_-2602817339687867812styled-by-prettify">is_highway_safe</=
span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pr=
ettify">(</span><span style=3D"color:#000" class=3D"m_-2602817339687867812s=
tyled-by-prettify">c</span><span style=3D"color:#660" class=3D"m_-260281733=
9687867812styled-by-prettify">));</span><span style=3D"color:#000" class=3D=
"m_-2602817339687867812styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span s=
tyle=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">asse=
rt</span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-b=
y-prettify">(</span><span style=3D"color:#008" class=3D"m_-2602817339687867=
812styled-by-prettify">not</span><span style=3D"color:#000" class=3D"m_-260=
2817339687867812styled-by-prettify"> is_highway_safe</span><span style=3D"c=
olor:#660" class=3D"m_-2602817339687867812styled-by-prettify">(</span><span=
style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">b<=
/span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-p=
rettify">));</span><span style=3D"color:#000" class=3D"m_-26028173396878678=
12styled-by-prettify"><br></span><span style=3D"color:#660" class=3D"m_-260=
2817339687867812styled-by-prettify">}</span></div></code></div><div><br></d=
iv><div><br></div></div><div style=3D"font-family:arial,sans-serif">If I co=
uld extend this programming style all the way out to e.g. the definitions o=
f class (template) member functions, then I'd have something pretty coo=
l.=C2=A0 Unfortunately, it seems that the terse syntax for=C2=A0<i>function=
templates</i>=C2=A0does not generalize to a terse syntax for member=C2=A0<=
i>functions of class templates</i>. Example:</div><div style=3D"font-family=
:arial,sans-serif"><a href=3D"https://wandbox.org/permlink/YUeWRVhNDR0FAunf=
" style=3D"color:rgb(17,85,204)" target=3D"_blank">https://wandbox.org/perm=
link/YUeWRVhNDR0FAunf</a></div><div style=3D"font-family:arial,sans-serif">=
<br></div><div style=3D"font-family:arial,sans-serif"><div class=3D"m_-2602=
817339687867812prettyprint" style=3D"background-color:rgb(250,250,250);bord=
er:1px solid rgb(187,187,187);word-wrap:break-word"><code class=3D"m_-26028=
17339687867812prettyprint"><div class=3D"m_-2602817339687867812subprettypri=
nt"><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-pre=
ttify">IFP</span><span style=3D"color:#660" class=3D"m_-2602817339687867812=
styled-by-prettify">(</span><span style=3D"color:#000" class=3D"m_-26028173=
39687867812styled-by-prettify"><br></span><span style=3D"color:#008" class=
=3D"m_-2602817339687867812styled-by-prettify">struct</span><span style=3D"c=
olor:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </span><span=
style=3D"color:#606" class=3D"m_-2602817339687867812styled-by-prettify">De=
molitionDerby</span><span style=3D"color:#000" class=3D"m_-2602817339687867=
812styled-by-prettify"> </span><span style=3D"color:#660" class=3D"m_-26028=
17339687867812styled-by-prettify">{</span><span style=3D"color:#000" class=
=3D"m_-2602817339687867812styled-by-prettify"><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">u=
sing</span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled=
-by-prettify"> V1 </span><span style=3D"color:#660" class=3D"m_-26028173396=
87867812styled-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m=
_-2602817339687867812styled-by-prettify"> </span><span style=3D"color:#606"=
class=3D"m_-2602817339687867812styled-by-prettify">Vehicle</span><span sty=
le=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">;</spa=
n><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prett=
ify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008" class=3D"m_-260281=
7339687867812styled-by-prettify">using</span><span style=3D"color:#000" cla=
ss=3D"m_-2602817339687867812styled-by-prettify"> V2 </span><span style=3D"c=
olor:#660" class=3D"m_-2602817339687867812styled-by-prettify">=3D</span><sp=
an style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">=
</span><span style=3D"color:#606" class=3D"m_-2602817339687867812styled-by=
-prettify">Vehicle</span><span style=3D"color:#660" class=3D"m_-26028173396=
87867812styled-by-prettify">;</span><span style=3D"color:#000" class=3D"m_-=
2602817339687867812styled-by-prettify"><br></span><span style=3D"color:#660=
" class=3D"m_-2602817339687867812styled-by-prettify">)</span><span style=3D=
"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"><br>IFG</sp=
an><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pret=
tify">(</span><span style=3D"color:#000" class=3D"m_-2602817339687867812sty=
led-by-prettify"><br></span><span style=3D"color:#008" class=3D"m_-26028173=
39687867812styled-by-prettify">template</span><span style=3D"color:#660" cl=
ass=3D"m_-2602817339687867812styled-by-prettify"><</span><span style=3D"=
color:#606" class=3D"m_-2602817339687867812styled-by-prettify">Vehicle</spa=
n><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prett=
ify"> V1</span><span style=3D"color:#660" class=3D"m_-2602817339687867812st=
yled-by-prettify">,</span><span style=3D"color:#000" class=3D"m_-2602817339=
687867812styled-by-prettify"> </span><span style=3D"color:#606" class=3D"m_=
-2602817339687867812styled-by-prettify">Vehicle</span><span style=3D"color:=
#000" class=3D"m_-2602817339687867812styled-by-prettify"> V2</span><span st=
yle=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">><=
/span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-p=
rettify"><br></span><span style=3D"color:#008" class=3D"m_-2602817339687867=
812styled-by-prettify">struct</span><span style=3D"color:#000" class=3D"m_-=
2602817339687867812styled-by-prettify"> </span><span style=3D"color:#606" c=
lass=3D"m_-2602817339687867812styled-by-prettify">DemolitionDerby</span><sp=
an style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">=
</span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by=
-prettify">{</span><span style=3D"color:#000" class=3D"m_-26028173396878678=
12styled-by-prettify"><br></span><span style=3D"color:#660" class=3D"m_-260=
2817339687867812styled-by-prettify">)</span><span style=3D"color:#000" clas=
s=3D"m_-2602817339687867812styled-by-prettify"><br>=C2=A0 =C2=A0 V1 </span>=
<span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettif=
y">*</span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled=
-by-prettify">v1</span><span style=3D"color:#660" class=3D"m_-2602817339687=
867812styled-by-prettify">;</span><span style=3D"color:#000" class=3D"m_-26=
02817339687867812styled-by-prettify"><br>=C2=A0 =C2=A0 V2 </span><span styl=
e=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">*</span=
><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-pretti=
fy">v2</span><span style=3D"color:#660" class=3D"m_-2602817339687867812styl=
ed-by-prettify">;</span><span style=3D"color:#000" class=3D"m_-260281733968=
7867812styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#6=
06" class=3D"m_-2602817339687867812styled-by-prettify">DemolitionDerby</spa=
n><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prett=
ify">(</span><span style=3D"color:#000" class=3D"m_-2602817339687867812styl=
ed-by-prettify">V1</span><span style=3D"color:#660" class=3D"m_-26028173396=
87867812styled-by-prettify">&</span><span style=3D"color:#000" class=3D=
"m_-2602817339687867812styled-by-prettify"> v1</span><span style=3D"color:#=
660" class=3D"m_-2602817339687867812styled-by-prettify">,</span><span style=
=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> V2</spa=
n><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prett=
ify">&</span><span style=3D"color:#000" class=3D"m_-2602817339687867812=
styled-by-prettify"> v2</span><span style=3D"color:#660" class=3D"m_-260281=
7339687867812styled-by-prettify">)</span><span style=3D"color:#000" class=
=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D"color:=
#660" class=3D"m_-2602817339687867812styled-by-prettify">:</span><span styl=
e=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> v1</sp=
an><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pret=
tify">(&</span><span style=3D"color:#000" class=3D"m_-26028173396878678=
12styled-by-prettify">v1</span><span style=3D"color:#660" class=3D"m_-26028=
17339687867812styled-by-prettify">),</span><span style=3D"color:#000" class=
=3D"m_-2602817339687867812styled-by-prettify"> v2</span><span style=3D"colo=
r:#660" class=3D"m_-2602817339687867812styled-by-prettify">(&</span><sp=
an style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">=
v2</span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-b=
y-prettify">)</span><span style=3D"color:#000" class=3D"m_-2602817339687867=
812styled-by-prettify"> </span><span style=3D"color:#660" class=3D"m_-26028=
17339687867812styled-by-prettify">{}</span><span style=3D"color:#000" class=
=3D"m_-2602817339687867812styled-by-prettify"><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">i=
nt</span><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-b=
y-prettify"> winner</span><span style=3D"color:#660" class=3D"m_-2602817339=
687867812styled-by-prettify">()</span><span style=3D"color:#000" class=3D"m=
_-2602817339687867812styled-by-prettify"> </span><span style=3D"color:#008"=
class=3D"m_-2602817339687867812styled-by-prettify">const</span><span style=
=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">;</span>=
<span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettif=
y"><br></span><span style=3D"color:#660" class=3D"m_-2602817339687867812sty=
led-by-prettify">};</span><span style=3D"color:#000" class=3D"m_-2602817339=
687867812styled-by-prettify"><br>=C2=A0 =C2=A0 <br>IFG</span><span style=3D=
"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">(</span><sp=
an style=3D"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">=
template</span><span style=3D"color:#660" class=3D"m_-2602817339687867812st=
yled-by-prettify"><</span><span style=3D"color:#008" class=3D"m_-2602817=
339687867812styled-by-prettify">class</span><span style=3D"color:#000" clas=
s=3D"m_-2602817339687867812styled-by-prettify"> V1</span><span style=3D"col=
or:#660" class=3D"m_-2602817339687867812styled-by-prettify">,</span><span s=
tyle=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </s=
pan><span style=3D"color:#008" class=3D"m_-2602817339687867812styled-by-pre=
ttify">class</span><span style=3D"color:#000" class=3D"m_-26028173396878678=
12styled-by-prettify"> V2</span><span style=3D"color:#660" class=3D"m_-2602=
817339687867812styled-by-prettify">>)</span><span style=3D"color:#000" c=
lass=3D"m_-2602817339687867812styled-by-prettify"><br></span><span style=3D=
"color:#008" class=3D"m_-2602817339687867812styled-by-prettify">int</span><=
span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify=
"> </span><span style=3D"color:#606" class=3D"m_-2602817339687867812styled-=
by-prettify">DemolitionDerby</span><span style=3D"color:#000" class=3D"m_-2=
602817339687867812styled-by-prettify"> IFG</span><span style=3D"color:#660"=
class=3D"m_-2602817339687867812styled-by-prettify">(<</span><span style=
=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">V1</span=
><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pretti=
fy">,</span><span style=3D"color:#000" class=3D"m_-2602817339687867812style=
d-by-prettify">V2</span><span style=3D"color:#660" class=3D"m_-260281733968=
7867812styled-by-prettify">>)</span><span style=3D"color:#000" class=3D"=
m_-2602817339687867812styled-by-prettify"> </span><span style=3D"color:#660=
" class=3D"m_-2602817339687867812styled-by-prettify">::</span><span style=
=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">winner</=
span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pr=
ettify">()</span><span style=3D"color:#000" class=3D"m_-2602817339687867812=
styled-by-prettify"> </span><span style=3D"color:#008" class=3D"m_-26028173=
39687867812styled-by-prettify">const</span><font color=3D"#000000"><span st=
yle=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> </sp=
an></font><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-=
by-prettify">{</span><span style=3D"color:#000" class=3D"m_-260281733968786=
7812styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008"=
class=3D"m_-2602817339687867812styled-by-prettify">return</span><span styl=
e=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> v1</sp=
an><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pret=
tify">-></span><span style=3D"color:#000" class=3D"m_-260281733968786781=
2styled-by-prettify">wheels</span><span style=3D"color:#660" class=3D"m_-26=
02817339687867812styled-by-prettify">()</span><span style=3D"color:#000" cl=
ass=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D"col=
or:#660" class=3D"m_-2602817339687867812styled-by-prettify">></span><spa=
n style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> =
v2</span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-b=
y-prettify">-></span><span style=3D"color:#000" class=3D"m_-260281733968=
7867812styled-by-prettify">wheels</span><span style=3D"color:#660" class=3D=
"m_-2602817339687867812styled-by-prettify">()</span><span style=3D"color:#0=
00" class=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=
=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">?</span>=
<span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettif=
y"> </span><span style=3D"color:#066" class=3D"m_-2602817339687867812styled=
-by-prettify">1</span><span style=3D"color:#000" class=3D"m_-26028173396878=
67812styled-by-prettify"> </span><span style=3D"color:#660" class=3D"m_-260=
2817339687867812styled-by-prettify">:</span><span style=3D"color:#000" clas=
s=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D"color=
:#066" class=3D"m_-2602817339687867812styled-by-prettify">2</span><span sty=
le=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">;</spa=
n><span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prett=
ify"><br></span><span style=3D"color:#660" class=3D"m_-2602817339687867812s=
tyled-by-prettify">}</span><span style=3D"color:#000" class=3D"m_-260281733=
9687867812styled-by-prettify"><br><br></span><span style=3D"color:#008" cla=
ss=3D"m_-2602817339687867812styled-by-prettify">int</span><span style=3D"co=
lor:#000" class=3D"m_-2602817339687867812styled-by-prettify"> main</span><s=
pan style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-prettify"=
>()</span><font color=3D"#000000"><span style=3D"color:#000" class=3D"m_-26=
02817339687867812styled-by-prettify"> </span></font><span style=3D"color:#6=
60" class=3D"m_-2602817339687867812styled-by-prettify">{</span><span style=
=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#606" class=3D"m_-260281733968786781=
2styled-by-prettify">Car</span><span style=3D"color:#000" class=3D"m_-26028=
17339687867812styled-by-prettify"> c</span><span style=3D"color:#660" class=
=3D"m_-2602817339687867812styled-by-prettify">;</span><span style=3D"color:=
#000" class=3D"m_-2602817339687867812styled-by-prettify"><br>=C2=A0 =C2=A0 =
</span><span style=3D"color:#606" class=3D"m_-2602817339687867812styled-by-=
prettify">Bike</span><span style=3D"color:#000" class=3D"m_-260281733968786=
7812styled-by-prettify"> b</span><span style=3D"color:#660" class=3D"m_-260=
2817339687867812styled-by-prettify">;</span><span style=3D"color:#000" clas=
s=3D"m_-2602817339687867812styled-by-prettify"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color:#606" class=3D"m_-2602817339687867812styled-by-prettify">=
DemolitionDerby</span><span style=3D"color:#000" class=3D"m_-26028173396878=
67812styled-by-prettify"> dd</span><span style=3D"color:#660" class=3D"m_-2=
602817339687867812styled-by-prettify">(</span><span style=3D"color:#000" cl=
ass=3D"m_-2602817339687867812styled-by-prettify">b</span><span style=3D"col=
or:#660" class=3D"m_-2602817339687867812styled-by-prettify">,</span><span s=
tyle=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify"> c</=
span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-by-pr=
ettify">);</span><span style=3D"color:#000" class=3D"m_-2602817339687867812=
styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008" cla=
ss=3D"m_-2602817339687867812styled-by-prettify">assert</span><span style=3D=
"color:#660" class=3D"m_-2602817339687867812styled-by-prettify">(</span><sp=
an style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettify">=
dd</span><span style=3D"color:#660" class=3D"m_-2602817339687867812styled-b=
y-prettify">.</span><span style=3D"color:#000" class=3D"m_-2602817339687867=
812styled-by-prettify">winner</span><span style=3D"color:#660" class=3D"m_-=
2602817339687867812styled-by-prettify">()</span><span style=3D"color:#000" =
class=3D"m_-2602817339687867812styled-by-prettify"> </span><span style=3D"c=
olor:#660" class=3D"m_-2602817339687867812styled-by-prettify">=3D=3D</span>=
<span style=3D"color:#000" class=3D"m_-2602817339687867812styled-by-prettif=
y"> </span><span style=3D"color:#066" class=3D"m_-2602817339687867812styled=
-by-prettify">2</span><span style=3D"color:#660" class=3D"m_-26028173396878=
67812styled-by-prettify">);</span><span style=3D"color:#000" class=3D"m_-26=
02817339687867812styled-by-prettify"><br></span><span style=3D"color:#660" =
class=3D"m_-2602817339687867812styled-by-prettify">}</span></div></code></d=
iv><div><br></div></div><div style=3D"font-family:arial,sans-serif"><br></d=
iv><div><span style=3D"font-family:arial,sans-serif">Does anyone see a way =
to harmonize this latter example, so that it doesn't need so much IFG(.=
...) boilerplate?=C2=A0 Ideally the amount of boilerplate required would be =
O(1), just on the class definition, and not on any of the member function d=
efinitions; then I could take my existing classically-polymorphic codebase =
and recompile it with O(1) effort to produce a generic-programming template=
d version.</span></div><div><span style=3D"font-family:arial,sans-serif"><b=
r></span></div><div><span style=3D"font-family:arial,sans-serif">(Please as=
sume that this would in fact be a good idea in my case, and wouldn't ru=
n into any really deep architectural problems. I'm aware that if my ori=
ginal code's=C2=A0</span><font face=3D"courier new, monospace">Vehicle =
*v1, *v2;</font><font face=3D"arial, sans-serif"> had been </font><font fac=
e=3D"courier new, monospace">Vehicle *vs[2];</font><font face=3D"arial, san=
s-serif"> instead, I'd have had serious problems. Let's assume that=
either I don't have such problems, or I'm willing to do the design=
work to patch them up; I'm just unwilling to maintain a codebase conta=
ining so many instances of IFP()/IFG().)</font></div><div><font face=3D"ari=
al, sans-serif"><br></font></div><div><font face=3D"arial, sans-serif">Basi=
cally, if we <i><b>assume for the sake of argument</b></i> that C++2a is go=
ing to get something like Concepts TS terse syntax, then I'd like to ex=
plore, in this thread, what other syntactic innovations would be necessary =
in order to make my </font><font face=3D"courier new, monospace">Demolition=
Derby</font><font face=3D"arial, sans-serif"> example look cleaner.</font><=
/div><div><font face=3D"arial, sans-serif"><br></font></div><div><span styl=
e=3D"font-family:arial,sans-serif">=E2=80=93Arthur</span><br></div></div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/5ec84628-4acf-4f40-83ce-4734f049aa7f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5ec84628-4acf-=
4f40-83ce-4734f049aa7f%40isocpp.org</a>.<br>
</blockquote></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CA%2BOm%2BSi1kDSbFJNGZ-EoaDZPsy5cv7c8=
OGyXpBVeaaUn1J%2BBfA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CA%2BOm%2BS=
i1kDSbFJNGZ-EoaDZPsy5cv7c8OGyXpBVeaaUn1J%2BBfA%40mail.gmail.com</a>.<br />
--001a113b1cbe7360760561b5c0b5--
.
Author: "Arthur O'Dwyer" <arthur.j.odwyer@gmail.com>
Date: Tue, 2 Jan 2018 12:42:08 -0800
Raw View
--f403045c28b8f50aeb0561d12127
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Sun, Dec 31, 2017 at 2:05 AM, <la.rizza.l.et.j@gmail.com> wrote:
> Le lundi 25 d=C3=A9cembre 2017 07:29:06 UTC+1, Arthur O'Dwyer a =C3=A9cri=
t :
>>
>> Can you clarify what you mean by "since you'll eventually hide the
>> concepts syntax"?
>>
>
> You are using IFP and IFG to select between defining/using concepts or
> ABCs to get a polymorphic abstraction.
>
Yes.
> IFP and IFG are used all around,
>
I still don't quite understand your premise, I think. The point of my
original post was that in the "simple" is_highway_safe() case, I don't need
to use IFP or IFG "all around." I write only one version of the
is_highway_safe() function, and it Just Works, with no IFP or IFG in sight.
(They're necessarily used in the definitions of the base/concept and
subclasses/models, but that's all stowed away in header files.)
#include "vehicle.h"
bool is_highway_safe(const Vehicle& v) // Is this a template or a
classically polymorphic function? We don't know and don't care!
{
return v.wheels() >=3D 4;
}
#include "bike.h"
int main() {
Bike b;
return is_highway_safe(b);
}
Similarly even in the DemolitionDerby case, we can write main() itself with
no IFP or IFG in sight:
#include "demolition-derby.h"
#include "car.h"
#include "bike.h"
int main() {
Car c;
Bike b;
DemolitionDerby dd(c, b); // Is this a CTAD'ed class template or a
plain old class? We don't know and don't care!
return dd.winner();
}
> I may be wrong, but if you want your class to be a class template in the
> "IFG active" case, should not the function be defined in the header anywa=
y,
> and be declared inline? More, it's shorter.
>
That would solve the problem, but I don't really want to move everything
into the class body in this case. The O(1) thing to do is just
=3D=3D demolition-derby.h =3D=3D
IFG(template<...>)
class DemolitionDerby {
...
int winner() const;
};
IFG( #include "demolition-derby.cpp" ) // because these now-template
functions' definitions need to be visible
(slightly fantasy syntax on that last line, but you all know how to write
it in C++)
However, there's going to be a lot of code in "demolition-derby.cpp" that
needs IFP and IFG added. In the simpler case, we only had to deal with
O(size-of-class-definition) changed lines. In this more complicated case,
we have to deal with
O(size-of-class-definition-plus-all-out-of-line-member-function-definitions=
)
changed lines.
You're trying to declare a function alternatively as a member of class or
> as a member of a class template. Maybe try to make DemolitionDerby a
> "parameterless template" instead of a class in the "IFP active" case.
>
Yeah, one of the things I did try in the process of "template-izing" this
particular piece of code was to make DemolitionDerby invariably a template,
and then if I wanted the classical implementation, I'd instantiate
DemolitionDerby<Vehicle, Vehicle> instead of e.g. DemolitionDerby<Car,
Bike>. This was good enough to get some quick and dirty benchmarks of
"classical" versus "generic" (and prove that `clang++ -O3 -flto` totally
wiped out the cost of virtual dispatch). But it was still a lot of manual
boilerplate to add `template<...>` onto all the methods of DemolitionDerby.
I'd love to see the language syntax evolve in a direction that makes that
kind of refactoring O(size-of-header-file) instead of O(size-of-cpp-file).
=E2=80=93Arthur
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CADvuK0L2qrLOBqFe2i2D0FtV1dnozADhrBHt8kUZ68BSmnX=
3cA%40mail.gmail.com.
--f403045c28b8f50aeb0561d12127
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sun, Dec 31, 2017 at 2:05 AM, <span dir=3D"ltr"><<a=
href=3D"mailto:la.rizza.l.et.j@gmail.com" target=3D"_blank">la.rizza.l.et.=
j@gmail.com</a>></span> wrote:<br><div class=3D"gmail_extra"><div class=
=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span clas=
s=3D"">Le lundi 25 d=C3=A9cembre 2017 07:29:06 UTC+1, Arthur O'Dwyer a =
=C3=A9crit=C2=A0:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin=
-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><=
div><div class=3D"gmail_quote"><div></div><div>Can you clarify what you mea=
n by "since you'll eventually hide the concepts syntax"?</div=
></div></div></div></blockquote><div><br></div></span><div>You are using IF=
P and IFG to select between defining/using concepts or ABCs to get a polymo=
rphic abstraction.</div></div></blockquote><div><br></div><div>Yes.</div><d=
iv>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex=
;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div> IFP an=
d IFG are used all around,</div></div></blockquote><div><br></div><div>I st=
ill don't quite understand your premise, I think. The point of my origi=
nal post was that in the "simple" is_highway_safe() case, I don&#=
39;t need to use IFP or IFG "all around." =C2=A0I write only one =
version of the is_highway_safe() function, and it Just Works, with no IFP o=
r IFG in sight. (They're necessarily used in the definitions of the bas=
e/concept and subclasses/models, but that's all stowed away in header f=
iles.)</div><div><br></div><div>=C2=A0 =C2=A0 #include "vehicle.h"=
;</div><div><br></div><div><div style=3D"font-size:13px">=C2=A0 =C2=A0 bool=
is_highway_safe(const Vehicle& v) =C2=A0 // Is this a template or a cl=
assically polymorphic function?=C2=A0 We don't know and don't care!=
</div><div style=3D"font-size:13px">=C2=A0 =C2=A0 {</div><div style=3D"font=
-size:13px">=C2=A0 =C2=A0 =C2=A0 =C2=A0 return v.wheels() >=3D 4;</div><=
div style=3D"font-size:13px">=C2=A0 =C2=A0 }<span class=3D"sewrfm6tybuyks">=
</span><span class=3D"sewdzlt5efg9efq"></span></div></div><div><br></div><d=
iv>=C2=A0 =C2=A0 #include "bike.h"</div><div><br></div><div>=C2=
=A0 =C2=A0 int main() {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 Bike b;</div>=
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 return is_highway_safe(b);</div><div>=C2=
=A0 =C2=A0 }</div><div><br></div><div>Similarly even in the DemolitionDerby=
case, we can write main() itself with no IFP or IFG in sight:</div><div><b=
r></div><div>=C2=A0 =C2=A0 #include "demolition-derby.h"</div><di=
v>=C2=A0 =C2=A0 #include "car.h"</div><div>=C2=A0 =C2=A0 #include=
"bike.h"</div><div><br></div><div>=C2=A0 =C2=A0 int main() {</di=
v><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 Car c;</div><div>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 Bike b;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 DemolitionDerby dd(c, =
b); =C2=A0// Is this a CTAD'ed class template or a plain old class?=C2=
=A0 We don't know and don't care!</div><div>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 return dd.winner();</div><div>=C2=A0 =C2=A0 }</div><div>=C2=A0<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>I may be wrong, bu=
t if you want your class to be a class template in the "IFG active&quo=
t; case, should not the function be defined in the header anyway, and be de=
clared inline? More, it's shorter.</div></div></blockquote><div><br></d=
iv><div>That would solve the problem, but I don't really want to move e=
verything into the class body in this case.=C2=A0 The O(1) thing to do is j=
ust</div><div><br></div><div>=C2=A0 =C2=A0 =3D=3D demolition-derby.h =3D=3D=
</div><div>=C2=A0 =C2=A0 IFG(template<...>)</div><div>=C2=A0 =C2=A0 c=
lass DemolitionDerby {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ...</div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 int winner() const;</div><div>=C2=A0 =C2=A0 };<=
/div><div>=C2=A0 =C2=A0 IFG( #include "demolition-derby.cpp" ) =
=C2=A0// because these now-template functions' definitions need to be v=
isible<br></div><div><br></div><div>(slightly fantasy syntax on that last l=
ine, but you all know how to write it in C++)</div><div><div>However, there=
's going to be a lot of code in "demolition-derby.cpp" that n=
eeds IFP and IFG added. In the simpler case, we only had to deal with O(siz=
e-of-class-definition) changed lines. In this more complicated case, we hav=
e to deal with O(size-of-class-definition-plus-all-out-of-line-member-funct=
ion-definitions) changed lines.</div></div><div><span class=3D"sewrfm6tybuy=
ks"></span><span class=3D"sewdzlt5efg9efq"></span><br></div><div><br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">You're trying to declar=
e a function alternatively as a member of class or as a member of a class t=
emplate. Maybe try to make DemolitionDerby a "parameterless template&q=
uot; instead of a class in the "IFP active" case.<br></div></bloc=
kquote><div><br></div><div>Yeah, one of the things I did try in the process=
of "template-izing" this particular piece of code was to make De=
molitionDerby invariably a template, and then if I wanted the classical imp=
lementation, I'd instantiate DemolitionDerby<Vehicle, Vehicle> in=
stead of e.g. DemolitionDerby<Car, Bike>. This was good enough to get=
some quick and dirty benchmarks of "classical" versus "gene=
ric" (and prove that `clang++ -O3 -flto` totally wiped out the cost of=
virtual dispatch). But it was still a lot of manual boilerplate to add `te=
mplate<...>` onto all the methods of DemolitionDerby. I'd love to=
see the language syntax evolve in a direction that makes that kind of refa=
ctoring O(size-of-header-file) instead of O(size-of-cpp-file).</div><div><b=
r></div><div>=E2=80=93Arthur</div></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CADvuK0L2qrLOBqFe2i2D0FtV1dnozADhrBHt=
8kUZ68BSmnX3cA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CADvuK0L2qrLOBqFe=
2i2D0FtV1dnozADhrBHt8kUZ68BSmnX3cA%40mail.gmail.com</a>.<br />
--f403045c28b8f50aeb0561d12127--
.
Author: "Arthur O'Dwyer" <arthur.j.odwyer@gmail.com>
Date: Tue, 2 Jan 2018 12:52:39 -0800
Raw View
--94eb2c1b51109d6ca90561d147f5
Content-Type: text/plain; charset="UTF-8"
On Mon, Jan 1, 2018 at 4:01 AM, Corentin <corentin.jabot@gmail.com> wrote:
> Crazy idea, given the current approach regarding meta classes:
> Take a set of non virtual class { Base, Inherited... }
>
> For each class make some functions of your choosing virtual.
> Inject the generated classes in the namespace under a new name.
>
> It would require to be able to generates or mutate the base specifiers
> list.
>
> Maybe even provide a polymorphic_t<T> that gives you the type of the
> generated class from the one of the "source" class.
>
> Then you can put different requirements on the nature of the parameters in
> DemolitionDerby
>
I'm not sure I understand your idea, but are you envisioning something like
- Swift "protocols"
- Go "interfaces"
- C++ "polymorphic adaptor classes"
(which are all essentially the same thing AFAIK)?
https://wandbox.org/permlink/56l2SjAIF7D0YTsS
A very few (and not-yet-standard) C++ concepts already have corresponding
polymorphic adaptor classes ready-made by the library.
queue_wrapper<T> inherits from queue_base whenever T models
WaitingConcurrentQueue:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0260r2.html#conqueues.tools.wrap
resource_adaptor<T> inherits from memory_resource whenever T models
Allocator: http://en.cppreference.com/w/cpp/experimental/resource_adaptor
This is definitely a useful pattern in C++, but it's useful for things that
aren't what I was asking for in this particular case. :)
Happy new year,
Arthur
--
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/CADvuK0LChJOLa9xt0RaswYNUC%2B9HzyRqJv7zS9bfRS78qN28ew%40mail.gmail.com.
--94eb2c1b51109d6ca90561d147f5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Mon, Jan 1, 2018 at 4:01 AM, Corentin <span dir=3D"ltr"=
><<a href=3D"mailto:corentin.jabot@gmail.com" target=3D"_blank">corentin=
..jabot@gmail.com</a>></span> wrote:<br><div class=3D"gmail_extra"><div c=
lass=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Crazy =
idea, given the current approach regarding meta classes:<div>Take a set of =
non virtual class { Base, Inherited... }</div><div><br></div><div>For each =
class make some functions of your choosing virtual.</div><div>Inject the ge=
nerated classes in the namespace under a new name.</div><div><br></div><div=
>It would require to be able to generates or mutate the base specifiers lis=
t.=C2=A0</div><div><br></div><div>Maybe even provide=C2=A0 a polymorphic_t&=
lt;T> that gives you the type of the generated class from the one of the=
"source" class.=C2=A0</div><div><br></div><div>Then you can put =
different requirements on the nature of the parameters in DemolitionDerby</=
div></div></blockquote><div><br></div><div>I'm not sure I understand yo=
ur idea, but are you envisioning something like</div><div>- Swift "pro=
tocols"</div><div>- Go "interfaces"</div><div>- C++ "po=
lymorphic adaptor classes"</div><div>(which are all essentially the sa=
me thing AFAIK)?</div><div><br></div><div><a href=3D"https://wandbox.org/pe=
rmlink/56l2SjAIF7D0YTsS">https://wandbox.org/permlink/56l2SjAIF7D0YTsS</a><=
span class=3D"sew66siu2qxj0qq"></span><span class=3D"sewndnyjqtp8607"></spa=
n><br></div><div>A very few (and not-yet-standard) C++ concepts already hav=
e corresponding polymorphic adaptor classes ready-made by the library.</div=
><div><br></div><div>queue_wrapper<T> inherits from queue_base whenev=
er T models WaitingConcurrentQueue:=C2=A0<a href=3D"http://www.open-std.org=
/jtc1/sc22/wg21/docs/papers/2017/p0260r2.html#conqueues.tools.wrap">http://=
www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0260r2.html#conqueues.too=
ls.wrap</a><span class=3D"sew66siu2qxj0qq"></span><span class=3D"sewndnyjqt=
p8607"></span><br></div><div>resource_adaptor<T> inherits from memory=
_resource whenever T models Allocator:=C2=A0<a href=3D"http://en.cppreferen=
ce.com/w/cpp/experimental/resource_adaptor">http://en.cppreference.com/w/cp=
p/experimental/resource_adaptor</a><br></div><div><span class=3D"sewndnyjqt=
p8607"></span></div><div><br></div><div>This is definitely a useful pattern=
in C++, but it's useful for things that aren't what I was asking f=
or in this particular case. :)</div><div><br></div><div>Happy new year,</di=
v><div>Arthur</div></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CADvuK0LChJOLa9xt0RaswYNUC%2B9HzyRqJv=
7zS9bfRS78qN28ew%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CADvuK0LChJOLa9=
xt0RaswYNUC%2B9HzyRqJv7zS9bfRS78qN28ew%40mail.gmail.com</a>.<br />
--94eb2c1b51109d6ca90561d147f5--
.
Author: Corentin <corentin.jabot@gmail.com>
Date: Tue, 02 Jan 2018 22:08:52 +0000
Raw View
--001a113f0024bebbcf0561d25859
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
That's not what I'm proposing.
I'm saying that the compiler could generate 2 classes ( one with a virtual
class, one without ) - from a single "source" virtual clas" without any new
syntax (beside the syntax fore code injection), but merely with a proper
application of code generation/reflexion. at least, we may want to be able
to do that with code injection.
I don't think the concept proposal should be changed in anyway - not that
both implementations (polymorphic or not ) match the same requirements, so
just use a distinct identifier for your concept. Maybe one that would not
suggest that airplanes are highway safe.
Le mar. 2 janv. 2018 =C3=A0 21:52, Arthur O'Dwyer <arthur.j.odwyer@gmail.co=
m> a
=C3=A9crit :
> On Mon, Jan 1, 2018 at 4:01 AM, Corentin <corentin.jabot@gmail.com> wrote=
:
>
>> Crazy idea, given the current approach regarding meta classes:
>> Take a set of non virtual class { Base, Inherited... }
>>
>> For each class make some functions of your choosing virtual.
>> Inject the generated classes in the namespace under a new name.
>>
>> It would require to be able to generates or mutate the base specifiers
>> list.
>>
>> Maybe even provide a polymorphic_t<T> that gives you the type of the
>> generated class from the one of the "source" class.
>>
>> Then you can put different requirements on the nature of the parameters
>> in DemolitionDerby
>>
>
> I'm not sure I understand your idea, but are you envisioning something li=
ke
> - Swift "protocols"
> - Go "interfaces"
> - C++ "polymorphic adaptor classes"
> (which are all essentially the same thing AFAIK)?
>
> https://wandbox.org/permlink/56l2SjAIF7D0YTsS
> A very few (and not-yet-standard) C++ concepts already have corresponding
> polymorphic adaptor classes ready-made by the library.
>
> queue_wrapper<T> inherits from queue_base whenever T models
> WaitingConcurrentQueue:
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0260r2.html#conq=
ueues.tools.wrap
> resource_adaptor<T> inherits from memory_resource whenever T models
> Allocator: http://en.cppreference.com/w/cpp/experimental/resource_adaptor
>
> This is definitely a useful pattern in C++, but it's useful for things
> that aren't what I was asking for in this particular case. :)
>
> Happy new year,
> Arthur
>
> --
> 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/CADvuK0LChJO=
La9xt0RaswYNUC%2B9HzyRqJv7zS9bfRS78qN28ew%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CADvuK0LChJ=
OLa9xt0RaswYNUC%2B9HzyRqJv7zS9bfRS78qN28ew%40mail.gmail.com?utm_medium=3Dem=
ail&utm_source=3Dfooter>
> .
>
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CA%2BOm%2BSgTnGkgjCf16BLujokEPZj4jiQ933Dh4rUfFuO=
oi-24%3DQ%40mail.gmail.com.
--001a113f0024bebbcf0561d25859
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><br></div>That's not what I'm proposing.<div>=
I'm saying that the compiler could generate 2 classes ( one with a virt=
ual class, one without ) - from a single "source" virtual clas&qu=
ot; without any new syntax (beside the syntax fore code injection), but mer=
ely with a proper application of code generation/reflexion. at least, we ma=
y want to be able to do that with code injection.=C2=A0</div><div><br></div=
><div>I don't think the concept proposal should be changed in anyway - =
not that both implementations (polymorphic or not ) match the same requirem=
ents, so just use a distinct identifier for your concept. Maybe one that wo=
uld not suggest that airplanes are highway safe.=C2=A0=C2=A0</div><div><br>=
</div><div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr">=
Le=C2=A0mar. 2 janv. 2018 =C3=A0=C2=A021:52, Arthur O'Dwyer <<a href=
=3D"mailto:arthur.j.odwyer@gmail.com">arthur.j.odwyer@gmail.com</a>> a =
=C3=A9crit=C2=A0:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">=
On Mon, Jan 1, 2018 at 4:01 AM, Corentin <span dir=3D"ltr"><<a href=3D"m=
ailto:corentin.jabot@gmail.com" target=3D"_blank">corentin.jabot@gmail.com<=
/a>></span> wrote:<br></div><div dir=3D"ltr"><div class=3D"gmail_extra">=
<div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">=
Crazy idea, given the current approach regarding meta classes:<div>Take a s=
et of non virtual class { Base, Inherited... }</div><div><br></div><div>For=
each class make some functions of your choosing virtual.</div><div>Inject =
the generated classes in the namespace under a new name.</div><div><br></di=
v><div>It would require to be able to generates or mutate the base specifie=
rs list.=C2=A0</div><div><br></div><div>Maybe even provide=C2=A0 a polymorp=
hic_t<T> that gives you the type of the generated class from the one =
of the "source" class.=C2=A0</div><div><br></div><div>Then you ca=
n put different requirements on the nature of the parameters in DemolitionD=
erby</div></div></blockquote><div><br></div></div></div></div><div dir=3D"l=
tr"><div class=3D"gmail_extra"><div class=3D"gmail_quote"><div>I'm not =
sure I understand your idea, but are you envisioning something like</div><d=
iv>- Swift "protocols"</div><div>- Go "interfaces"</div=
><div>- C++ "polymorphic adaptor classes"</div><div>(which are al=
l essentially the same thing AFAIK)?</div><div><br></div><div><a href=3D"ht=
tps://wandbox.org/permlink/56l2SjAIF7D0YTsS" target=3D"_blank">https://wand=
box.org/permlink/56l2SjAIF7D0YTsS</a><span class=3D"m_6108518834766179491se=
w66siu2qxj0qq"></span><span class=3D"m_6108518834766179491sewndnyjqtp8607">=
</span><br></div><div>A very few (and not-yet-standard) C++ concepts alread=
y have corresponding polymorphic adaptor classes ready-made by the library.=
</div><div><br></div><div>queue_wrapper<T> inherits from queue_base w=
henever T models WaitingConcurrentQueue:=C2=A0<a href=3D"http://www.open-st=
d.org/jtc1/sc22/wg21/docs/papers/2017/p0260r2.html#conqueues.tools.wrap" ta=
rget=3D"_blank">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p02=
60r2.html#conqueues.tools.wrap</a><span class=3D"m_6108518834766179491sew66=
siu2qxj0qq"></span><span class=3D"m_6108518834766179491sewndnyjqtp8607"></s=
pan><br></div><div>resource_adaptor<T> inherits from memory_resource =
whenever T models Allocator:=C2=A0<a href=3D"http://en.cppreference.com/w/c=
pp/experimental/resource_adaptor" target=3D"_blank">http://en.cppreference.=
com/w/cpp/experimental/resource_adaptor</a><br></div><div><span class=3D"m_=
6108518834766179491sewndnyjqtp8607"></span></div><div><br></div><div>This i=
s definitely a useful pattern in C++, but it's useful for things that a=
ren't what I was asking for in this particular case. :)</div><div><br><=
/div><div>Happy new year,</div><div>Arthur</div></div></div></div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/CADvuK0LChJOLa9xt0RaswYNUC%2B9HzyRqJv=
7zS9bfRS78qN28ew%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/std-pro=
posals/CADvuK0LChJOLa9xt0RaswYNUC%2B9HzyRqJv7zS9bfRS78qN28ew%40mail.gmail.c=
om</a>.<br>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CA%2BOm%2BSgTnGkgjCf16BLujokEPZj4jiQ9=
33Dh4rUfFuOoi-24%3DQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CA%2BOm%2BS=
gTnGkgjCf16BLujokEPZj4jiQ933Dh4rUfFuOoi-24%3DQ%40mail.gmail.com</a>.<br />
--001a113f0024bebbcf0561d25859--
.
Author: "Arthur O'Dwyer" <arthur.j.odwyer@gmail.com>
Date: Tue, 2 Jan 2018 14:47:34 -0800
Raw View
--94eb2c1b5110894bc50561d2e2b5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Tue, Jan 2, 2018 at 2:08 PM, Corentin <corentin.jabot@gmail.com> wrote:
>
> I don't think the concept proposal should be changed in anyway - not that
> both implementations (polymorphic or not ) match the same requirements, s=
o
> just use a distinct identifier for your concept. Maybe one that would not
> suggest that airplanes are highway safe.
>
I remain confused as to your premises.
My original example was
bool is_highway_safe(const Vehicle& v) {
return v.wheels() >=3D 4;
}
Assuming the model
struct Airplane {
int wheels() const { return 3; }
};
then indeed
bool b =3D is_highway_safe(Airplane{});
assert(b =3D=3D false);
Although maybe you're thinking of a different style of airplane
<https://imgur.com/MS2PP1g>...?
=E2=80=93Arthur
--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CADvuK0%2B7q4rCVixZDeM68Gkf4XLxtUnQ3xSwGcP5E5nG-=
%3DJRXg%40mail.gmail.com.
--94eb2c1b5110894bc50561d2e2b5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Tue, Jan 2, 2018 at 2:08 PM, Corentin <span dir=3D"ltr"=
><<a href=3D"mailto:corentin.jabot@gmail.com" target=3D"_blank">corentin=
..jabot@gmail.com</a>></span> wrote:<br><div class=3D"gmail_extra"><div c=
lass=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 =
0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><=
br></div><div>I don't think the concept proposal should be changed in a=
nyway - not that both implementations (polymorphic or not ) match the same =
requirements, so just use a distinct identifier for your concept. Maybe one=
that would not suggest that airplanes are highway safe. =C2=A0</div></div>=
</blockquote><div><br></div><div>I remain confused as to your premises.</di=
v><div>My original example was</div><div><br></div><div><span class=3D"m_86=
33087474641280322styled-by-prettify" style=3D"font-family:monospace;font-si=
ze:10px;color:rgb(0,0,136)">bool</span><span class=3D"m_8633087474641280322=
styled-by-prettify" style=3D"font-family:monospace;font-size:10px;color:rgb=
(0,0,0)">=C2=A0is_highway_safe</span><span class=3D"m_8633087474641280322st=
yled-by-prettify" style=3D"font-family:monospace;font-size:10px;color:rgb(1=
02,102,0)">(</span><span class=3D"m_8633087474641280322styled-by-prettify" =
style=3D"font-family:monospace;font-size:10px;color:rgb(0,0,136)">const</sp=
an><span class=3D"m_8633087474641280322styled-by-prettify" style=3D"font-fa=
mily:monospace;font-size:10px;color:rgb(0,0,0)">=C2=A0</span><span class=3D=
"m_8633087474641280322styled-by-prettify" style=3D"font-family:monospace;fo=
nt-size:10px;color:rgb(102,0,102)">Vehicle</span><span class=3D"m_863308747=
4641280322styled-by-prettify" style=3D"font-family:monospace;font-size:10px=
;color:rgb(102,102,0)">&</span><span class=3D"m_8633087474641280322styl=
ed-by-prettify" style=3D"font-family:monospace;font-size:10px;color:rgb(0,0=
,0)">=C2=A0v</span><span class=3D"m_8633087474641280322styled-by-prettify" =
style=3D"font-family:monospace;font-size:10px;color:rgb(102,102,0)">)</span=
><font color=3D"#000000" style=3D"font-family:monospace;font-size:10px"><sp=
an class=3D"m_8633087474641280322styled-by-prettify">=C2=A0</span></font><s=
pan class=3D"m_8633087474641280322styled-by-prettify" style=3D"font-family:=
monospace;font-size:10px;color:rgb(102,102,0)">{</span><span class=3D"m_863=
3087474641280322styled-by-prettify" style=3D"font-family:monospace;font-siz=
e:10px;color:rgb(0,0,0)"><br>=C2=A0 =C2=A0=C2=A0</span><span class=3D"m_863=
3087474641280322styled-by-prettify" style=3D"font-family:monospace;font-siz=
e:10px;color:rgb(0,0,136)">return</span><span class=3D"m_863308747464128032=
2styled-by-prettify" style=3D"font-family:monospace;font-size:10px;color:rg=
b(0,0,0)">=C2=A0v</span><span class=3D"m_8633087474641280322styled-by-prett=
ify" style=3D"font-family:monospace;font-size:10px;color:rgb(102,102,0)">.<=
/span><span class=3D"m_8633087474641280322styled-by-prettify" style=3D"font=
-family:monospace;font-size:10px;color:rgb(0,0,0)">wheels</span><span class=
=3D"m_8633087474641280322styled-by-prettify" style=3D"font-family:monospace=
;font-size:10px;color:rgb(102,102,0)">()</span><span class=3D"m_86330874746=
41280322styled-by-prettify" style=3D"font-family:monospace;font-size:10px;c=
olor:rgb(0,0,0)">=C2=A0</span><span class=3D"m_8633087474641280322styled-by=
-prettify" style=3D"font-family:monospace;font-size:10px;color:rgb(102,102,=
0)">>=3D</span><span class=3D"m_8633087474641280322styled-by-prettify" s=
tyle=3D"font-family:monospace;font-size:10px;color:rgb(0,0,0)">=C2=A0</span=
><span class=3D"m_8633087474641280322styled-by-prettify" style=3D"font-fami=
ly:monospace;font-size:10px;color:rgb(0,102,102)">4</span><span class=3D"m_=
8633087474641280322styled-by-prettify" style=3D"font-family:monospace;font-=
size:10px;color:rgb(102,102,0)">;</span><span class=3D"m_863308747464128032=
2styled-by-prettify" style=3D"font-family:monospace;font-size:10px;color:rg=
b(0,0,0)"><br></span><span class=3D"m_8633087474641280322styled-by-prettify=
" style=3D"font-family:monospace;font-size:10px;color:rgb(102,102,0)">}<spa=
n class=3D"sewr41iym5pnn6c"></span><span class=3D"sewf3tbvg5fk9ry"></span><=
/span><br></div><div>=C2=A0</div><div>Assuming the model</div><div><br></di=
v><div>=C2=A0 =C2=A0 struct Airplane {</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 int wheels() const { return 3; }</div><div>=C2=A0 =C2=A0 };<br></div><d=
iv><br></div><div>then indeed</div><div><br></div><div>=C2=A0 =C2=A0 bool b=
=3D is_highway_safe(Airplane{});</div><div>=C2=A0 =C2=A0 assert(b =3D=3D f=
alse);</div><div><br></div><div>Although maybe you're thinking of <a hr=
ef=3D"https://imgur.com/MS2PP1g">a different style of airplane</a>...?</div=
><div><br></div><div>=E2=80=93Arthur<br></div></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CADvuK0%2B7q4rCVixZDeM68Gkf4XLxtUnQ3x=
SwGcP5E5nG-%3DJRXg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CADvuK0%2B7q4=
rCVixZDeM68Gkf4XLxtUnQ3xSwGcP5E5nG-%3DJRXg%40mail.gmail.com</a>.<br />
--94eb2c1b5110894bc50561d2e2b5--
.