Topic: Using :: to access the type of a variable
Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Wed, 26 Nov 2014 11:40:52 -0800 (PST)
Raw View
------=_Part_787_1191013381.1417030852994
Content-Type: multipart/alternative;
boundary="----=_Part_788_666820780.1417030852994"
------=_Part_788_666820780.1417030852994
Content-Type: text/plain; charset=UTF-8
I'm probably missing something trivial, couldn't this work?
std::vector<int> v;
v::const_iterator i;
--
---
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_788_666820780.1417030852994
Content-Type: text/html; charset=UTF-8
<div dir="ltr">I'm probably missing something trivial, couldn't this work?<div><br></div><div><div>std::vector<int> v;</div><div>v::const_iterator i;</div></div><div><br></div></div>
<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 <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />
------=_Part_788_666820780.1417030852994--
------=_Part_787_1191013381.1417030852994--
.
Author: Matthew Woehlke <mw_triad@users.sourceforge.net>
Date: Wed, 26 Nov 2014 16:14:51 -0500
Raw View
On 2014-11-26 14:40, Olaf van der Spek wrote:
> I'm probably missing something trivial, couldn't this work?
>
> std::vector<int> v;
> v::const_iterator i;
There's always 'decltype(v)::const_iterator i;'...
--
Matthew
--
---
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/.
.
Author: Chet <chet.skolos@gmail.com>
Date: Wed, 26 Nov 2014 14:37:16 -0800 (PST)
Raw View
------=_Part_5374_2119560766.1417041436974
Content-Type: multipart/alternative;
boundary="----=_Part_5375_999057726.1417041436974"
------=_Part_5375_999057726.1417041436974
Content-Type: text/plain; charset=UTF-8
I believe the following is well formed and outputs "D":
#include <iostream>
using namespace std;
namespace test
{
class C
{
public:
void foo()
{
cout << "C" << endl;
}
};
class D
{
public:
void foo()
{
cout << "D" << endl;
}
};
typedef D F;
}
class other
{
typedef test::C F;
};
int main() {
other test;
test::F f;
f.foo();
return 0;
}
On Wednesday, 26 November 2014 13:15:08 UTC-8, Matthew Woehlke wrote:
>
> On 2014-11-26 14:40, Olaf van der Spek wrote:
> > I'm probably missing something trivial, couldn't this work?
> >
> > std::vector<int> v;
> > v::const_iterator i;
>
> There's always 'decltype(v)::const_iterator i;'...
>
> --
> Matthew
>
>
--
---
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_5375_999057726.1417041436974
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>I believe the following is well formed and outputs "D=
":</div><div><br></div><div>#include <iostream></div><div>using names=
pace std;</div><div><br></div><div>namespace test</div><div>{</div><div><sp=
an class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>class C</div>=
<div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>{</di=
v><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>pu=
blic:</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> =
</span>void foo()</div><div><span class=3D"Apple-tab-span" style=3D"white-s=
pace:pre"> </span>{</div><div><span class=3D"Apple-tab-span" style=3D"whit=
e-space:pre"> </span>cout << "C" << endl;</div><div><span cla=
ss=3D"Apple-tab-span" style=3D"white-space:pre"> </span>}</div><div><span =
class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>};</div><div><sp=
an class=3D"Apple-tab-span" style=3D"white-space:pre"> </span></div><div><s=
pan class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>class D</div=
><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>{</d=
iv><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>p=
ublic:</div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> =
</span>void foo()</div><div><span class=3D"Apple-tab-span" style=3D"white-=
space:pre"> </span>{</div><div><span class=3D"Apple-tab-span" style=3D"whi=
te-space:pre"> </span>cout << "D" << endl;</div><div><span cl=
ass=3D"Apple-tab-span" style=3D"white-space:pre"> </span>}</div><div><span=
class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>};<span class=
=3D"Apple-tab-span" style=3D"white-space:pre"> </span></div><div><span clas=
s=3D"Apple-tab-span" style=3D"white-space:pre"> </span></div><div><span cla=
ss=3D"Apple-tab-span" style=3D"white-space:pre"> </span>typedef D F;</div><=
div>}</div><div><br></div><div>class other</div><div>{</div><div><span clas=
s=3D"Apple-tab-span" style=3D"white-space:pre"> </span>typedef test::C F;</=
div><div>};</div><div><br></div><div>int main() {</div><div><span class=3D"=
Apple-tab-span" style=3D"white-space:pre"> </span></div><div><span class=3D=
"Apple-tab-span" style=3D"white-space:pre"> </span>other test;</div><div><s=
pan class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>test::F f;</=
div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>f=
..foo();</div><div><br></div><div><span class=3D"Apple-tab-span" style=3D"wh=
ite-space:pre"> </span>return 0;</div><div>}</div><br>On Wednesday, 26 Nove=
mber 2014 13:15:08 UTC-8, Matthew Woehlke wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;">On 2014-11-26 14:40, Olaf van der Spek wrote:
<br>> I'm probably missing something trivial, couldn't this work?
<br>>=20
<br>> std::vector<int> v;
<br>> v::const_iterator i;
<br>
<br>There's always 'decltype(v)::const_iterator i;'...
<br>
<br>--=20
<br>Matthew
<br>
<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_5375_999057726.1417041436974--
------=_Part_5374_2119560766.1417041436974--
.
Author: David Krauss <potswa@gmail.com>
Date: Thu, 27 Nov 2014 07:24:20 +0800
Raw View
--Apple-Mail=_877CB0B4-2E45-4F4A-9C73-9933FD4AC928
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
On 2014=E2=80=9311=E2=80=9327, at 6:37 AM, Chet <chet.skolos@gmail.com> wro=
te:
> I believe the following is well formed and outputs "D":
More generally, the proposal is a big breaking change.
More specifically, name lookup of the LHS of the :: operator ignores (does =
not find) variables.
More practically, scoped enumerations can leverage this rule and would be a=
major point of breakage:
enum class state { // call type as =E2=80=9Cenum state=E2=80=9D
sleeping, excited, tired, bored
} state // variable is named =E2=80=9Cstate=E2=80=9D
=3D state::excited; // LHS of :: finds =E2=80=9Cenum state=E2=80=9D aut=
omatically
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--Apple-Mail=_877CB0B4-2E45-4F4A-9C73-9933FD4AC928
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014=
=E2=80=9311=E2=80=9327, at 6:37 AM, Chet <<a href=3D"mailto:chet.skolos@=
gmail.com">chet.skolos@gmail.com</a>> wrote:</div><br class=3D"Apple-int=
erchange-newline"><blockquote type=3D"cite"><div style=3D"font-family: Helv=
etica; font-size: 12px; font-style: normal; font-variant: normal; font-weig=
ht: normal; letter-spacing: normal; line-height: normal; orphans: auto; tex=
t-align: start; text-indent: 0px; text-transform: none; white-space: normal=
; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I belie=
ve the following is well formed and outputs "D":</div></blockquote></div><b=
r><div>More generally, the proposal is a big breaking change.</div><div><br=
></div><div>More specifically, name lookup of the LHS of the <font face=3D"=
Courier">::</font> operator ignores (does not find) variables.</div><div><b=
r></div><div>More practically, scoped enumerations can leverage this rule a=
nd would be a major point of breakage:</div><div><br></div><div><font face=
=3D"Courier">enum class state { // call type as =E2=80=9Cenum state=E2=
=80=9D</font></div><div><font face=3D"Courier"> sleeping, exci=
ted, tired, bored</font></div><div><font face=3D"Courier">} state // variab=
le is named =E2=80=9Cstate=E2=80=9D</font></div><div><font face=3D"Cou=
rier"> =3D state::excited; // LHS of :: finds =E2=80=9Cen=
um state=E2=80=9D automatically</font></div><div><br></div></body></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--Apple-Mail=_877CB0B4-2E45-4F4A-9C73-9933FD4AC928--
.
Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Thu, 27 Nov 2014 09:44:19 -0800 (PST)
Raw View
------=_Part_6194_1867972111.1417110259975
Content-Type: multipart/alternative;
boundary="----=_Part_6195_943834084.1417110259975"
------=_Part_6195_943834084.1417110259975
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Thursday, November 27, 2014 12:24:37 AM UTC+1, David Krauss wrote:
>
>
> On 2014=E2=80=9311=E2=80=9327, at 6:37 AM, Chet <chet....@gmail.com <java=
script:>> wrote:
>
> I believe the following is well formed and outputs "D":
>
>
> More generally, the proposal is a big breaking change.
>
> More specifically, name lookup of the LHS of the :: operator ignores=20
> (does not find) variables.
>
> More practically, scoped enumerations can leverage this rule and would be=
=20
> a major point of breakage:
>
> enum class state { // call type as =E2=80=9Cenum state=E2=80=9D
> sleeping, excited, tired, bored
> } state // variable is named =E2=80=9Cstate=E2=80=9D
> =3D state::excited; // LHS of :: finds =E2=80=9Cenum state=E2=80=9D a=
utomatically
>
> =20
If the type of the var wouldn't be state it'd break indeed, my bad...
I recently saw Jonathan Blow suggesting using dot to dereference pointers=
=20
(in addition to -> ) for a new language. It'd obviously not work in C++ for=
=20
smart pointers, but is there some breakage for raw pointers that I can't=20
think of right now?
--=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_6195_943834084.1417110259975
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Thursday, November 27, 2014 12:24:37 AM UTC+1, =
David Krauss wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div style=
=3D"word-wrap:break-word"><br><div><div>On 2014=E2=80=9311=E2=80=9327, at 6=
:37 AM, Chet <<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-m=
ailto=3D"Zu-JGwPC4EsJ" onmousedown=3D"this.href=3D'javascript:';return true=
;" onclick=3D"this.href=3D'javascript:';return true;">chet....@gmail.com</a=
>> wrote:</div><br><blockquote type=3D"cite"><div style=3D"font-family:H=
elvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:n=
ormal;letter-spacing:normal;line-height:normal;text-align:start;text-indent=
:0px;text-transform:none;white-space:normal;word-spacing:0px">I believe the=
following is well formed and outputs "D":</div></blockquote></div><br><div=
>More generally, the proposal is a big breaking change.</div><div><br></div=
><div>More specifically, name lookup of the LHS of the <font face=3D"Courie=
r">::</font> operator ignores (does not find) variables.</div><div><br></di=
v><div>More practically, scoped enumerations can leverage this rule and wou=
ld be a major point of breakage:</div><div><br></div><div><font face=3D"Cou=
rier">enum class state { // call type as =E2=80=9Cenum state=E2=80=9D<=
/font></div><div><font face=3D"Courier"> sleeping, excited, ti=
red, bored</font></div><div><font face=3D"Courier">} state // variable is n=
amed =E2=80=9Cstate=E2=80=9D</font></div><div><font face=3D"Courier">&=
nbsp; =3D state::excited; // LHS of :: finds =E2=80=9Cenum stat=
e=E2=80=9D automatically</font></div><div><br></div></div></blockquote><div=
> </div><div>If the type of the var wouldn't be state it'd break indee=
d, my bad...</div><div><br></div><div>I recently saw Jonathan Blow sug=
gesting using dot to dereference pointers (in addition to -> ) for a new=
language. It'd obviously not work in C++ for smart pointers, but is there =
some breakage for raw pointers that I can't think of right now?</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_6195_943834084.1417110259975--
------=_Part_6194_1867972111.1417110259975--
.