Topic: Changing lambda scope
Author: DeadMG <wolfeinstein@gmail.com>
Date: Sun, 26 May 2013 06:59:40 -0700 (PDT)
Raw View
------=_Part_2067_6843425.1369576780507
Content-Type: text/plain; charset=ISO-8859-1
Pursuant to a recent discussion, I have discovered that lambdas are a local
class to whatever scope they are nested in. This means that ADL can't find
operators for them. For example,
namespace X {
template<typename L, typename R> L operator+(L l, R r) {
//...
}
auto f() {
return [] {};
}
};
int main() {
1 + X::f(); // Fail
}
I propose that the wording be changed so that lambdas' associated namespace
should be the most nested namespace containing whatever scope they are
declared in. Having operators available to work on lambdas considerably
simplifies certain functional APIs, as you can just return a lambda
directly. However, the current wording would require using hand-created
types purely for the purpose of ADL.
Because the operators cannot be members, nor found by ADL in the current
wording, the only way for this to break existing code would be if they had
something like
template<typename L, typename R> L operator+(L l, R r) {
//...
}
namespace X {
template<typename L, typename R> L operator+(L l, R r) {
//...
}
auto f() {
return [] {};
}
};
int main() {
1 + X::f(); // Fail- global operator *and* ADL operator found, so it's
now ambiguous
}
However, having a global operator like this is a pretty pathological case.
--
---
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.
------=_Part_2067_6843425.1369576780507
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Pursuant to a recent discussion, I have discovered that lambdas are a local=
class to whatever scope they are nested in. This means that ADL can't find=
operators for them. For example,<div><br></div><div class=3D"prettyprint" =
style=3D"background-color: rgb(250, 250, 250); border: 1px solid rgb(187, 1=
87, 187); word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D=
"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">=
namespace</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
X </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">template<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> L</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> R</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">></span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> L </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">operator</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">+(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">L l=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> R r</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//...</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br> </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 sty=
le=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> f</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </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: #008;=
" class=3D"styled-by-prettify">return</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-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>&n=
bsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> main</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: #660;" class=3D"s=
tyled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br> </span><span style=3D"color: #066;" class=3D"st=
yled-by-prettify">1</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"> X</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">f</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">();</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" clas=
s=3D"styled-by-prettify">// Fail</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></div></code></div><div><br></div><div>I propose =
that the wording be changed so that lambdas' associated namespace should be=
the most nested namespace containing whatever scope they are declared in. =
Having operators available to work on lambdas considerably simplifies certa=
in functional APIs, as you can just return a lambda directly. However, the =
current wording would require using hand-created types purely for the purpo=
se of ADL.</div><div><br></div><div>Because the operators cannot be members=
, nor found by ADL in the current wording, the only way for this to break e=
xisting code would be if they had something like</div><div><br></div><div c=
lass=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border:=
1px solid rgb(187, 187, 187); word-wrap: break-word;"><code class=3D"prett=
yprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D=
"styled-by-prettify">template</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> L</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: #008;" class=3D"styled-by-prettify">typename</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> R</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> L </span><span style=3D"color:=
#008;" class=3D"styled-by-prettify">operator</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">+(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">L l</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> R r</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><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: #800;" class=3D"styled-by-prettify">//...</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></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: #=
008;" class=3D"styled-by-prettify">namespace</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> X </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br> </span><span style=3D"color: #008;" cla=
ss=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">typename</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> L</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> R</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">></span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> L </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">operator</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">+(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">L l</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> R r</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: #800;" class=3D"styled-by-prett=
ify">//...</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">auto</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> f</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</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: #008;" class=3D"styled-by-prettify">return</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"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
60;" 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;" cla=
ss=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-b=
y-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
main</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</sp=
an><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 s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">1</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">+</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">f</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #800;" class=3D"styled-by-prettify">// Fail- global o=
perator *and* ADL operator found, so it's now ambiguous</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span></div></code></div><div><d=
iv><br></div><div><br></div><div>However, having a global operator like thi=
s is a pretty pathological case.</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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_2067_6843425.1369576780507--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Sun, 26 May 2013 17:39:57 +0300
Raw View
--90e6ba308f8290f13404dda00173
Content-Type: text/plain; charset=ISO-8859-1
On 26 May 2013 16:59, DeadMG <wolfeinstein@gmail.com> wrote:
> Pursuant to a recent discussion, I have discovered that lambdas are a
> local class to whatever scope they are nested in. This means that ADL can't
> find operators for them. For example,
>
> namespace X {
> template<typename L, typename R> L operator+(L l, R r) {
> //...
> }
> auto f() {
> return [] {};
> }
> };
> int main() {
> 1 + X::f(); // Fail
> }
>
> I propose that the wording be changed so that lambdas' associated
> namespace should be the most nested namespace containing whatever scope
> they are declared in. Having operators available to work on lambdas
> considerably simplifies certain functional APIs, as you can just return a
> lambda directly. However, the current wording would require using
> hand-created types purely for the purpose of ADL.
>
Seems.. ..reasonable, I guess. I have trouble imagining when I would want
to use such a feature, so if you could
provide a bit more complete example, that would be nice.
--
---
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.
--90e6ba308f8290f13404dda00173
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 26 May 2013 16:59, DeadMG <span dir=3D"ltr"><<a href=3D"mailt=
o:wolfeinstein@gmail.com" target=3D"_blank">wolfeinstein@gmail.com</a>><=
/span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Pursuant to a recent discussion, I have disc=
overed that lambdas are a local class to whatever scope they are nested in.=
This means that ADL can't find operators for them. For example,<div>
<br></div><div style=3D"background-color:rgb(250,250,250);border:1px solid =
rgb(187,187,187);word-wrap:break-word"><code><div><span style=3D"color:#008=
">namespace</span><span style> X </span><span style=3D"color:#660">{</span>=
<span style><br>
=A0 =A0 </span><span style=3D"color:#008">template</span><span style=3D"col=
or:#660"><</span><span style=3D"color:#008">typename</span><span style> =
L</span><span style=3D"color:#660">,</span><span style> </span><span style=
=3D"color:#008">typename</span><span style> R</span><span style=3D"color:#6=
60">></span><span style> L </span><span style=3D"color:#008">operator</s=
pan><span style=3D"color:#660">+(</span><span style>L l</span><span style=
=3D"color:#660">,</span><span style> R r</span><span style=3D"color:#660">)=
</span><span style> </span><span style=3D"color:#660">{</span><span style><=
br>
=A0 =A0 =A0 =A0 </span><span style=3D"color:#800">//...</span><span style><=
br>=A0 =A0 </span><span style=3D"color:#660">}</span><span style><br>=A0 =
=A0 </span><span style=3D"color:#008">auto</span><span style> f</span><span=
style=3D"color:#660">()</span><span style> </span><span style=3D"color:#66=
0">{</span><span style><br>
=A0 =A0 =A0 =A0 </span><span style=3D"color:#008">return</span><span style>=
</span><span style=3D"color:#660">[]</span><span style> </span><span style=
=3D"color:#660">{};</span><span style><br>=A0 =A0 </span><span style=3D"col=
or:#660">}</span><span style><br>
</span><span style=3D"color:#660">};</span><span style><br></span><span sty=
le=3D"color:#008">int</span><span style> main</span><span style=3D"color:#6=
60">()</span><span style> </span><span style=3D"color:#660">{</span><span s=
tyle><br>
=A0 =A0 </span><span style=3D"color:#066">1</span><span style> </span><span=
style=3D"color:#660">+</span><span style> X</span><span style=3D"color:#66=
0">::</span><span style>f</span><span style=3D"color:#660">();</span><span =
style> </span><span style=3D"color:#800">// Fail</span><span style><br>
</span><span style=3D"color:#660">}</span></div></code></div><div><br></div=
><div>I propose that the wording be changed so that lambdas' associated=
namespace should be the most nested namespace containing whatever scope th=
ey are declared in. Having operators available to work on lambdas considera=
bly simplifies certain functional APIs, as you can just return a lambda dir=
ectly. However, the current wording would require using hand-created types =
purely for the purpose of ADL.</div>
</blockquote><div><br></div><div>Seems.. ..reasonable, I guess. I have trou=
ble imagining when I would want to use such a feature, so if you could<br>p=
rovide a bit more complete example, that would be nice.<br></div></div>
</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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--90e6ba308f8290f13404dda00173--
.
Author: DeadMG <wolfeinstein@gmail.com>
Date: Sun, 26 May 2013 07:50:36 -0700 (PDT)
Raw View
------=_Part_347_30355648.1369579836042
Content-Type: text/plain; charset=ISO-8859-1
Sure. Consider
namespace range {
template<typename R, typename L> auto operator|(L l, R r) {
return r(std::move(l));
}
template<typename T> auto map(T t) {
return [=](auto range) {
auto var = range();
if (var) return optional<typename std::decay<decltype(t(*var
))>::type>(t(*var));
return std::none;
};
}
}
int main() {
something
| range::map([]...)
| range::map([]...)
etc
}
It's part of a range design I am working on. I have implemented everything
I need but the lambda ADL problem means that I can't use lambdas when I
should be able to, because the range-combine operator| can't be found.
--
---
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.
------=_Part_347_30355648.1369579836042
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Sure. Consider<div><br></div><div class=3D"prettyprint" style=3D"background=
-color: rgb(250, 250, 250); border: 1px solid rgb(187, 187, 187); word-wrap=
: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">namespace</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> range </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: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> R</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> L</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">auto</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">|(</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">L l</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> R r</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #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">return</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> r</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">std</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">move</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">l</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> </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"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>auto</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> map<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">T t</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"colo=
r: #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: #008;" class=3D"styled-by-prettify">return</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">[=3D](</span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> range</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"><br> =
</span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">var</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> range</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br> =
</span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">if</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">var</span><spa=
n 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">return</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> optional</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify"><</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">decay</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
decltype</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">t</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(*</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">var</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">))>::</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">type</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">>(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">t</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(*</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">var</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">));</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">return</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">none</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"styl=
ed-by-prettify"><br> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> main</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">()</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br> something<br> =
</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">|</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ran=
ge</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">map</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">([]...)</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br> &=
nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">|</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> range</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">map</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">([]...)</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br> etc=
<br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</spa=
n></div></code></div><div><br></div><div>It's part of a range design I am w=
orking on. I have implemented everything I need but the lambda ADL problem =
means that I can't use lambdas when I should be able to, because the range-=
combine operator| can't be found.</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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_347_30355648.1369579836042--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Sun, 26 May 2013 19:01:27 +0300
Raw View
--001a11c3c42604d11a04dda125de
Content-Type: text/plain; charset=ISO-8859-1
On 26 May 2013 17:50, DeadMG <wolfeinstein@gmail.com> wrote:
> Sure. Consider
>
> namespace range {
> template<typename R, typename L> auto operator|(L l, R r) {
> return r(std::move(l));
> }
> template<typename T> auto map(T t) {
> return [=](auto range) {
> auto var = range();
> if (var) return optional<typename std::decay<decltype(t(*var
> ))>::type>(t(*var));
> return std::none;
> };
> }
> }
> int main() {
> something
> | range::map([]...)
> | range::map([]...)
> etc
> }
>
> It's part of a range design I am working on. I have implemented everything
> I need but the lambda ADL problem means that I can't use lambdas when I
> should be able to, because the range-combine operator| can't be found.
>
>
>
>
Thanks, that looks very reasonable. I'll ask Core for the status quo
rationale as a first step.
--
---
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.
--001a11c3c42604d11a04dda125de
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 26 May 2013 17:50, DeadMG <span dir=3D"ltr"><<a href=3D"mailt=
o:wolfeinstein@gmail.com" target=3D"_blank">wolfeinstein@gmail.com</a>><=
/span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Sure. Consider<div><br></div><div style=3D"b=
ackground-color:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wra=
p:break-word">
<code><div><span style=3D"color:#008">namespace</span><span style> range </=
span><span style=3D"color:#660">{</span><span style><br>=A0 =A0 </span><spa=
n style=3D"color:#008">template</span><span style=3D"color:#660"><</span=
><span style=3D"color:#008">typename</span><span style> R</span><span style=
=3D"color:#660">,</span><span style> </span><span style=3D"color:#008">type=
name</span><span style> L</span><span style=3D"color:#660">></span><span=
style> </span><span style=3D"color:#008">auto</span><span style> </span><s=
pan style=3D"color:#008">operator</span><span style=3D"color:#660">|(</span=
><span style>L l</span><span style=3D"color:#660">,</span><span style> R r<=
/span><span style=3D"color:#660">)</span><span style> </span><span style=3D=
"color:#660">{</span><span style><br>
=A0 =A0 =A0 =A0 </span><span style=3D"color:#008">return</span><span style>=
r</span><span style=3D"color:#660">(</span><span style>std</span><span sty=
le=3D"color:#660">::</span><span style>move</span><span style=3D"color:#660=
">(</span><span style>l</span><span style=3D"color:#660">));</span><span st=
yle><br>
=A0 =A0 </span><span style=3D"color:#660">}</span><span style><br>=A0 =A0 <=
/span><span style=3D"color:#008">template</span><span style=3D"color:#660">=
<</span><span style=3D"color:#008">typename</span><span style> T</span><=
span style=3D"color:#660">></span><span style> </span><span style=3D"col=
or:#008">auto</span><span style> map</span><span style=3D"color:#660">(</sp=
an><span style>T t</span><span style=3D"color:#660">)</span><span style> </=
span><span style=3D"color:#660">{</span><span style><br>
=A0 =A0 =A0 =A0 </span><span style=3D"color:#008">return</span><span style>=
</span><span style=3D"color:#660">[=3D](</span><span style=3D"color:#008">=
auto</span><span style> range</span><span style=3D"color:#660">)</span><spa=
n style> </span><span style=3D"color:#660">{</span><span style><br>
=A0 =A0 =A0 =A0 =A0 =A0 </span><span style=3D"color:#008">auto</span><span =
style> </span><span style=3D"color:#008">var</span><span style> </span><spa=
n style=3D"color:#660">=3D</span><span style> range</span><span style=3D"co=
lor:#660">();</span><span style><br>
=A0 =A0 =A0 =A0 =A0 =A0 </span><span style=3D"color:#008">if</span><span st=
yle> </span><span style=3D"color:#660">(</span><span style=3D"color:#008">v=
ar</span><span style=3D"color:#660">)</span><span style> </span><span style=
=3D"color:#008">return</span><span style> optional</span><span style=3D"col=
or:#660"><</span><span style=3D"color:#008">typename</span><span style> =
std</span><span style=3D"color:#660">::</span><span style>decay</span><span=
style=3D"color:#660"><</span><span style=3D"color:#008">decltype</span>=
<span style=3D"color:#660">(</span><span style>t</span><span style=3D"color=
:#660">(*</span><span style=3D"color:#008">var</span><span style=3D"color:#=
660">))>::</span><span style>type</span><span style=3D"color:#660">>(=
</span><span style>t</span><span style=3D"color:#660">(*</span><span style=
=3D"color:#008">var</span><span style=3D"color:#660">));</span><span style>=
<br>
=A0 =A0 =A0 =A0 =A0 =A0 </span><span style=3D"color:#008">return</span><spa=
n style> std</span><span style=3D"color:#660">::</span><span style>none</sp=
an><span style=3D"color:#660">;</span><span style><br>=A0 =A0 =A0 =A0 </spa=
n><span style=3D"color:#660">};</span><span style><br>
=A0 =A0 </span><span style=3D"color:#660">}</span><span style><br></span><s=
pan style=3D"color:#660">}</span><span style><br></span><span style=3D"colo=
r:#008">int</span><span style> main</span><span style=3D"color:#660">()</sp=
an><span style> </span><span style=3D"color:#660">{</span><span style><br>
=A0 =A0 something<br>=A0 =A0 =A0 =A0 </span><span style=3D"color:#660">|</s=
pan><span style> range</span><span style=3D"color:#660">::</span><span styl=
e>map</span><span style=3D"color:#660">([]...)</span><span style><br>=A0 =
=A0 =A0 =A0 </span><span style=3D"color:#660">|</span><span style> range</s=
pan><span style=3D"color:#660">::</span><span style>map</span><span style=
=3D"color:#660">([]...)</span><span style><br>
=A0 =A0 =A0 =A0 etc<br></span><span style=3D"color:#660">}</span></div></co=
de></div><div><br></div><div>It's part of a range design I am working o=
n. I have implemented everything I need but the lambda ADL problem means th=
at I can't use lambdas when I should be able to, because the range-comb=
ine operator| can't be found.</div>
<div class=3D"HOEnZb"><div class=3D"h5">
<p></p>
<br><br></div></div></blockquote><div><br></div><div>Thanks, that looks ver=
y reasonable. I'll ask Core for the status quo rationale as a first ste=
p. <br></div></div><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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--001a11c3c42604d11a04dda125de--
.
Author: Richard Smith <richard@metafoo.co.uk>
Date: Sun, 26 May 2013 15:30:36 -0700
Raw View
--047d7bacbcceb6440f04dda69480
Content-Type: text/plain; charset=ISO-8859-1
On Sun, May 26, 2013 at 9:01 AM, Ville Voutilainen <
ville.voutilainen@gmail.com> wrote:
>
>
>
> On 26 May 2013 17:50, DeadMG <wolfeinstein@gmail.com> wrote:
>
>> Sure. Consider
>>
>> namespace range {
>> template<typename R, typename L> auto operator|(L l, R r) {
>> return r(std::move(l));
>> }
>> template<typename T> auto map(T t) {
>> return [=](auto range) {
>> auto var = range();
>> if (var) return optional<typename std::decay<decltype(t(*var
>> ))>::type>(t(*var));
>> return std::none;
>> };
>> }
>> }
>> int main() {
>> something
>> | range::map([]...)
>> | range::map([]...)
>> etc
>> }
>>
>> It's part of a range design I am working on. I have implemented
>> everything I need but the lambda ADL problem means that I can't use lambdas
>> when I should be able to, because the range-combine operator| can't be
>> found.
>>
>>
>>
>>
> Thanks, that looks very reasonable. I'll ask Core for the status quo
> rationale as a first step.
>
Should this apply only to lambdas, or to all local classes?
--
---
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.
--047d7bacbcceb6440f04dda69480
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Sun, May 26, 2013 at 9:01 AM, Ville Voutilainen <span dir=3D"ltr"><<a=
href=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">ville.voutil=
ainen@gmail.com</a>></span> wrote:<br><div class=3D"gmail_quote"><blockq=
uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc =
solid;padding-left:1ex">
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote"><div class=3D"im">On 26 May 2013 17:50, DeadMG <span dir=3D"ltr">&l=
t;<a href=3D"mailto:wolfeinstein@gmail.com" target=3D"_blank">wolfeinstein@=
gmail.com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Sure. Consider<div><br></div><div style=3D"b=
ackground-color:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wra=
p:break-word">
<code><div><span style=3D"color:#008">namespace</span><span> range </span><=
span style=3D"color:#660">{</span><span><br>=A0 =A0 </span><span style=3D"c=
olor:#008">template</span><span style=3D"color:#660"><</span><span style=
=3D"color:#008">typename</span><span> R</span><span style=3D"color:#660">,<=
/span><span> </span><span style=3D"color:#008">typename</span><span> L</spa=
n><span style=3D"color:#660">></span><span> </span><span style=3D"color:=
#008">auto</span><span> </span><span style=3D"color:#008">operator</span><s=
pan style=3D"color:#660">|(</span><span>L l</span><span style=3D"color:#660=
">,</span><span> R r</span><span style=3D"color:#660">)</span><span> </span=
><span style=3D"color:#660">{</span><span><br>
=A0 =A0 =A0 =A0 </span><span style=3D"color:#008">return</span><span> r</sp=
an><span style=3D"color:#660">(</span><span>std</span><span style=3D"color:=
#660">::</span><span>move</span><span style=3D"color:#660">(</span><span>l<=
/span><span style=3D"color:#660">));</span><span><br>
=A0 =A0 </span><span style=3D"color:#660">}</span><span><br>=A0 =A0 </span>=
<span style=3D"color:#008">template</span><span style=3D"color:#660"><</=
span><span style=3D"color:#008">typename</span><span> T</span><span style=
=3D"color:#660">></span><span> </span><span style=3D"color:#008">auto</s=
pan><span> map</span><span style=3D"color:#660">(</span><span>T t</span><sp=
an style=3D"color:#660">)</span><span> </span><span style=3D"color:#660">{<=
/span><span><br>
=A0 =A0 =A0 =A0 </span><span style=3D"color:#008">return</span><span> </spa=
n><span style=3D"color:#660">[=3D](</span><span style=3D"color:#008">auto</=
span><span> range</span><span style=3D"color:#660">)</span><span> </span><s=
pan style=3D"color:#660">{</span><span><br>
=A0 =A0 =A0 =A0 =A0 =A0 </span><span style=3D"color:#008">auto</span><span>=
</span><span style=3D"color:#008">var</span><span> </span><span style=3D"c=
olor:#660">=3D</span><span> range</span><span style=3D"color:#660">();</spa=
n><span><br>
=A0 =A0 =A0 =A0 =A0 =A0 </span><span style=3D"color:#008">if</span><span> <=
/span><span style=3D"color:#660">(</span><span style=3D"color:#008">var</sp=
an><span style=3D"color:#660">)</span><span> </span><span style=3D"color:#0=
08">return</span><span> optional</span><span style=3D"color:#660"><</spa=
n><span style=3D"color:#008">typename</span><span> std</span><span style=3D=
"color:#660">::</span><span>decay</span><span style=3D"color:#660"><</sp=
an><span style=3D"color:#008">decltype</span><span style=3D"color:#660">(</=
span><span>t</span><span style=3D"color:#660">(*</span><span style=3D"color=
:#008">var</span><span style=3D"color:#660">))>::</span><span>type</span=
><span style=3D"color:#660">>(</span><span>t</span><span style=3D"color:=
#660">(*</span><span style=3D"color:#008">var</span><span style=3D"color:#6=
60">));</span><span><br>
=A0 =A0 =A0 =A0 =A0 =A0 </span><span style=3D"color:#008">return</span><spa=
n> std</span><span style=3D"color:#660">::</span><span>none</span><span sty=
le=3D"color:#660">;</span><span><br>=A0 =A0 =A0 =A0 </span><span style=3D"c=
olor:#660">};</span><span><br>
=A0 =A0 </span><span style=3D"color:#660">}</span><span><br></span><span st=
yle=3D"color:#660">}</span><span><br></span><span style=3D"color:#008">int<=
/span><span> main</span><span style=3D"color:#660">()</span><span> </span><=
span style=3D"color:#660">{</span><span><br>
=A0 =A0 something<br>=A0 =A0 =A0 =A0 </span><span style=3D"color:#660">|</s=
pan><span> range</span><span style=3D"color:#660">::</span><span>map</span>=
<span style=3D"color:#660">([]...)</span><span><br>=A0 =A0 =A0 =A0 </span><=
span style=3D"color:#660">|</span><span> range</span><span style=3D"color:#=
660">::</span><span>map</span><span style=3D"color:#660">([]...)</span><spa=
n><br>
=A0 =A0 =A0 =A0 etc<br></span><span style=3D"color:#660">}</span></div></co=
de></div><div><br></div><div>It's part of a range design I am working o=
n. I have implemented everything I need but the lambda ADL problem means th=
at I can't use lambdas when I should be able to, because the range-comb=
ine operator| can't be found.</div>
<div><div>
<p></p>
<br><br></div></div></blockquote><div><br></div></div><div>Thanks, that loo=
ks very reasonable. I'll ask Core for the status quo rationale as a fir=
st step.=A0</div></div></div></div></blockquote><div><br></div><div>Should =
this apply only to lambdas, or to all local classes?=A0</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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--047d7bacbcceb6440f04dda69480--
.
Author: DeadMG <wolfeinstein@gmail.com>
Date: Sun, 26 May 2013 15:35:28 -0700 (PDT)
Raw View
------=_Part_2420_13799543.1369607728163
Content-Type: text/plain; charset=ISO-8859-1
Is a question that I just found myself asking. Logically, their utility in
this respect is impaired just like lambdas, although there is much less
push to return a local type vs a non-local one when the local type is not a
lambda type.
--
---
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.
------=_Part_2420_13799543.1369607728163
Content-Type: text/html; charset=ISO-8859-1
Is a question that I just found myself asking. Logically, their utility in this respect is impaired just like lambdas, although there is much less push to return a local type vs a non-local one when the local type is not a lambda type.
<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 />
------=_Part_2420_13799543.1369607728163--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 26 May 2013 16:17:24 -0700 (PDT)
Raw View
------=_Part_1350_24268660.1369610244633
Content-Type: text/plain; charset=ISO-8859-1
On Sunday, May 26, 2013 3:35:28 PM UTC-7, DeadMG wrote:
>
> Is a question that I just found myself asking. Logically, their utility in
> this respect is impaired just like lambdas, although there is much less
> push to return a local type vs a non-local one when the local type is not a
> lambda type.
A lambda is nothing special; it's just shorthand notation for a type
declared at that scope. We shouldn't have special-case language in the
standard that says "if the local type is a lambda type, blah blah".
After all, lambda types declared at namespace scope will have the usual
features of classes declared at namespace scope. So there's no reason to
restrict any expansion of local type association to just lambdas. If we're
going to do this, let's do it right.
Also, this should include associated *classes* as well. So if you declare a
local class within a member function of a class, it should be associated
with that class and any classes that this class is associated with.
--
---
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.
------=_Part_1350_24268660.1369610244633
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Sunday, May 26, 2013 3:35:28 PM UTC-7, DeadMG wrote:<blockquote class=3D=
"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc s=
olid;padding-left: 1ex;">Is a question that I just found myself asking. Log=
ically, their utility in this respect is impaired just like lambdas, althou=
gh there is much less push to return a local type vs a non-local one when t=
he local type is not a lambda type.</blockquote><div><br>A lambda is nothin=
g special; it's just shorthand notation for a type declared at that scope. =
We shouldn't have special-case language in the standard that says "if the l=
ocal type is a lambda type, blah blah".<br><br>After all, lambda types decl=
ared at namespace scope will have the usual features of classes declared at=
namespace scope. So there's no reason to restrict any expansion of local t=
ype association to just lambdas. If we're going to do this, let's do it rig=
ht.<br><br>Also, this should include associated <i>classes</i> as well. So =
if you declare a local class within a member function of a class, it should=
be associated with that class and any classes that this class is associate=
d with.<br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_1350_24268660.1369610244633--
.
Author: Zhihao Yuan <lichray@gmail.com>
Date: Sun, 26 May 2013 19:34:14 -0400
Raw View
On Sun, May 26, 2013 at 7:17 PM, Nicol Bolas <jmckesson@gmail.com> wrote:
> A lambda is nothing special; it's just shorthand notation for a type
> declared at that scope. We shouldn't have special-case language in the
> standard that says "if the local type is a lambda type, blah blah".
I don't agree. Lambda is special, conceptually, as a language structure.
It's described in terms of a class / class template does not mean its
semantics has to be limited by class / class template.
> Also, this should include associated classes as well. So if you declare a
> local class within a member function of a class, it should be associated
> with that class and any classes that this class is associated with.
I have a strong premonition that this will make existing code
behavior differently...
--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/
--
---
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.
.
Author: Gabriel Dos Reis <gdr@axiomatics.org>
Date: Sun, 26 May 2013 19:40:28 -0500
Raw View
Zhihao Yuan <lichray@gmail.com> writes:
| On Sun, May 26, 2013 at 7:17 PM, Nicol Bolas <jmckesson@gmail.com> wrote:
| > A lambda is nothing special; it's just shorthand notation for a type
| > declared at that scope. We shouldn't have special-case language in the
| > standard that says "if the local type is a lambda type, blah blah".
|
| I don't agree. Lambda is special, conceptually, as a language structure.
| It's described in terms of a class / class template does not mean its
| semantics has to be limited by class / class template.
I tend to agree that a lambda expression is a fundamental language
construct (from semantics point of view), and it is unfortunate that we
somehow think of it in terms of local classes. We shouldn't think of
lambdas in terms of implementation details. On the other hand, why
should be have special rules for local classes? If anything, there has
been a recent move to just treat them as ordinary classes, as far as
reasonably feasable.
-- Gaby
--
---
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.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 27 May 2013 00:19:11 -0700 (PDT)
Raw View
------=_Part_27_13342412.1369639151993
Content-Type: text/plain; charset=ISO-8859-1
On Sunday, May 26, 2013 5:40:28 PM UTC-7, Gabriel Dos Reis wrote:
>
> Zhihao Yuan <lic...@gmail.com <javascript:>> writes:
>
> | On Sun, May 26, 2013 at 7:17 PM, Nicol Bolas <jmck...@gmail.com<javascript:>>
> wrote:
> | > A lambda is nothing special; it's just shorthand notation for a type
> | > declared at that scope. We shouldn't have special-case language in the
> | > standard that says "if the local type is a lambda type, blah blah".
> |
> | I don't agree. Lambda is special, conceptually, as a language
> structure.
> | It's described in terms of a class / class template does not mean its
> | semantics has to be limited by class / class template.
>
> I tend to agree that a lambda expression is a fundamental language
> construct (from semantics point of view), and it is unfortunate that we
> somehow think of it in terms of local classes. We shouldn't think of
> lambdas in terms of implementation details.
Whatever they may be "from semantics point of view", they are still just
types. The fact that there's nothing a lambda can do which you can't do
yourself is a *strength* of C++ lambdas, not a weakness. It allows you to
swap a lambda for a regular class if the lambda gets too complex for the
lambda syntax to work. The class version will have the *exact* same
behavior as the lambda version, modulo extra features of the class.
We should not allow lambdas to do anything you couldn't do yourself. We
don't want people overloading on lambdas. We don't want people writing
huge, complex lambdas when a struct definition would be more appropriate,
and having different functionality between lambdas and structs would *
encourage* doing this. However much people may want lambdas to be some
unique construct with its own special rules, C++ shouldn't allow that.
It's just a class with a operator() overload. We should not pretend that
it's anything but that.
--
---
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.
------=_Part_27_13342412.1369639151993
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<br><br>On Sunday, May 26, 2013 5:40:28 PM UTC-7, Gabriel Dos Reis wrote:<b=
lockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;borde=
r-left: 1px #ccc solid;padding-left: 1ex;">Zhihao Yuan <<a href=3D"javas=
cript:" target=3D"_blank" gdf-obfuscated-mailto=3D"DQMA8Us_THUJ">lic...@gma=
il.com</a>> writes:
<br>
<br>| On Sun, May 26, 2013 at 7:17 PM, Nicol Bolas <<a href=3D"javascrip=
t:" target=3D"_blank" gdf-obfuscated-mailto=3D"DQMA8Us_THUJ">jmck...@gmail.=
com</a>> wrote:
<br>| > A lambda is nothing special; it's just shorthand notation for a =
type
<br>| > declared at that scope. We shouldn't have special-case language =
in the
<br>| > standard that says "if the local type is a lambda type, blah bla=
h".
<br>|=20
<br>| I don't agree. Lambda is special, conceptually, as a language s=
tructure.
<br>| It's described in terms of a class / class template does not mean its
<br>| semantics has to be limited by class / class template.
<br>
<br>I tend to agree that a lambda expression is a fundamental language
<br>construct (from semantics point of view), and it is unfortunate that we
<br>somehow think of it in terms of local classes. We shouldn't think=
of
<br>lambdas in terms of implementation details.</blockquote><div><br>Whatev=
er they may be "from semantics point of view", they are still just types. T=
he fact that there's nothing a lambda can do which you can't do yourself is=
a <i>strength</i> of C++ lambdas, not a weakness. It allows you to swap a =
lambda for a regular class if the lambda gets too complex for the lambda sy=
ntax to work. The class version will have the <i>exact</i> same behavior as=
the lambda version, modulo extra features of the class.<br><br>We should n=
ot allow lambdas to do anything you couldn't do yourself. We don't want peo=
ple overloading on lambdas. We don't want people writing huge, complex lamb=
das when a struct definition would be more appropriate, and having differen=
t functionality between lambdas and structs would <i>encourage</i> doing th=
is. However much people may want lambdas to be some unique construct with i=
ts own special rules, C++ shouldn't allow that.<br><br>It's just a class wi=
th a operator() overload. We should not pretend that it's anything but that=
..<br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_27_13342412.1369639151993--
.
Author: Zhihao Yuan <lichray@gmail.com>
Date: Mon, 27 May 2013 04:34:44 -0400
Raw View
On Mon, May 27, 2013 at 3:19 AM, Nicol Bolas <jmckesson@gmail.com> wrote:
> The fact that there's nothing a lambda can do which you can't do
> yourself is a strength of C++ lambdas, not a weakness. It allows you to swap
> a lambda for a regular class if the lambda gets too complex for the lambda
> syntax to work.
I agree lambdas should (must, actually) not go huge. But for
the specific case in the thread, if you replace lambda with a
named class, you can use operators as member functions,
but for lambda, ADL seems to be the only choice.
Changing the associated namespace may affect the behavior
of existing code, but lambda looks OK since it's unnamed.
--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/
--
---
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.
.
Author: potswa@gmail.com
Date: Mon, 27 May 2013 04:52:17 -0700 (PDT)
Raw View
------=_Part_2692_25349192.1369655538018
Content-Type: text/plain; charset=ISO-8859-1
GCC 4.9 accepts your example already, but if it didn't, the fix would
simply be a wrapper class template in the desired associated namespace.
namespace X {
template< typename t > // wrapper class
struct adl_wrapper : t { using t::t; };
template< typename t > // wrapper factory
adl_wrapper< t > adl_wrap( t o ) { return { o }; }
template<typename L, typename R> L operator+(L l, R r) { }
auto f() { return adl_wrapper( [] {} ); }
}
It would be bad to make lambdas different from other local classes. Would
applying the proposal so broadly break much? Before C++11 it was illegal to
use a local class as a template argument and it we're only noticing this
now because returning a local type is a C++14 feature.
Here is a C++11 example of namespace association making a difference for a
local type. It is correctly rejected by Clang but accepted by GCC.
template< typename t, typename u >
void f( t, u ) = delete;
template< typename t >
void c( t o ) { f( o, 5 ); }
namespace n {
template< typename t >
void f( t, int ) {}
void p() { c( []{} ); }
}
Why should local classes have associated namespaces? Because it's least
surprising behavior. A local scope is just another means of encapsulation,
and nobody expects functions to quarantine their contents this way. It just
plays badly with templates and it's broken.
--
---
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.
------=_Part_2692_25349192.1369655538018
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
GCC 4.9 accepts your example already, but if it didn't, the fix would simpl=
y be a wrapper class template in the desired associated namespace.<br><br><=
div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bo=
rder-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wor=
d-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypri=
nt"><span style=3D"color: #008;" class=3D"styled-by-prettify">namespace</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> X </span><spa=
n 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"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=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> t </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify=
">// wrapper class</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a=
dl_wrapper </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> t</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">t</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">;</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"><br><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 s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> t </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"st=
yled-by-prettify">// wrapper factory</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>adl_wrapper</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> t </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> adl_wrap</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> t o </span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n 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">return</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> o </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><br></span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">template</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> L</span><span style=3D"colo=
r: #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">typename</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> R</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> L </span><span style=3D"color: #008;" class=3D"styled-by-prettify">op=
erator</span><span style=3D"color: #660;" class=3D"styled-by-prettify">+(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">L l</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> R r</span><span style=3D"co=
lor: #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"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> f</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">return</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> adl_wrapper</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </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: #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: #660;" class=3D=
"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span></div></code></div><br>It would be bad to make lambdas different fr=
om other local classes. Would applying the proposal so broadly break much? =
Before C++11 it was illegal to use a local class as a template argument and=
it we're only noticing this now because returning a local type is a C++14 =
feature.<br><br>Here is a C++11 example of namespace association making a d=
ifference for a local type. It is correctly rejected by Clang but accepted =
by GCC.<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(25=
0, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border=
-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">template</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
><</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> t</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> u </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">void</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> f</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> u </span><span style=3D"col=
or: #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">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">delete</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">templat=
e</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> t </span><span style=3D"c=
olor: #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">void</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> c</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> t o </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 st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> f</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> o</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pre=
ttify">5</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><s=
pan 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><br></span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">namespace</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> n </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"s=
tyled-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: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">type=
name</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">></span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> f</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> t</span><span style=3D"color: #660;" class=3D"s=
tyled-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: #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"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">{}</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> p</span><span style=3D"color: #660;" class=3D"st=
yled-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"> c</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">[]{}</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span>=
</div></code></div><br>Why should local classes have associated namespaces?=
Because it's least surprising behavior. A local scope is just another mean=
s of encapsulation, and nobody expects functions to quarantine their conten=
ts this way. It just plays badly with templates and it's broken.<br>
<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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_2692_25349192.1369655538018--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 27 May 2013 14:59:27 +0300
Raw View
--047d7b677304698d1604ddb1e17b
Content-Type: text/plain; charset=ISO-8859-1
On 27 May 2013 14:52, <potswa@gmail.com> wrote:
> It would be bad to make lambdas different from other local classes. Would
> applying the proposal so broadly break much? Before C++11 it was illegal to
> use a local class as a template argument and it we're only noticing this
> now because returning a local type is a C++14 feature.
>
You can return a lambda or a local class from a lambda in C++11, so that
doesn't count as an excuse for noticing this now because
we can return local types from a non-lambda in C++14.
--
---
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.
--047d7b677304698d1604ddb1e17b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 27 May 2013 14:52, <span dir=3D"ltr"><<a href=3D"mailto:pots=
wa@gmail.com" target=3D"_blank">potswa@gmail.com</a>></span> wrote:<br><=
blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px=
#ccc solid;padding-left:1ex">
It would be bad to make lambdas different from other local classes. Would a=
pplying the proposal so broadly break much? Before C++11 it was illegal to =
use a local class as a template argument and it we're only noticing thi=
s now because returning a local type is a C++14 feature.<br>
</blockquote><div><br><br></div><div>You can return a lambda or a local cla=
ss from a lambda in C++11, so that doesn't count as an excuse for notic=
ing this now because<br>we can return local types from a non-lambda in C++1=
4.<br>
</div></div><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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--047d7b677304698d1604ddb1e17b--
.
Author: DeadMG <wolfeinstein@gmail.com>
Date: Mon, 27 May 2013 05:01:13 -0700 (PDT)
Raw View
------=_Part_2800_6287616.1369656073443
Content-Type: text/plain; charset=ISO-8859-1
That's true, but since lambdas were very much more limited in C++11, it
wasn't so viable. C++14 does certainly make this prospect far more
attractive. I have implemented the range design I was considering with a
modified Clang, and it would certainly be much less appealing in another
version of the language that did not have a fix for ADL for local classes.
--
---
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.
------=_Part_2800_6287616.1369656073443
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
That's true, but since lambdas were very much more limited in C++11, it was=
n't so viable. C++14 does certainly make this prospect far more attractive.=
I have implemented the range design I was considering with a modified Clan=
g, and it would certainly be much less appealing in another version of the =
language that did not have a fix for ADL for local classes.
<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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_2800_6287616.1369656073443--
.
Author: potswa@gmail.com
Date: Mon, 27 May 2013 05:18:42 -0700 (PDT)
Raw View
------=_Part_552_13112465.1369657122286
Content-Type: text/plain; charset=ISO-8859-1
> You can return a lambda or a local class from a lambda in C++11, so that
> doesn't count as an excuse for noticing this now because
> we can return local types from a non-lambda in C++14.
>
Sort of. You can return it from a lambda but you can't return it out of the
enclosing non-lambda function scope. The only way to pass it out of the *
namespace*, which is what matters, is to pass it into a template, which is
what I did with my example.
By the way, the language as-is seems deeply flawed. Only a singly-nested
class has an associated namespace; nest a class inside a nested class and
it becomes disconnected from its namespace.
-
If T is a class type (including unions), its associated classes are: the
class itself; the class of which it is a member, if any; and its direct and
indirect base classes. Its associated namespaces are the namespaces of
which its associated classes are members.
GCC and Clang both incorrectly accept this example:
namespace n {
struct s { struct n1 { struct n2 {}; }; };
int f( s::n1::n2 ) { return 3; }
}
int i = f( n::s::n1::n2() );
--
---
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.
------=_Part_552_13112465.1369657122286
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<br><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>You can return a lambda or a local class from a=
lambda in C++11, so that doesn't count as an excuse for noticing this now =
because<br>we can return local types from a non-lambda in C++14.<br></div><=
/div></div></div></blockquote><div><br>Sort of. You can return it from a la=
mbda but you can't return it out of the enclosing non-lambda function scope=
.. The only way to pass it out of the <i>namespace</i>, which is what matter=
s, is to pass it into a template, which is what I did with my example.<br><=
br>By the way, the language as-is seems deeply flawed. Only a singly-nested=
class has an associated namespace; nest a class inside a nested class and =
it becomes disconnected from its namespace.<br><br>
=09
=09
=09
=09
=09
<div class=3D"page" title=3D"Page 62">
<div class=3D"layoutArea">
<div class=3D"column">
<ul style=3D"list-style-type: none"><li>
<p><span style=3D"font-size: 10.000000pt; font-family: 'LMRoman10'">=
If </span><span style=3D"font-size: 10.000000pt; font-family: 'LMMono10'">T=
</span><span style=3D"font-size: 10.000000pt; font-family: 'LMRoman10'">is=
a class type (including unions), its associated classes are: the class its=
elf; the class of which it is a
member, if any; and its direct and indirect base classes. Its associated na=
mespaces are the namespaces
of which its associated classes are members.
</span></p>
</li></ul>
</div>
</div>
</div>
=09
<br>GCC and Clang both incorrectly accept this example:<br><br><div class=
=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-colo=
r: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
style=3D"color: #008;" class=3D"styled-by-prettify">namespace</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> n </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><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> s </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">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
n1 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> n2 </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> f</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> s</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">n1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">n2 </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"> </span><span styl=
e=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">3</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br></span><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">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> i </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> f</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> n</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">n1</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">n2</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span></div></code></div><br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_552_13112465.1369657122286--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 27 May 2013 15:31:24 +0300
Raw View
--089e0102f736a62d9c04ddb25385
Content-Type: text/plain; charset=ISO-8859-1
On 27 May 2013 15:18, <potswa@gmail.com> wrote:
>
> You can return a lambda or a local class from a lambda in C++11, so that
>> doesn't count as an excuse for noticing this now because
>> we can return local types from a non-lambda in C++14.
>>
>
> Sort of. You can return it from a lambda but you can't return it out of
> the enclosing non-lambda function scope. The only way to pass it out of the
> *namespace*, which is what matters, is to pass it into a template, which
> is what I did with my example.
>
I'm not sure I quite follow.
namespace N {
auto x = [](){
return [](){std::cout << "In the inner lambda" << std::endl;};
};
}
int main()
{
auto y = N::x;
auto z = y();
z();
}
The inner lambda got passed out of the namespace just fine, and that works
in C++11.
>
> By the way, the language as-is seems deeply flawed. Only a singly-nested
> class has an associated namespace; nest a class inside a nested class and
> it becomes disconnected from its namespace.
>
Interesting.
--
---
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.
--089e0102f736a62d9c04ddb25385
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 27 May 2013 15:18, <span dir=3D"ltr"><<a href=3D"mailto:pots=
wa@gmail.com" target=3D"_blank">potswa@gmail.com</a>></span> wrote:<br><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex">
<div class=3D"im"><br><blockquote class=3D"gmail_quote" style=3D"margin:0px=
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><di=
v dir=3D"ltr"><div><div class=3D"gmail_quote"><div>You can return a lambda =
or a local class from a lambda in C++11, so that doesn't count as an ex=
cuse for noticing this now because<br>
we can return local types from a non-lambda in C++14.<br></div></div></div>=
</div></blockquote></div><div><br>Sort of. You can return it from a lambda =
but you can't return it out of the enclosing non-lambda function scope.=
The only way to pass it out of the <i>namespace</i>, which is what matters=
, is to pass it into a template, which is what I did with my example.<br>
</div></blockquote><div><br></div><div>I'm not sure I quite follow.<br>=
<br>namespace N {<br>=A0=A0=A0 auto x =3D [](){<br>=A0 =A0 =A0=A0 return=A0=
[](){std::cout << "In the inner lambda" << std::endl=
;};<br>=A0=A0=A0 };<br>
} <br><br>int main() <br>{<br>=A0=A0=A0 auto y =3D N::x; <br>=A0=A0=A0 auto=
z =3D y(); <br>=A0=A0=A0 z();<br>}<br><br></div><div>The inner lambda got =
passed out of the namespace just fine, and that works in C++11.<br>=A0<br><=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo=
rder-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><br>By the way, the language as-is seems deeply flawed. Only a singly-=
nested class has an associated namespace; nest a class inside a nested clas=
s and it becomes disconnected from its namespace.<br></div></blockquote>
<div><br></div><div>Interesting.<br></div></div></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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--089e0102f736a62d9c04ddb25385--
.
Author: DeadMG <wolfeinstein@gmail.com>
Date: Mon, 27 May 2013 05:34:03 -0700 (PDT)
Raw View
------=_Part_2793_17764771.1369658043422
Content-Type: text/plain; charset=ISO-8859-1
IYAM, a class should always have as an associated namespace the most nested
namespace which either is, or contains, the scope it is declared in.
--
---
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.
------=_Part_2793_17764771.1369658043422
Content-Type: text/html; charset=ISO-8859-1
IYAM, a class should always have as an associated namespace the most nested namespace which either is, or contains, the scope it is declared in.
<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 />
------=_Part_2793_17764771.1369658043422--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 27 May 2013 07:03:21 -0700 (PDT)
Raw View
------=_Part_631_13155021.1369663401362
Content-Type: text/plain; charset=ISO-8859-1
On Monday, May 27, 2013 4:52:17 AM UTC-7, pot...@gmail.com wrote:
>
> GCC 4.9 accepts your example already, but if it didn't, the fix would
> simply be a wrapper class template in the desired associated namespace.
>
> namespace X {
> template< typename t > // wrapper class
> struct adl_wrapper : t { using t::t; };
>
> template< typename t > // wrapper factory
> adl_wrapper< t > adl_wrap( t o ) { return { o }; }
>
> template<typename L, typename R> L operator+(L l, R r) { }
> auto f() { return adl_wrapper( [] {} ); }
> }
>
> It would be bad to make lambdas different from other local classes. Would
> applying the proposal so broadly break much? Before C++11 it was illegal to
> use a local class as a template argument and it we're only noticing this
> now because returning a local type is a C++14 feature.
>
Technically, the issue was caused by the ability to allow local classes to
escape the functions in which they're defined at all. And that's due to the
C++11 ability to have template argument deduction deduce them. At which
point you could pass a local class as a template parameter to some
algorithm, which could then attempt to use ADL-based operations on it.
It's just that, now with return type deduction (combined with deduction in
very arbitrary places, so that a type can go far from where it was defined
without anyone having to actually type the name of an unnameable type), we
have dramatically magnified the number of places where this can happen.
--
---
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.
------=_Part_631_13155021.1369663401362
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Monday, May 27, 2013 4:52:17 AM UTC-7, pot...@gmail.com wrote:<blockquot=
e class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: =
1px #ccc solid;padding-left: 1ex;">GCC 4.9 accepts your example already, bu=
t if it didn't, the fix would simply be a wrapper class template in the des=
ired associated namespace.<br><br><div style=3D"background-color:rgb(250,25=
0,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;wo=
rd-wrap:break-word"><code><div><span style=3D"color:#008">namespace</span><=
span style=3D"color:#000"> X </span><span style=3D"color:#660">{</span><spa=
n style=3D"color:#000"><br></span><span style=3D"color:#008">template</span=
><span style=3D"color:#660"><</span><span style=3D"color:#000"> </span><=
span style=3D"color:#008">typename</span><span style=3D"color:#000"> t </sp=
an><span style=3D"color:#660">></span><span style=3D"color:#000"> </span=
><span style=3D"color:#800">// wrapper class</span><span style=3D"color:#00=
0"><br></span><span style=3D"color:#008">struct</span><span style=3D"color:=
#000"> adl_wrapper </span><span style=3D"color:#660">:</span><span style=3D=
"color:#000"> t </span><span style=3D"color:#660">{</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#008">using</span><span style=3D"col=
or:#000"> t</span><span style=3D"color:#660">::</span><span style=3D"color:=
#000">t</span><span style=3D"color:#660">;</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660">};</span><span style=3D"color:#000"><br=
><br></span><span style=3D"color:#008">template</span><span style=3D"color:=
#660"><</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
08">typename</span><span style=3D"color:#000"> t </span><span style=3D"colo=
r:#660">></span><span style=3D"color:#000"> </span><span style=3D"color:=
#800">// wrapper factory</span><span style=3D"color:#000"><br>adl_wrapper</=
span><span style=3D"color:#660"><</span><span style=3D"color:#000"> t </=
span><span style=3D"color:#660">></span><span style=3D"color:#000"> adl_=
wrap</span><span style=3D"color:#660">(</span><span style=3D"color:#000"> t=
o </span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </=
span><span style=3D"color:#660">{</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#008">return</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#660">{</span><span style=3D"color:#000"> o </span><sp=
an style=3D"color:#660">};</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">}</span><span style=3D"color:#000"><br><br></span><span=
style=3D"color:#008">template</span><span style=3D"color:#660"><</span>=
<span style=3D"color:#008">typename</span><span style=3D"color:#000"> L</sp=
an><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#008">typename</span><span style=3D"color:#000"> R</span=
><span style=3D"color:#660">></span><span style=3D"color:#000"> L </span=
><span style=3D"color:#008">operator</span><span style=3D"color:#660">+(</s=
pan><span style=3D"color:#000">L l</span><span style=3D"color:#660">,</span=
><span style=3D"color:#000"> R r</span><span style=3D"color:#660">)</span><=
span style=3D"color:#000"> </span><span style=3D"color:#660">{</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660">}</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#008">auto</span><span styl=
e=3D"color:#000"> f</span><span style=3D"color:#660">()</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#008">return</span><span style=3D"c=
olor:#000"> adl_wrapper</span><span style=3D"color:#660">(</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#660">[]</span><span style=3D=
"color:#000"> </span><span style=3D"color:#660">{}</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">);</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><span style=3D"color:#000"><b=
r></span></div></code></div><br>It would be bad to make lambdas different f=
rom other local classes. Would applying the proposal so broadly break much?=
Before C++11 it was illegal to use a local class as a template argument an=
d it we're only noticing this now because returning a local type is a C++14=
feature.<br></blockquote><div><br>Technically, the issue was caused by the=
ability to allow local classes to escape the functions in which they're de=
fined at all. And that's due to the C++11 ability to have template argument=
deduction deduce them. At which point you could pass a local class as a te=
mplate parameter to some algorithm, which could then attempt to use ADL-bas=
ed operations on it.<br><br>It's just that, now with return type deduction =
(combined with deduction in very arbitrary places, so that a type can go fa=
r from where it was defined without anyone having to actually type the name=
of an unnameable type), we have dramatically magnified the number of place=
s where this can happen.<br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_631_13155021.1369663401362--
.
Author: Gabriel Dos Reis <gdr@axiomatics.org>
Date: Mon, 27 May 2013 20:37:26 -0500
Raw View
Nicol Bolas <jmckesson@gmail.com> writes:
| On Sunday, May 26, 2013 5:40:28 PM UTC-7, Gabriel Dos Reis wrote:
|
| Zhihao Yuan <lic...@gmail.com> writes:
|
| | On Sun, May 26, 2013 at 7:17 PM, Nicol Bolas <jmck...@gmail.com> wrote:
| | > A lambda is nothing special; it's just shorthand notation for a type
| | > declared at that scope. We shouldn't have special-case language in the
| | > standard that says "if the local type is a lambda type, blah blah".
| |
| | I don't agree. Lambda is special, conceptually, as a language structure.
| | It's described in terms of a class / class template does not mean its
| | semantics has to be limited by class / class template.
|
| I tend to agree that a lambda expression is a fundamental language
| construct (from semantics point of view), and it is unfortunate that we
| somehow think of it in terms of local classes. We shouldn't think of
| lambdas in terms of implementation details.
|
|
| Whatever they may be "from semantics point of view", they are still just types.
I am afraid I do not understand by what you mean by that sentence.
Could you elaborate?
| The fact that there's nothing a lambda can do which you can't do yourself is a
| strength of C++ lambdas, not a weakness.
Again, I am afraid I do not understand this statement.
| It allows you to swap a lambda for a
| regular class if the lambda gets too complex for the lambda syntax to work. The
| class version will have the exact same behavior as the lambda version, modulo
| extra features of the class.
|
| We should not allow lambdas to do anything you couldn't do yourself. We don't
| want people overloading on lambdas. We don't want people writing huge, complex
| lambdas when a struct definition would be more appropriate, and having
I am afraid I do not see how you got from there to here.
| different functionality between lambdas and structs would encourage doing this.
| However much people may want lambdas to be some unique construct with its own
| special rules, C++ shouldn't allow that.
|
| It's just a class with a operator() overload. We should not pretend that it's
| anything but that.
--
---
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.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 27 May 2013 23:26:14 -0700 (PDT)
Raw View
------=_Part_299_28340376.1369722374219
Content-Type: text/plain; charset=ISO-8859-1
On Monday, May 27, 2013 6:37:26 PM UTC-7, Gabriel Dos Reis wrote:
>
> Nicol Bolas <jmck...@gmail.com <javascript:>> writes:
>
> | On Sunday, May 26, 2013 5:40:28 PM UTC-7, Gabriel Dos Reis wrote:
> |
> | Zhihao Yuan <lic...@gmail.com> writes:
> |
> | | On Sun, May 26, 2013 at 7:17 PM, Nicol Bolas <jmck...@gmail.com>
> wrote:
> | | > A lambda is nothing special; it's just shorthand notation for a
> type
> | | > declared at that scope. We shouldn't have special-case language
> in the
> | | > standard that says "if the local type is a lambda type, blah
> blah".
> | |
> | | I don't agree. Lambda is special, conceptually, as a language
> structure.
> | | It's described in terms of a class / class template does not mean
> its
> | | semantics has to be limited by class / class template.
> |
> | I tend to agree that a lambda expression is a fundamental language
> | construct (from semantics point of view), and it is unfortunate that
> we
> | somehow think of it in terms of local classes. We shouldn't think
> of
> | lambdas in terms of implementation details.
> |
> |
> | Whatever they may be "from semantics point of view", they are still just
> types.
>
> I am afraid I do not understand by what you mean by that sentence.
> Could you elaborate?
>
Lambda expressions create types. I'm not really sure what more there is to
elaborate on.
You can think of a lambda expression as making a function. You can think of
it as its own special syntactic construct. But as far as the standard is
concerned, lambda expressions are just a shorthand way for creating an
unnamed type and instantiating it. And that's good; see below.
| The fact that there's nothing a lambda can do which you can't do yourself
> is a
> | strength of C++ lambdas, not a weakness.
>
> Again, I am afraid I do not understand this statement.
>
This:
auto x = []() {...};
Should always be in every way equivalent to this:
struct __unnamed__
{
auto operator() {...}
};
auto x = __unnamed__{};
Currently, that's how lambdas work. And that is good.
It allows you to turn a lambda into a struct if you feel like it. That is
useful, because sometimes lambdas get very large, or you need to add
features to them that are just not possible.
Lambdas are nothing more than a quick way to write a type with an
operator() overload. They should not have special semantics that you cannot
replicate yourself (outside of being unnamed).
--
---
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.
------=_Part_299_28340376.1369722374219
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Monday, May 27, 2013 6:37:26 PM UTC-7, Gabriel Dos Reis wrote:<blockquot=
e class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: =
1px #ccc solid;padding-left: 1ex;">Nicol Bolas <<a href=3D"javascript:" =
target=3D"_blank" gdf-obfuscated-mailto=3D"l0LWSzILX4MJ">jmck...@gmail.com<=
/a>> writes:
<br>
<br>| On Sunday, May 26, 2013 5:40:28 PM UTC-7, Gabriel Dos Reis wrote:
<br>|=20
<br>| Zhihao Yuan <<a>lic...@gmail.com</a>> writes:
<br>|=20
<br>| | On Sun, May 26, 2013 at 7:17 PM, Nicol Bolas <<a>j=
mck...@gmail.com</a>> wrote:
<br>| | > A lambda is nothing special; it's just shorthand=
notation for a type
<br>| | > declared at that scope. We shouldn't have specia=
l-case language in the
<br>| | > standard that says "if the local type is a lambd=
a type, blah blah".
<br>| |
<br>| | I don't agree. Lambda is special, conceptually,=
as a language structure.
<br>| | It's described in terms of a class / class template d=
oes not mean its
<br>| | semantics has to be limited by class / class template=
..
<br>|=20
<br>| I tend to agree that a lambda expression is a fundament=
al language
<br>| construct (from semantics point of view), and it is unf=
ortunate that we
<br>| somehow think of it in terms of local classes. We=
shouldn't think of
<br>| lambdas in terms of implementation details.
<br>|=20
<br>|=20
<br>| Whatever they may be "from semantics point of view", they are still j=
ust types.
<br>
<br>I am afraid I do not understand by what you mean by that sentence.
<br>Could you elaborate?<br></blockquote><div><br>Lambda expressions create=
types. I'm not really sure what more there is to elaborate on.<br><br>You =
can think of a lambda expression as making a function. You can think of it =
as its own special syntactic construct. But as far as the standard is conce=
rned, lambda expressions are just a shorthand way for creating an unnamed t=
ype and instantiating it. And that's good; see below.<br><br></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left=
: 1px #ccc solid;padding-left: 1ex;">
| The fact that there's nothing a lambda can do which you can't do yourself=
is a
<br>| strength of C++ lambdas, not a weakness.=20
<br>
<br>Again, I am afraid I do not understand this statement.<br></blockquote>=
<div><br>This:<br><br><div class=3D"prettyprint" style=3D"background-color:=
rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid;=
border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><di=
v class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> x </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">[]()</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">{...};</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"><br></span></div></code></div><br>Shou=
ld always be in every way equivalent to this:<br><br><div class=3D"prettypr=
int" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, =
187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;">=
<code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> __unnamed__<br></span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">operator</span><span style=3D"color: #660;" class=3D"st=
yled-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></span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> x </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> __unnamed__</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{};</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span></div></code></div><br>Currently, th=
at's how lambdas work. And that is good.<br><br>It allows you to turn a lam=
bda into a struct if you feel like it. That is useful, because sometimes la=
mbdas get very large, or you need to add features to them that are just not=
possible.<br><br>Lambdas are nothing more than a quick way to write a type=
with an operator() overload. They should not have special semantics that y=
ou cannot replicate yourself (outside of being unnamed).<br></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_299_28340376.1369722374219--
.
Author: Richard Smith <richard@metafoo.co.uk>
Date: Tue, 28 May 2013 14:56:41 -0700
Raw View
--089e013cc32823061604ddce57b2
Content-Type: text/plain; charset=ISO-8859-1
On Mon, May 27, 2013 at 5:18 AM, <potswa@gmail.com> wrote:
>
> You can return a lambda or a local class from a lambda in C++11, so that
>> doesn't count as an excuse for noticing this now because
>> we can return local types from a non-lambda in C++14.
>>
>
> Sort of. You can return it from a lambda but you can't return it out of
> the enclosing non-lambda function scope. The only way to pass it out of the
> *namespace*, which is what matters, is to pass it into a template, which
> is what I did with my example.
>
> By the way, the language as-is seems deeply flawed. Only a singly-nested
> class has an associated namespace; nest a class inside a nested class and
> it becomes disconnected from its namespace.
>
>
> -
>
> If T is a class type (including unions), its associated classes are:
> the class itself; the class of which it is a member, if any; and its direct
> and indirect base classes. Its associated namespaces are the namespaces of
> which its associated classes are members.
>
>
> GCC and Clang both incorrectly accept this example:
>
> namespace n {
> struct s { struct n1 { struct n2 {}; }; };
> int f( s::n1::n2 ) { return 3; }
> }
> int i = f( n::s::n1::n2() );
>
Core issue 557 appears to be responsible for this. Prior to that issue, the
wording said "Its associated namespaces are the namespaces in which its
associated classes are defined." which in this case includes 'n'.
Presumably the intent here was to clarify that a::b would be the associated
namespace for a::b::x here, not a:
namespace a {
namespace b { struct x; }
struct b::x {};
}
I don't know whether the change to deeply-nested member classes was
intentional. Neither gcc nor clang treats n::s as an associated class,
although both treat n as an associated namespace. EDG also treats n as an
associated namespace, but this is not definitive because it also treats
n::s as an associated class (contrary to the specification).
--
---
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.
--089e013cc32823061604ddce57b2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Mon, May 27, 2013 at 5:18 AM, <span dir=3D"ltr"><<a href=3D"mailto:p=
otswa@gmail.com" target=3D"_blank">potswa@gmail.com</a>></span> wrote:<b=
r><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class=3D"im"><br><blockquote class=3D"gmail_quote" style=3D"margin:0;m=
argin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"l=
tr"><div><div class=3D"gmail_quote"><div>You can return a lambda or a local=
class from a lambda in C++11, so that doesn't count as an excuse for n=
oticing this now because<br>
we can return local types from a non-lambda in C++14.<br></div></div></div>=
</div></blockquote></div><div><br>Sort of. You can return it from a lambda =
but you can't return it out of the enclosing non-lambda function scope.=
The only way to pass it out of the <i>namespace</i>, which is what matters=
, is to pass it into a template, which is what I did with my example.<br>
<br>By the way, the language as-is seems deeply flawed. Only a singly-neste=
d class has an associated namespace; nest a class inside a nested class and=
it becomes disconnected from its namespace.<br><br>
=09
=09
=09
=09
=09
<div title=3D"Page 62">
<div>
<div>
<ul style=3D"list-style-type:none"><li>
<p><span style=3D"font-size:10.000000pt;font-family:'LMRoman10&#=
39;">If </span><span style=3D"font-size:10.000000pt;font-family:'LMMono=
10'">T </span><span style=3D"font-size:10.000000pt;font-family:'LMR=
oman10'">is a class type (including unions), its associated classes are=
: the class itself; the class of which it is a
member, if any; and its direct and indirect base classes. Its associated na=
mespaces are the namespaces
of which its associated classes are members.
</span></p>
</li></ul>
</div>
</div>
</div>
=09
<br>GCC and Clang both incorrectly accept this example:<br><br><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:#008">namespace</span><span style> n </span><span style=3D"color:=
#660">{</span><span style><br>
</span><span style=3D"color:#008">struct</span><span style> s </span><span =
style=3D"color:#660">{</span><span style> </span><span style=3D"color:#008"=
>struct</span><span style> n1 </span><span style=3D"color:#660">{</span><sp=
an style> </span><span style=3D"color:#008">struct</span><span style> n2 </=
span><span style=3D"color:#660">{};</span><span style> </span><span style=
=3D"color:#660">};</span><span style> </span><span style=3D"color:#660">};<=
/span><span style><br>
</span><span style=3D"color:#008">int</span><span style> f</span><span styl=
e=3D"color:#660">(</span><span style> s</span><span style=3D"color:#660">::=
</span><span style>n1</span><span style=3D"color:#660">::</span><span style=
>n2 </span><span style=3D"color:#660">)</span><span style> </span><span sty=
le=3D"color:#660">{</span><span style> </span><span style=3D"color:#008">re=
turn</span><span style> </span><span style=3D"color:#066">3</span><span sty=
le=3D"color:#660">;</span><span style> </span><span style=3D"color:#660">}<=
/span><span style><br>
</span><span style=3D"color:#660">}</span><span style><br></span><span styl=
e=3D"color:#008">int</span><span style> i </span><span style=3D"color:#660"=
>=3D</span><span style> f</span><span style=3D"color:#660">(</span><span st=
yle> n</span><span style=3D"color:#660">::</span><span style>s</span><span =
style=3D"color:#660">::</span><span style>n1</span><span style=3D"color:#66=
0">::</span><span style>n2</span><span style=3D"color:#660">()</span><span =
style> </span><span style=3D"color:#660">);</span></div>
</code></div></div></blockquote><div><br></div><div>Core issue 557 appears =
to be responsible for this. Prior to that issue, the wording=A0said "I=
ts associated namespaces are the namespaces in which its associated classes=
are defined." which in this case includes 'n'. Presumably the=
intent here was to clarify that a::b would be the associated namespace for=
a::b::x here, not a:</div>
<div><br></div><div>namespace a {</div><div>=A0 namespace b { struct x; }</=
div><div>=A0 struct b::x {};</div><div>}</div><div><br></div><div>I don'=
;t know whether the change to deeply-nested member classes was intentional.=
Neither gcc nor clang treats n::s as an associated class, although both tr=
eat n as an associated namespace. EDG also treats n as an associated namesp=
ace, but this is not definitive because it also treats n::s as an associate=
d class (contrary to the specification).</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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--089e013cc32823061604ddce57b2--
.
Author: potswa@gmail.com
Date: Mon, 27 May 2013 18:46:57 -0700 (PDT)
Raw View
------=_Part_3118_21559876.1369705617144
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
>
> The inner lambda got passed out of the namespace just fine, and that work=
s=20
> in C++11.
>
Oops, good example. Bottom line: the problem is new in C++11, but only with=
=20
contrivance, and C++14 gives it the first real exposure.
=20
> Interesting.
>
I think the fundamental approach of the Standard is to define the=20
associated classes (which share their invisible friends) and then define=20
the associated namespaces as a simple function thereof.
Despite associating the enclosing namespace through multiple levels of=20
class nesting, both GCC and Clang only expose the invisible friends of the=
=20
immediately enclosing class.
namespace n {
struct s {
struct n1 {
struct n2 {};
friend int f( s::n1::n2 ) { return 3; }
};
friend int g( n1::n2 ) { return 3; }
};
friend int h( n1::n2 ) { return 3; }
}
int i =3D f( n::s::n1::n2() ); // OK: invisible friend of enclosing class.=
=20
Implementations agree.
int j =3D g( n::s::n1::n2() ); // Error: invisible friend of second enclosi=
ng=20
class. Implementations agree.
int k =3D h( n::s::n1::n2() ); // Error: member of unassociated namespace.=
=20
Implementations disagree with std.
On Monday, May 27, 2013 8:34:03 PM UTC+8, DeadMG wrote:
>
> IYAM, a class should always have as an associated namespace the most=20
> nested namespace which either is, or contains, the scope it is declared i=
n.
Unfortunately, a function can be declared and defined in different=20
namespaces.
namespace a {
void x();
}
void a::x() {
my_template( []{} ); // associated with a or not?
}
Both Clang and GCC associate a local class according to the namespace=20
enclosing its function, not its declaration. This seems more intuitive to=
=20
me and more analogous to the way nested classes already work. My proposed=
=20
change would be to adjust 3.4.2/2,
=20
-=20
=20
=97 If T is a class type (including unions) *but not a local class type*=
,=20
its associated classes are: the class itself; the class of which it is a=
=20
member, if any; and its direct and indirect base classes. Its associated=
=20
namespaces are the namespaces of which its associated classes are member=
s.
- *=97 If T is a local class type, its associated namespaces and classes=
=20
determined as if it were a member of the class or namespace of which its=
=20
enclosing function is a member.*
There are other issues with the paragraph, though: multiple nesting levels=
=20
disassociate the namespace, and forward-declared enumerations may be=20
associated improperly.
--=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.
------=_Part_3118_21559876.1369705617144
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
<blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(=
204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">The inner lambda =
got passed out of the namespace just fine, and that works in C++11.<br></bl=
ockquote><div><br>Oops, good example. Bottom line: the problem is new in C+=
+11, but only with contrivance, and C++14 gives it the first real exposure.=
<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"lt=
r"><div><div class=3D"gmail_quote"><div></div><div>Interesting.<br></div></=
div></div></div></blockquote><div><br>I think the fundamental approach of t=
he Standard is to define the associated classes (which share their invisibl=
e friends) and then define the associated namespaces as a simple function t=
hereof.<br><br>Despite associating the enclosing namespace through multiple=
levels of class nesting, both GCC and Clang only expose the invisible frie=
nds of the immediately enclosing class.<br><br><div class=3D"prettyprint" s=
tyle=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 1=
87); border-style: solid; border-width: 1px; word-wrap: break-word;"><code =
class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #=
008;" class=3D"styled-by-prettify">namespace</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> n </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> s </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: #000;" class=3D"styled-by-prettify"></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify"><br> struc=
t</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> n1 </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> &n=
bsp; </span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> n2 </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"></sp=
an><br><span style=3D"color: #000;" class=3D"styled-by-prettify"></span><di=
v style=3D"margin-left: 40px;"><span style=3D"color: #000;" class=3D"styled=
-by-prettify"></span></div><span style=3D"color: #008;" class=3D"styled-by-=
prettify"><code class=3D"prettyprint"><span style=3D"color: #008;" class=3D=
"styled-by-prettify"> friend int<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> f</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> s</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">n1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">n2 </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"> </span><span styl=
e=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">3</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br> };<br> </span></code>friend</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> g</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> n1</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">n2 </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 st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">return</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" c=
lass=3D"styled-by-prettify">3</span><span style=3D"color: #660;" class=3D"s=
tyled-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></sp=
an><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><br><code class=3D"pretty=
print"><span style=3D"color: #008;" class=3D"styled-by-prettify">friend</sp=
an><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"styled-by-prettify"> h</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> n1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">n2 </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"> </span><span styl=
e=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">3</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br></span></code><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> i </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> f</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> n</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">n1</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">n2</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: #660;" clas=
s=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> // OK: invisible friend of enclosing class. Implementatio=
ns agree.<br></span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> j <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> g</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> n</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">s</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">n1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">n2</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">()</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">);</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> // Error: invisible friend of second encl=
osing class. Implementations agree.<br>int k</span><code class=3D"prettypri=
nt"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =3D h</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> n</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">s</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">n1</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
n2</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> // Error: member of unassociated=
namespace. Implementations disagree with std.</span></code></div></code></=
div><br><br>On Monday, May 27, 2013 8:34:03 PM UTC+8, DeadMG wrote:<blockqu=
ote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left=
: 1px #ccc solid;padding-left: 1ex;">IYAM,
a class should always have as an associated namespace the most nested=20
namespace which either is, or contains, the scope it is declared in.</block=
quote><br>Unfortunately, a function can be declared and defined in differen=
t namespaces.<br><br><div class=3D"prettyprint" style=3D"background-color: =
rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; =
border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div=
class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">namespace</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> a </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbs=
p; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> x</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">();</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color:=
#008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">x</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br> m=
y_template</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 s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </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: #800;" clas=
s=3D"styled-by-prettify">// associated with a or not?</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;" c=
lass=3D"styled-by-prettify"><br></span></div></code></div><br>Both Clang an=
d GCC associate a local class according to the namespace enclosing its func=
tion, not its declaration. This seems more intuitive to me and more analogo=
us to the way nested classes already work. My proposed change would be to a=
djust 3.4.2/2,<br>
=09
=09
=09
=09
=09
=09
=09
=09
=09
=09
=09
<div class=3D"page" title=3D"Page 62">
<div class=3D"layoutArea">
<div class=3D"column">
<ul style=3D"list-style-type: none"><li>
<p><span style=3D"font-size: 10.000000pt; font-family: 'LMRoman10'">=
=97 If </span><span style=3D"font-size: 10.000000pt; font-family: 'LMMono10=
'">T </span><span style=3D"font-size: 10.000000pt; font-family: 'LMRoman10'=
">is a class type (including unions) <b>but not a local class type</b>, its=
associated classes are: the class itself; the class of which it is a
member, if any; and its direct and indirect base classes. Its associated na=
mespaces are the namespaces
of which its associated classes are members.</span></p></li><li><span style=
=3D"font-size: 10.000000pt; font-family: 'LMRoman10'"><b>=97 If T is a loca=
l class type, its associated namespaces and classes determined as if it wer=
e a member of the class or namespace of which its enclosing function is a m=
ember.</b></span></li></ul><p>There are other issues with the paragraph, th=
ough: multiple nesting levels disassociate the namespace, and forward-decla=
red enumerations may be associated improperly.<br></p></div>
</div>
</div>
=09
=09
</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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_3118_21559876.1369705617144--
.
Author: Lawrence Crowl <crowl@googlers.com>
Date: Tue, 28 May 2013 17:27:06 -0700
Raw View
On 5/27/13, Zhihao Yuan <lichray@gmail.com> wrote:
> On May 27, 2013 Nicol Bolas <jmckesson@gmail.com> wrote:
> > The fact that there's nothing a lambda can do which you can't
> > do yourself is a strength of C++ lambdas, not a weakness. It
> > allows you to swap a lambda for a regular class if the lambda
> > gets too complex for the lambda syntax to work.
>
> I agree lambdas should (must, actually) not go huge. But for the
> specific case in the thread, if you replace lambda with a named
> class, you can use operators as member functions, but for lambda,
> ADL seems to be the only choice.
>
> Changing the associated namespace may affect the behavior of
> existing code, but lambda looks OK since it's unnamed.
Should you write the paper, please include example of any existing
code that changes behavior. You get bonus points for outlining
a code migration plan.
--
Lawrence Crowl
--
---
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.
.
Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Sun, 2 Jun 2013 08:39:09 -0700 (PDT)
Raw View
------=_Part_233_21487430.1370187549997
Content-Type: text/plain; charset=ISO-8859-1
This is not exactly what you wanted, but the following works:
#include <iostream>
#include <functional>
namespace range
{
template<typename R, typename L> auto operator|(L l, R r) -> L
{
return l+r;
}
template<typename T> auto map(T t) //-> std::function<int(bool)> // GCC
4.8.0 accepts without the result type
{
return [=](bool range) -> int
{
if (range) return t.i;
return 0;
};
}
}
struct A
{
int i;
A(int i1):i(i1) {}
};
int main()
{
int something = 10;
A a1(5);
A a2(6);
int k =
something
| range::map(a1)(true)
| range::map(a2)(false);
std::cout << k << std::endl; // 15 is the printed result
}
> It's part of a range design I am working on. I have implemented everything
> I need but the lambda ADL problem means that I can't use lambdas when I
> should be able to, because the range-combine operator| can't be found.
>
--
---
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.
------=_Part_233_21487430.1370187549997
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div>This is not exactly what you wanted, but the following works:</div><di=
v> </div><div><font face=3D"courier new,monospace">#include <iostre=
am><br>#include <functional></font></div><div><font face=3D"courie=
r new,monospace">namespace range <br>{<br> template<ty=
pename R, typename L> auto operator|(L l, R r) -> L<br> &n=
bsp; {<br> return l+r; =
; <br> }<br> &nb=
sp; template<typename T> auto map(T t) //-> std::function<=
;int(bool)> // GCC 4.8.0 accepts without the result type<br>&n=
bsp; {<br> return [=
=3D](bool range) -> int<br> {<=
br> if (r=
ange) return t.i;<br> =
return 0;<br> };<br>=
}<br>}</font></div><div><font face=3D"courier new,monosp=
ace">struct A<br>{<br> int i;<br> A(int i1):i(i1) {=
}<br>};</font></div><div><font face=3D"courier new,monospace">int main() <b=
r>{<br> int something =3D 10;<br> A a1(=
5);<br> A a2(6);<br> int k =3D<br> =
; something<br> | ran=
ge::map(a1)(true)<br> | range::ma=
p(a2)(false);<br> std::cout << k << std::endl=
; // 15 is the printed result <br>=
}</font></div><div><br><br> </div><blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb=
(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div>It=
's part of a range design I am working on. I have implemented everything I =
need but the lambda ADL problem means that I can't use lambdas when I shoul=
d be able to, because the range-combine operator| can't be found.</div></bl=
ockquote>
<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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_233_21487430.1370187549997--
.
Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Sun, 2 Jun 2013 11:12:57 -0700 (PDT)
Raw View
------=_Part_26_9023732.1370196777509
Content-Type: text/plain; charset=ISO-8859-1
>
> And the following code works. I think auto may be the problem.
>
#include <iostream>
#include <functional>
bool ok = true;
namespace range
{
template<typename R, typename L> auto operator|(L l, R r) // -> int
{
return l(ok)+r(ok);
}
template<typename T> auto map(T t) //-> std::function<int(bool)>
{
return [=](bool range) -> int
{
if (range) return t.i;
return 0;
};
}
}
struct A
{
int i;
A(int i1):i(i1) {}
};
int main()
{
A a1(5);
A a2(6);
int k =
range::map(a1)
| range::map(a2);
std::cout << k << std::endl; // 11
ok = false;
k =
range::map(a1)
| range::map(a2);
std::cout << k << std::endl; // 0
}
--
---
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.
------=_Part_26_9023732.1370196777509
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; paddi=
ng-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px=
; border-left-style: solid;"><div>And the following code works. I think aut=
o may be the problem.</div></blockquote><div><font face=3D"courier new,mono=
space">#include <iostream><br>#include <functional></font></div=
><div><font face=3D"courier new,monospace">bool ok =3D true;<br>namespace r=
ange <br>{<br> template<typename R, typename L> aut=
o operator|(L l, R r) // -> int<br> {<br> &=
nbsp; return l(ok)+r(ok); &n=
bsp; <br> }<br> templ=
ate<typename T> auto map(T t) //-> std::function<int(bool)><=
br> {<br> retur=
n [=3D](bool range) -> int<br> =
{<br> if=
(range) return t.i;<br> &nb=
sp; return 0;<br> };<=
br> }<br>}</font></div><div><font face=3D"courier new,mon=
ospace">struct A<br>{<br> int i;<br> A(int i1):i(i1=
) {}<br>};</font></div><div><br><font face=3D"courier new,monospace">int ma=
in() <br>{ <br> A a1(5);<br>  =
; A a2(6);<br> int k =3D<br>  =
; range::map(a1)<br> &=
nbsp; | range::map(a2);<br> std::cout << k <<=
std::endl; // 11 <br>  =
; ok =3D false;<br> <br> k =3D<br> =
; range::map(a1)<br> &=
nbsp; | range::map(a2);<br> std::cout &=
lt;< k << std::endl; // 0 <br>=
<br>}</font> </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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
------=_Part_26_9023732.1370196777509--
.
Author: Richard Smith <richard@metafoo.co.uk>
Date: Sun, 2 Jun 2013 15:49:26 -0700
Raw View
--089e013cc328fd9c2004de33a845
Content-Type: text/plain; charset=ISO-8859-1
On Sun, Jun 2, 2013 at 11:12 AM, Mikhail Semenov <
mikhailsemenov1957@gmail.com> wrote:
> And the following code works. I think auto may be the problem.
>>
> #include <iostream>
> #include <functional>
> bool ok = true;
> namespace range
> {
> template<typename R, typename L> auto operator|(L l, R r) // -> int
> {
> return l(ok)+r(ok);
> }
> template<typename T> auto map(T t) //-> std::function<int(bool)>
> {
> return [=](bool range) -> int
> {
> if (range) return t.i;
> return 0;
> };
> }
> }
> struct A
> {
> int i;
> A(int i1):i(i1) {}
> };
>
> int main()
> {
> A a1(5);
> A a2(6);
> int k =
> range::map(a1)
> | range::map(a2);
> std::cout << k << std::endl; // 11
> ok = false;
>
> k =
> range::map(a1)
> | range::map(a2);
> std::cout << k << std::endl; // 0
>
> }
>
This does not compile in Clang:
<stdin>:31:9: error: invalid operands to binary expression ('<lambda at
<stdin>:12:16>' and '<lambda at <stdin>:12:16>')
| range::map(a2);
^ ~~~~~~~~~~~~~~
<stdin>:37:9: error: invalid operands to binary expression ('<lambda at
<stdin>:12:16>' and '<lambda at <stdin>:12:16>')
| range::map(a2);
^ ~~~~~~~~~~~~~~
It appears that g++ includes the enclosing namespaces as associated
namespaces for local classes, contrary to the current rules in the standard.
--
---
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.
--089e013cc328fd9c2004de33a845
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
On Sun, Jun 2, 2013 at 11:12 AM, Mikhail Semenov <span dir=3D"ltr"><<a h=
ref=3D"mailto:mikhailsemenov1957@gmail.com" target=3D"_blank">mikhailsemeno=
v1957@gmail.com</a>></span> wrote:<br><div class=3D"gmail_quote"><blockq=
uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc =
solid;padding-left:1ex">
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;padding=
-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-l=
eft-style:solid"><div>And the following code works. I think auto may be the=
problem.</div>
</blockquote><div><font face=3D"courier new,monospace">#include <iostrea=
m><br>#include <functional></font></div><div><font face=3D"courier=
new,monospace">bool ok =3D true;<br>namespace range <br>{<br>=A0=A0=A0 tem=
plate<typename R, typename L> auto operator|(L l, R r) // -> int<b=
r>
=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0=A0 return l(ok)+r(ok);=A0=A0=A0=A0=A0=
=A0=A0 <br><div class=3D"im">=A0=A0=A0 }<br>=A0=A0=A0 template<typename =
T> auto map(T t) //-> std::function<int(bool)><br></div><div cl=
ass=3D"im">=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0 return [=3D](bool range) -&=
gt; int<br>
=A0=A0=A0=A0=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (range) ret=
urn t.i;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return 0;<br>=A0=A0=A0=A0=A0=
=A0=A0 };<br>=A0=A0=A0 }<br>}</div></font></div><div class=3D"im"><div><fon=
t face=3D"courier new,monospace">struct A<br>{<br>=A0=A0 int i;<br>=A0=A0 A=
(int i1):i(i1) {}<br>
};</font></div></div><div><br><font face=3D"courier new,monospace">int main=
() <br>{=A0=A0=A0 <br><div class=3D"im">=A0=A0=A0 A a1(5);<br>=A0=A0=A0 A a=
2(6);<br>=A0=A0=A0 int k =3D<br></div>=A0=A0=A0=A0=A0=A0=A0 range::map(a1)<=
br>=A0=A0=A0=A0=A0=A0=A0 | range::map(a2);<br>=A0=A0=A0 std::cout << =
k << std::endl;=A0 // 11=A0=A0=A0=A0=A0 <br>
=A0=A0=A0 ok =3D false;<br>=A0=A0=A0 <br>=A0=A0=A0 k =3D<br>=A0=A0=A0=A0=A0=
=A0=A0 range::map(a1)<br>=A0=A0=A0=A0=A0=A0=A0 | range::map(a2);<br>=A0=A0=
=A0 std::cout << k << std::endl;=A0 // 0=A0=A0=A0=A0=A0 <br>=A0=
=A0=A0 <br>}</font></div></blockquote><div><br></div><div>This does not com=
pile in Clang:</div>
<div><br></div><div><div><stdin>:31:9: error: invalid operands to bin=
ary expression ('<lambda at <stdin>:12:16>' and '&l=
t;lambda at <stdin>:12:16>')</div><div>=A0 =A0 =A0 =A0 | range=
::map(a2);</div>
<div>=A0 =A0 =A0 =A0 ^ ~~~~~~~~~~~~~~</div><div><stdin>:37:9: error: =
invalid operands to binary expression ('<lambda at <stdin>:12:=
16>' and '<lambda at <stdin>:12:16>')</div><div>=
=A0 =A0 =A0 =A0 | range::map(a2);</div>
<div>=A0 =A0 =A0 =A0 ^ ~~~~~~~~~~~~~~</div></div><div><br></div><div>It app=
ears that g++ includes the enclosing namespaces as associated namespaces fo=
r local classes, contrary to the current rules in the standard.</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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--089e013cc328fd9c2004de33a845--
.
Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Mon, 3 Jun 2013 08:56:57 +0100
Raw View
--089e0118403e161dcd04de3b4f31
Content-Type: text/plain; charset=ISO-8859-1
Richard,
Have you tried to uncomment the return type?
That might be the problem.
Mikhail.
On 2 June 2013 23:49, Richard Smith <richard@metafoo.co.uk> wrote:
> On Sun, Jun 2, 2013 at 11:12 AM, Mikhail Semenov <
> mikhailsemenov1957@gmail.com> wrote:
>
>> And the following code works. I think auto may be the problem.
>>>
>> #include <iostream>
>> #include <functional>
>> bool ok = true;
>> namespace range
>> {
>> template<typename R, typename L> auto operator|(L l, R r) // -> int
>> {
>> return l(ok)+r(ok);
>> }
>> template<typename T> auto map(T t) //-> std::function<int(bool)>
>> {
>> return [=](bool range) -> int
>> {
>> if (range) return t.i;
>> return 0;
>> };
>> }
>> }
>> struct A
>> {
>> int i;
>> A(int i1):i(i1) {}
>> };
>>
>> int main()
>> {
>> A a1(5);
>> A a2(6);
>> int k =
>> range::map(a1)
>> | range::map(a2);
>> std::cout << k << std::endl; // 11
>> ok = false;
>>
>> k =
>> range::map(a1)
>> | range::map(a2);
>> std::cout << k << std::endl; // 0
>>
>> }
>>
>
> This does not compile in Clang:
>
> <stdin>:31:9: error: invalid operands to binary expression ('<lambda at
> <stdin>:12:16>' and '<lambda at <stdin>:12:16>')
> | range::map(a2);
> ^ ~~~~~~~~~~~~~~
> <stdin>:37:9: error: invalid operands to binary expression ('<lambda at
> <stdin>:12:16>' and '<lambda at <stdin>:12:16>')
> | range::map(a2);
> ^ ~~~~~~~~~~~~~~
>
> It appears that g++ includes the enclosing namespaces as associated
> namespaces for local classes, contrary to the current rules in the standard.
>
> --
>
> ---
> 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.
>
>
>
--
---
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.
--089e0118403e161dcd04de3b4f31
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div>Richard,</div>
<div>=A0</div>
<div>Have you tried to uncomment the return type?</div>
<div>That might be the problem.</div>
<div>=A0</div>
<div>Mikhail.<br><br></div>
<div class=3D"gmail_quote">On 2 June 2013 23:49, Richard Smith <span dir=3D=
"ltr"><<a href=3D"mailto:richard@metafoo.co.uk" target=3D"_blank">richar=
d@metafoo.co.uk</a>></span> wrote:<br>
<blockquote style=3D"BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PA=
DDING-LEFT:1ex" class=3D"gmail_quote">
<div class=3D"HOEnZb">
<div class=3D"h5">On Sun, Jun 2, 2013 at 11:12 AM, Mikhail Semenov <span di=
r=3D"ltr"><<a href=3D"mailto:mikhailsemenov1957@gmail.com" target=3D"_bl=
ank">mikhailsemenov1957@gmail.com</a>></span> wrote:<br></div></div>
<div class=3D"gmail_quote">
<div>
<div class=3D"h5">
<blockquote style=3D"BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PA=
DDING-LEFT:1ex" class=3D"gmail_quote">
<blockquote style=3D"BORDER-LEFT:rgb(204,204,204) 1px solid;MARGIN:0px 0px =
0px 0.8ex;PADDING-LEFT:1ex" class=3D"gmail_quote">
<div>And the following code works. I think auto may be the problem.</div></=
blockquote>
<div><font face=3D"courier new,monospace">#include <iostream><br>#inc=
lude <functional></font></div>
<div><font face=3D"courier new,monospace">bool ok =3D true;<br>namespace ra=
nge <br>{<br>=A0=A0=A0 template<typename R, typename L> auto operator=
|(L l, R r) // -> int<br>=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0=A0 return =
l(ok)+r(ok);=A0=A0=A0=A0=A0=A0=A0 <br>
<div>=A0=A0=A0 }<br>=A0=A0=A0 template<typename T> auto map(T t) //-&=
gt; std::function<int(bool)><br></div>
<div>=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0 return [=3D](bool range) -> in=
t<br>=A0=A0=A0=A0=A0=A0=A0 {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (range=
) return t.i;<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return 0;<br>=A0=A0=A0=
=A0=A0=A0=A0 };<br>=A0=A0=A0 }<br>}</div></font></div>
<div>
<div><font face=3D"courier new,monospace">struct A<br>{<br>=A0=A0 int i;<br=
>=A0=A0 A(int i1):i(i1) {}<br>};</font></div></div>
<div><br><font face=3D"courier new,monospace">int main() <br>{=A0=A0=A0 <br=
>
<div>=A0=A0=A0 A a1(5);<br>=A0=A0=A0 A a2(6);<br>=A0=A0=A0 int k =3D<br></d=
iv>=A0=A0=A0=A0=A0=A0=A0 range::map(a1)<br>=A0=A0=A0=A0=A0=A0=A0 | range::m=
ap(a2);<br>=A0=A0=A0 std::cout << k << std::endl;=A0 // 11=A0=
=A0=A0=A0=A0 <br>=A0=A0=A0 ok =3D false;<br>=A0=A0=A0 <br>=A0=A0=A0 k =3D<b=
r>=A0=A0=A0=A0=A0=A0=A0 range::map(a1)<br>
=A0=A0=A0=A0=A0=A0=A0 | range::map(a2);<br>=A0=A0=A0 std::cout << k &=
lt;< std::endl;=A0 // 0=A0=A0=A0=A0=A0 <br>=A0=A0=A0 <br>}</font></div><=
/blockquote>
<div><br></div></div></div>
<div>This does not compile in Clang:</div>
<div><br></div>
<div>
<div><stdin>:31:9: error: invalid operands to binary expression ('=
;<lambda at <stdin>:12:16>' and '<lambda at <stdi=
n>:12:16>')</div>
<div>=A0 =A0 =A0 =A0 | range::map(a2);</div>
<div>=A0 =A0 =A0 =A0 ^ ~~~~~~~~~~~~~~</div>
<div><stdin>:37:9: error: invalid operands to binary expression ('=
;<lambda at <stdin>:12:16>' and '<lambda at <stdi=
n>:12:16>')</div>
<div>=A0 =A0 =A0 =A0 | range::map(a2);</div>
<div>=A0 =A0 =A0 =A0 ^ ~~~~~~~~~~~~~~</div></div>
<div><br></div>
<div>It appears that g++ includes the enclosing namespaces as associated na=
mespaces for local classes, contrary to the current rules in the standard.<=
/div></div>
<div class=3D"HOEnZb">
<div class=3D"h5">
<p></p>-- <br>=A0<br>--- <br>You received this message because you are subs=
cribed 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=3D"mailto:std-proposals%2Bunsubscribe@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>Visit this group a=
t <a href=3D"http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=
=3Den" target=3D"_blank">http://groups.google.com/a/isocpp.org/group/std-pr=
oposals/?hl=3Den</a>.<br>
=A0<br>=A0<br></div></div></blockquote></div><br>
<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 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=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
<br />
<br />
--089e0118403e161dcd04de3b4f31--
.
Author: DeadMG <wolfeinstein@gmail.com>
Date: Mon, 3 Jun 2013 02:49:21 -0700 (PDT)
Raw View
------=_Part_3292_15318730.1370252961206
Content-Type: text/plain; charset=ISO-8859-1
It is most assuredly not the problem. Richard has clearly stated exactly
what the problem is. GCC is against Standard here.
--
---
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.
------=_Part_3292_15318730.1370252961206
Content-Type: text/html; charset=ISO-8859-1
It is most assuredly not the problem. Richard has clearly stated exactly what the problem is. GCC is against Standard here.
<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 />
------=_Part_3292_15318730.1370252961206--
.