Topic: Toward Opaque Typedefs for C++1Y
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Sun, 03 Feb 2013 17:24:49 +0100
Raw View
This is a multi-part message in MIME format.
--------------080003000702040504000708
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi,
N3515 uses the following syntax to change the return type and to delete
some non-member operator
Toward Opaque Typedefs for C++1Y using energy = protected double {
energy operator+ (energy , energy) = default;
energy& operator*=(energy&, double) = default;
energy operator* (energy , energy) = delete;
energy operator* (energy , double) = default;
energy operator* (double , energy) = default;
};
How the compiler would make the difference between member and non-member
functions?
BTW,
energy& operator*=(energy&, double) = default;
should be
energy& operator*=(double) = default;
As operator*= can be overloaded only inside a class.
I see thatsome parts have been removed from the previous version, as
". How shall OT's unary type traits be defined?
Proposed answer: for each category and property defined by TR1,
is_category(OT) ==
is_category(UT) shall be true, and
has_property(OT) == has_property(UT) shall also be true"
substitutability and casts. There were some opposition to these parts
from the comitte? Could you explain why you removed them?
Best,
Vicente
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.
--------------080003000702040504000708
Content-Type: text/html; charset=ISO-8859-1
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
N3515 uses the following syntax to change the return type and to
delete some non-member operator<br>
<br>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>Toward Opaque Typedefs for C++1Y</title>
using energy = protected double {<br>
energy operator+ (energy , energy) = default; <br>
energy& operator*=(energy&, double) = default;<br>
energy operator* (energy , energy) = delete;<br>
energy operator* (energy , double) = default;<br>
energy operator* (double , energy) = default;<br>
};<br>
<br>
How the compiler would make the difference between member and
non-member functions?<br>
<br>
BTW, <br>
<br>
energy& operator*=(energy&, double) = default;<br>
<br>
should be <br>
<br>
energy& operator*=(double) = default;<br>
<br>
As operator*= can be overloaded only inside a class. <br>
<br>
<br>
I see thatsome parts have been removed from the previous version, as
<br>
<br>
". How shall OT’s unary type traits be defined?<br>
Proposed answer: for each category and property defined by TR1,
is_category(OT) ==<br>
is_category(UT) shall be true, and<br>
has_property(OT) == has_property(UT) shall also be true"<br>
<br>
substitutability and casts. There were some opposition to these
parts from the comitte? Could you explain why you removed them?<br>
<br>
Best,<br>
Vicente <br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en">http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en</a>.<br />
<br />
<br />
--------------080003000702040504000708--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Sun, 03 Feb 2013 18:01:48 +0100
Raw View
Le 03/02/13 17:24, Vicente J. Botet Escriba a =E9crit :
Hi again, one more question. Could we forward declare an opaque type,=20
so that two opaque types can refer to each other?
using X=3D?.
using Y =3D protected double {
Y operator* (Y , X);
};
using X =3D protected double {
X operator* (X , Y);
};
Best,
Vicente
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/?hl=3Den.
.
Author: mitchnull@gmail.com
Date: Tue, 18 Mar 2014 02:44:47 -0700 (PDT)
Raw View
------=_Part_80_391688.1395135887886
Content-Type: text/plain; charset=UTF-8
Shouldn't the example in section 9 (Opaque template aliases) in
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/*n3515*.pdf use T
instead of double? Like this:
template <class T = double> using energy = protected T {
> energy operator+ (energy , energy) = default;
> energy& operator*=(energy&, T) = default;
> energy operator* (energy , energy) = delete;
> energy operator* (energy , T) = default;
> energy operator* (T , energy) = default;
> };
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_80_391688.1395135887886
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Shouldn't the example in section 9 (Opaque template aliase=
s) in <span style=3D"line-height: 18px;">http://www.open-std.org/jtc1/=
sc22/wg21/docs/papers/2013/</span><b style=3D"line-height: 18px;">n3515</b>=
<span style=3D"line-height: 18px;">.pdf use T instead of double? Like this:=
</span><div><span style=3D"line-height: 18px; font-size: 13px;"><br></span>=
</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;"><font face=3D"courier new, monospace"><s=
pan style=3D"line-height: 18px; font-size: 13px;">template <class T =3D =
double> using energy =3D protected T {<br></span></font><font face=3D"co=
urier new, monospace"> energy operator+ (energy , energy) =3D d=
efault;<br></font><font face=3D"courier new, monospace"> energy=
& operator*=3D(energy&, T) =3D default;<br></font><font face=3D"cou=
rier new, monospace"> energy operator* (energy , energy) =3D de=
lete;<br></font><font face=3D"courier new, monospace"> energy o=
perator* (energy , T) =3D default;<br></font><font face=3D"courier new, mon=
ospace"> energy operator* (T , energy) =3D default;<br></font><=
span style=3D"font-size: 13px;"><font face=3D"courier new, monospace">};</f=
ont></span></blockquote><div><span style=3D"line-height: 18px;"><div><br></=
div></span></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_80_391688.1395135887886--
.
Author: Matheus Izvekov <mizvekov@gmail.com>
Date: Tue, 18 Mar 2014 03:52:41 -0700 (PDT)
Raw View
------=_Part_892_30308751.1395139961316
Content-Type: text/plain; charset=UTF-8
On Sunday, February 3, 2013 2:24:49 PM UTC-2, Vicente J. Botet Escriba
wrote:
>
> Hi,
>
> N3515 uses the following syntax to change the return type and to delete
> some non-member operator
>
> using energy = protected double {
> energy operator+ (energy , energy) = default;
> energy& operator*=(energy&, double) = default;
> energy operator* (energy , energy) = delete;
> energy operator* (energy , double) = default;
> energy operator* (double , energy) = default;
> };
>
> How the compiler would make the difference between member and non-member
> functions?
>
>
I don't think the member forms of the operators are supposed to be
supported.
> BTW,
>
> energy& operator*=(energy&, double) = default;
>
> should be
>
> energy& operator*=(double) = default;
>
> As operator*= can be overloaded only inside a class.
>
>
I think that's on purpose, it is meant to introduce a new non-member
operatorX= form.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_892_30308751.1395139961316
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, February 3, 2013 2:24:49 PM UTC-2, Vicente J. B=
otet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
Hi,<br>
<br>
N3515 uses the following syntax to change the return type and to
delete some non-member operator<br>
<br>
=20
=20
using energy =3D protected double {<br>
energy operator+ (energy , energy) =3D default; <br>
energy& operator*=3D(energy&, double) =3D default;<br>
energy operator* (energy , energy) =3D delete;<br>
energy operator* (energy , double) =3D default;<br>
energy operator* (double , energy) =3D default;<br>
};<br>
<br>
How the compiler would make the difference between member and
non-member functions?<br>
<br></div></blockquote><div><br>I don't think the member forms of the o=
perators are supposed to be supported.<br> </div><blockquote class=3D"=
gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc so=
lid;padding-left: 1ex;"><div bgcolor=3D"#FFFFFF" text=3D"#000000">
BTW, <br>
<br>
energy& operator*=3D(energy&, double) =3D default;<br>
<br>
should be <br>
<br>
energy& operator*=3D(double) =3D default;<br>
<br>
As operator*=3D can be overloaded only inside a class. <br>
<br></div></blockquote><div><br>I think that's on purpose, it is meant =
to introduce a new non-member operatorX=3D form.<br></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_892_30308751.1395139961316--
.
Author: Scott Prager <splinterofchaos@gmail.com>
Date: Wed, 2 Apr 2014 22:31:27 -0700 (PDT)
Raw View
------=_Part_2166_14626489.1396503087177
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Sunday, February 3, 2013 12:01:48 PM UTC-5, Vicente J. Botet Escriba=20
wrote:
>
> Le 03/02/13 17:24, Vicente J. Botet Escriba a =C3=AF=C2=BF=C2=BDcrit :=20
>
> Hi again, one more question. Could we forward declare an opaque type,=20
> so that two opaque types can refer to each other?=20
>
The paper says:
Much like a classical typedef, such a declaration introduces a new name=20
>> (the identifier) for an
>
> opaque type that implicitly shares the definition of the underlying type=
=20
>> named by the type-id.
>
> Thus, every opaque alias constitutes a definition; there are no forward=
=20
>> declarations of an opaque
>
> type.
>
> =20
>
> using X=3D?.=20
>
> using Y =3D protected double {=20
> Y operator* (Y , X);=20
> };=20
>
> using X =3D protected double {=20
> X operator* (X , Y);=20
> };=20
>
I can think of an example where this would be useful (representing angles=
=20
with *Radians* and *Degrees* where there exists no common type to=20
"trampoline" off of). It's interesting because we can't necessarily forward=
=20
declare typedefs and aliases in any useful way, but we can for types and=20
these opaque template aliases aim to look like types.=20
=20
>
> Best,=20
> Vicente=20
>
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_2166_14626489.1396503087177
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Sunday, February 3, 2013 12:01:48 PM UTC-5, Vic=
ente J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Le=
03/02/13 17:24, Vicente J. Botet Escriba a =C3=AF=C2=BF=C2=BDcrit :
<br>
<br>Hi again, one more question. Could we forward declare an opaque t=
ype,=20
<br>so that two opaque types can refer to each other?
<br></blockquote><div><br></div><div>The paper says:</div><div><br></div><b=
lockquote 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;"><blockquote class=3D"gmail_quote" style=3D"margi=
n: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 2=
04, 204); border-left-style: solid; padding-left: 1ex;">Much like a classic=
al typedef, such a declaration introduces a new name (the identifier) for a=
n</blockquote><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0p=
x 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); bor=
der-left-style: solid; padding-left: 1ex;">opaque type that implicitly shar=
es the definition of the underlying type named by the type-id.</blockquote>=
<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; borde=
r-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style=
: solid; padding-left: 1ex;">Thus, every opaque alias constitutes a definit=
ion; there are no forward declarations of an opaque</blockquote><blockquote=
class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left-widt=
h: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; pa=
dding-left: 1ex;">type.</blockquote></blockquote><div> </div><blockquo=
te class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left:=
1px #ccc solid;padding-left: 1ex;">
<br>using X=3D?.
<br>
<br>using Y =3D protected double {
<br> Y operator* (Y , X);
<br>};
<br>
<br>using X =3D protected double {
<br> X operator* (X , Y);
<br>};
<br></blockquote><div><br></div><div>I can think of an example where this w=
ould be useful (representing angles with <i>Radians</i> and <i>Degrees=
</i> where there exists no common type to "trampoline" off of). It's i=
nteresting because we can't necessarily forward declare typedefs and aliase=
s in any useful way, but we can for types and these opaque template aliases=
aim to look like types. </div><div> </div><blockquote class=3D"g=
mail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc sol=
id;padding-left: 1ex;">
<br>Best,
<br>Vicente
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_2166_14626489.1396503087177--
.