Topic: std::visit for std::tuple


Author: Roman Orlov <mr.gordon.freman@gmail.com>
Date: Mon, 6 Mar 2017 05:48:33 -0800 (PST)
Raw View
------=_Part_570_1193560851.1488808113529
Content-Type: multipart/alternative;
 boundary="----=_Part_571_36168646.1488808113530"

------=_Part_571_36168646.1488808113530
Content-Type: text/plain; charset=UTF-8

Hi there,

Sometimes we need to iterate std::tuple instance and there is no standard
solution for it.
For myself I solved it like this

template<typename T, typename V, size_t... I>
void visit_impl(T&& t, V&& v, std::index_sequence<I...>)
{
    (..., v(std::get<I>(t)));
}


template<typename T, typename V>
void visit(T&& t, V&& v)
{
    visit_impl(std::forward<T>(t), std::forward<V>(v),
        std::make_index_sequence<std::tuple_size<
            typename std::decay<T>::type>::value>());
}


auto t = std::make_tuple(100, "500", '!');
visit(t, [](auto& x) { std::cout << x; });

So I suggest to add 'visit' functions to the <tuple> library. Just like for
std::varinat.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f58de27d-28d8-4424-b9f0-1d9e9c9555cd%40isocpp.org.

------=_Part_571_36168646.1488808113530
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi there,</div><div><br></div><div>Sometimes we need =
to iterate std::tuple instance and there is no standard solution for it.</d=
iv><div>For myself I solved it like this</div><div><br></div><div class=3D"=
prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: r=
gb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break=
-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"colo=
r: #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"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> V</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> siz=
e_t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> I</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> visit_impl</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">&amp;&amp;</span><span style=3D"color: #000;" class=3D"st=
yled-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"=
> V</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&a=
mp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> v</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">index_sequence</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify">I</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">...&gt;)</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-by=
-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(...,</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> v</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">std=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">get</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">I</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&gt;(</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"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><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">=
&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typena=
me</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 st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> V</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">void</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> visit</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp=
;</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 sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> V</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&amp;&amp;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> v</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>=C2=A0 =C2=A0 visit_impl</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">forward</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span><sp=
an 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"colo=
r: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">forward</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">V</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&gt;(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">v</span><span style=3D"color: #660;" class=3D"styled-by-prettify">),</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">make_index_sequence</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">tuple_=
size</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">decay</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">T=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;::</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">type</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">&gt;::</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">value</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&gt;());</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><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br><br><br></span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> t </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
make_tuple</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">100</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: #080;" class=3D"styled-by-prettify">&quot;500&quot;</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: #080;" =
class=3D"styled-by-prettify">&#39;!&#39;</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>visit</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">t</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</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: #008;" class=3D"styled-by-prettify">auto</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> x</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: #660;" class=3D=
"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">co=
ut </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt=
;</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 sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">});</span></div></code></div><div><=
br></div><div>So I suggest to add &#39;visit&#39; functions to the &lt;tupl=
e&gt; library. Just like for std::varinat.</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f58de27d-28d8-4424-b9f0-1d9e9c9555cd%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f58de27d-28d8-4424-b9f0-1d9e9c9555cd=
%40isocpp.org</a>.<br />

------=_Part_571_36168646.1488808113530--

------=_Part_570_1193560851.1488808113529--

.


Author: Barry Revzin <barry.revzin@gmail.com>
Date: Mon, 6 Mar 2017 07:24:06 -0800 (PST)
Raw View
------=_Part_9279_1234506849.1488813846809
Content-Type: multipart/alternative;
 boundary="----=_Part_9280_777948383.1488813846810"

------=_Part_9280_777948383.1488813846810
Content-Type: text/plain; charset=UTF-8



On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roman Orlov wrote:
>
> Hi there,
>
> Sometimes we need to iterate std::tuple instance and there is no standard
> solution for it.
> For myself I solved it like this
>
> template<typename T, typename V, size_t... I>
> void visit_impl(T&& t, V&& v, std::index_sequence<I...>)
> {
>     (..., v(std::get<I>(t)));
> }
>
>
> template<typename T, typename V>
> void visit(T&& t, V&& v)
> {
>     visit_impl(std::forward<T>(t), std::forward<V>(v),
>         std::make_index_sequence<std::tuple_size<
>             typename std::decay<T>::type>::value>());
> }
>
>
> auto t = std::make_tuple(100, "500", '!');
> visit(t, [](auto& x) { std::cout << x; });
>
> So I suggest to add 'visit' functions to the <tuple> library. Just like
> for std::varinat.
>

What you want isn't really visiting, it's more of a loop. There was a
proposal for exactly that
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0589r0.pdf) but
the response was that this would be better handled through reflection
tools. Since basically you want to loop over all the members of the tuple -
so if we had a good mechanism for reflection, this just falls out of 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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/fe027bb4-48fc-4144-bf15-a75291e71bfd%40isocpp.org.

------=_Part_9280_777948383.1488813846810
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roma=
n Orlov wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"=
><div>Hi there,</div><div><br></div><div>Sometimes we need to iterate std::=
tuple instance and there is no standard solution for it.</div><div>For myse=
lf I solved it like this</div><div><br></div><div style=3D"background-color=
:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-w=
idth:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">templa=
te</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">t=
ypename</span><span style=3D"color:#000"> T</span><span style=3D"color:#660=
">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">typ=
ename</span><span style=3D"color:#000"> V</span><span style=3D"color:#660">=
,</span><span style=3D"color:#000"> size_t</span><span style=3D"color:#660"=
>...</span><span style=3D"color:#000"> I</span><span style=3D"color:#660">&=
gt;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">=
void</span><span style=3D"color:#000"> visit_impl</span><span style=3D"colo=
r:#660">(</span><span style=3D"color:#000">T</span><span style=3D"color:#66=
0">&amp;&amp;</span><span style=3D"color:#000"> t</span><span style=3D"colo=
r:#660">,</span><span style=3D"color:#000"> V</span><span style=3D"color:#6=
60">&amp;&amp;</span><span style=3D"color:#000"> v</span><span style=3D"col=
or:#660">,</span><span style=3D"color:#000"> std</span><span style=3D"color=
:#660">::</span><span style=3D"color:#000">index_sequence</span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#000">I</span><span style=
=3D"color:#660">...&gt;)</span><span style=3D"color:#000"><br></span><span =
style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color:#660">(...,</span><span style=3D"color:#000"> v<=
/span><span style=3D"color:#660">(</span><span style=3D"color:#000">std</sp=
an><span style=3D"color:#660">::</span><span style=3D"color:#008">get</span=
><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">I</span><=
span style=3D"color:#660">&gt;(</span><span style=3D"color:#000">t</span><s=
pan style=3D"color:#660">)));</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#660">}</span><span style=3D"color:#000"><br><br><br></=
span><span style=3D"color:#008">template</span><span style=3D"color:#660">&=
lt;</span><span style=3D"color:#008">typename</span><span style=3D"color:#0=
00"> T</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=
"> V</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"=
><br></span><span style=3D"color:#008">void</span><span style=3D"color:#000=
"> visit</span><span style=3D"color:#660">(</span><span style=3D"color:#000=
">T</span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:=
#000"> t</span><span style=3D"color:#660">,</span><span style=3D"color:#000=
"> V</span><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color=
:#000"> v</span><span style=3D"color:#660">)</span><span style=3D"color:#00=
0"><br></span><span style=3D"color:#660">{</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 visit_impl</span><span style=3D"color:#660">(</span><spa=
n style=3D"color:#000">std</span><span style=3D"color:#660">::</span><span =
style=3D"color:#000">forward</span><span style=3D"color:#660">&lt;</span><s=
pan style=3D"color:#000">T</span><span style=3D"color:#660">&gt;(</span><sp=
an style=3D"color:#000">t</span><span style=3D"color:#660">),</span><span s=
tyle=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span st=
yle=3D"color:#000">forward</span><span style=3D"color:#660">&lt;</span><spa=
n style=3D"color:#000">V</span><span style=3D"color:#660">&gt;(</span><span=
 style=3D"color:#000">v</span><span style=3D"color:#660">),</span><span sty=
le=3D"color:#000"> <br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D=
"color:#660">::</span><span style=3D"color:#000">make_index_sequence</span>=
<span style=3D"color:#660">&lt;</span><span style=3D"color:#000">std</span>=
<span style=3D"color:#660">::</span><span style=3D"color:#000"><wbr>tuple_s=
ize</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">=
<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#=
008">typename</span><span style=3D"color:#000"> std</span><span style=3D"co=
lor:#660">::</span><span style=3D"color:#000">decay</span><span style=3D"co=
lor:#660">&lt;</span><span style=3D"color:#000">T</span><span style=3D"colo=
r:#660">&gt;::</span><span style=3D"color:#000">type</span><span style=3D"c=
olor:#660">&gt;::</span><span style=3D"color:#000">value</span><span style=
=3D"color:#660">&gt;()<wbr>);</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#660">}</span><span style=3D"color:#000"><br><br><br></=
span><span style=3D"color:#008">auto</span><span style=3D"color:#000"> t </=
span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> std</=
span><span style=3D"color:#660">::</span><span style=3D"color:#000">make_tu=
ple</span><span style=3D"color:#660">(</span><span style=3D"color:#066">100=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#080">&quot;500&quot;</span><span style=3D"color:#66=
0">,</span><span style=3D"color:#000"> </span><span style=3D"color:#080">&#=
39;!&#39;</span><span style=3D"color:#660">);</span><span style=3D"color:#0=
00"><br>visit</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:#008">a=
uto</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"=
> x</span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </=
span><span style=3D"color:#660">{</span><span style=3D"color:#000"> std</sp=
an><span style=3D"color:#660">::</span><span style=3D"color:#000">cout </sp=
an><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000"> x<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"> </span=
><span style=3D"color:#660">});</span></div></code></div><div><br></div><di=
v>So I suggest to add &#39;visit&#39; functions to the &lt;tuple&gt; librar=
y. Just like for std::varinat.</div></div></blockquote><div><br></div><div>=
What you want isn&#39;t really visiting, it&#39;s more of a loop. There was=
 a proposal for exactly that (http://www.open-std.org/jtc1/sc22/wg21/docs/p=
apers/2017/p0589r0.pdf) but the response was that this would be better hand=
led through reflection tools. Since basically you want to loop over all the=
 members of the tuple - so if we had a good mechanism for reflection, this =
just falls out of that.=C2=A0</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/fe027bb4-48fc-4144-bf15-a75291e71bfd%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fe027bb4-48fc-4144-bf15-a75291e71bfd=
%40isocpp.org</a>.<br />

------=_Part_9280_777948383.1488813846810--

------=_Part_9279_1234506849.1488813846809--

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Mon, 6 Mar 2017 19:55:42 +0100
Raw View
This is a multi-part message in MIME format.
--------------F406D6C2F09DC3A6FC524446
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 06/03/2017 =C3=A0 14:48, Roman Orlov a =C3=A9crit :
> Hi there,
>
> Sometimes we need to iterate std::tuple instance and there is no=20
> standard solution for it.
> For myself I solved it like this
>
> |
> template<typenameT,typenameV,size_t...I>
> voidvisit_impl(T&&t,V&&v,std::index_sequence<I...>)
> {
> (...,v(std::get<I>(t)));
> }
>
>
> template<typenameT,typenameV>
> voidvisit(T&&t,V&&v)
> {
>     visit_impl(std::forward<T>(t),std::forward<V>(v),
>         std::make_index_sequence<std::tuple_size<
> typenamestd::decay<T>::type>::value>());
> }
>
>
> autot =3Dstd::make_tuple(100,"500",'!');
> visit(t,[](auto&x){std::cout <<x;});
> |
>
> So I suggest to add 'visit' functions to the <tuple> library. Just=20
> like for std::varinat.

I wrote a proposal that match a variadic number of sum (variant-like) types=
..

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0050r0.pdf

I would need to adapt it to the current std::variant interface.

When we consider any type as a sum type with a single alternative, the=20
variadic match function works for pack types and could as well work for=20
tuples.

At the same time there were other related proposals (for variant) and=20
even if there were some interest, we need a common proposal.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0080r0.pdf



Vicente

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/2c8abb23-a029-51e0-08c7-253ad938b030%40wanadoo.f=
r.

--------------F406D6C2F09DC3A6FC524446
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">Le 06/03/2017 =C3=A0 14:48, Roman Orlov =
a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote
      cite=3D"mid:f58de27d-28d8-4424-b9f0-1d9e9c9555cd@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr">
        <div>Hi there,</div>
        <div><br>
        </div>
        <div>Sometimes we need to iterate std::tuple instance and there
          is no standard solution for it.</div>
        <div>For myself I solved it like this</div>
        <div><br>
        </div>
        <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-prettify">template</span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span
                style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</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
                style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
                style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> V</spa=
n><span
                style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> size_t=
</span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">...</sp=
an><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> I</spa=
n><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</s=
pan><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">
                visit_impl</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-by-prettify">&amp;&a=
mp;</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
                style=3D"color: #000;" class=3D"styled-by-prettify"> V</spa=
n><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&a=
mp;</span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> v</spa=
n><span
                style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span
                style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify">index_s=
equence</span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span
                style=3D"color: #000;" class=3D"styled-by-prettify">I</span=
><span
                style=3D"color: #660;" class=3D"styled-by-prettify">...&gt;=
)</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>
                =C2=A0 =C2=A0 </span><span style=3D"color: #660;"
                class=3D"styled-by-prettify">(...,</span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> v</spa=
n><span
                style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
                style=3D"color: #000;" class=3D"styled-by-prettify">std</sp=
an><span
                style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
                style=3D"color: #008;" class=3D"styled-by-prettify">get</sp=
an><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span
                style=3D"color: #000;" class=3D"styled-by-prettify">I</span=
><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</=
span><span
                style=3D"color: #000;" class=3D"styled-by-prettify">t</span=
><span
                style=3D"color: #660;" class=3D"styled-by-prettify">)));</s=
pan><span
                style=3D"color: #000;" class=3D"styled-by-prettify"><br>
              </span><span style=3D"color: #660;"
                class=3D"styled-by-prettify">}</span><span style=3D"color:
                #000;" class=3D"styled-by-prettify"><br>
                <br>
                <br>
              </span><span style=3D"color: #008;"
                class=3D"styled-by-prettify">template</span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span
                style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</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
                style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
                style=3D"color: #008;" class=3D"styled-by-prettify">typenam=
e</span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> V</spa=
n><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</s=
pan><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"> visit<=
/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-by-prettify">&amp;&a=
mp;</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
                style=3D"color: #000;" class=3D"styled-by-prettify"> V</spa=
n><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&a=
mp;</span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> v</spa=
n><span
                style=3D"color: #660;" class=3D"styled-by-prettify">)</span=
><span
                style=3D"color: #000;" class=3D"styled-by-prettify"><br>
              </span><span style=3D"color: #660;"
                class=3D"styled-by-prettify">{</span><span style=3D"color:
                #000;" class=3D"styled-by-prettify"><br>
                =C2=A0 =C2=A0 visit_impl</span><span style=3D"color: #660;"
                class=3D"styled-by-prettify">(</span><span style=3D"color:
                #000;" class=3D"styled-by-prettify">std</span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify">forward=
</span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span
                style=3D"color: #000;" class=3D"styled-by-prettify">T</span=
><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</=
span><span
                style=3D"color: #000;" class=3D"styled-by-prettify">t</span=
><span
                style=3D"color: #660;" class=3D"styled-by-prettify">),</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span
                style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify">forward=
</span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span
                style=3D"color: #000;" class=3D"styled-by-prettify">V</span=
><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</=
span><span
                style=3D"color: #000;" class=3D"styled-by-prettify">v</span=
><span
                style=3D"color: #660;" class=3D"styled-by-prettify">),</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> <br>
                =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:=
 #660;"
                class=3D"styled-by-prettify">::</span><span style=3D"color:
                #000;" class=3D"styled-by-prettify">make_index_sequence</sp=
an><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span
                style=3D"color: #000;" class=3D"styled-by-prettify">std</sp=
an><span
                style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify">tuple_s=
ize</span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span
                style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span styl=
e=3D"color: #008;"
                class=3D"styled-by-prettify">typename</span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span
                style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify">decay</=
span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span
                style=3D"color: #000;" class=3D"styled-by-prettify">T</span=
><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&gt;::<=
/span><span
                style=3D"color: #000;" class=3D"styled-by-prettify">type</s=
pan><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&gt;::<=
/span><span
                style=3D"color: #000;" class=3D"styled-by-prettify">value</=
span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&gt;())=
;</span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"><br>
              </span><span style=3D"color: #660;"
                class=3D"styled-by-prettify">}</span><span style=3D"color:
                #000;" class=3D"styled-by-prettify"><br>
                <br>
                <br>
              </span><span style=3D"color: #008;"
                class=3D"styled-by-prettify">auto</span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> t </sp=
an><span
                style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span
                style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify">make_tu=
ple</span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
                style=3D"color: #066;" class=3D"styled-by-prettify">100</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: #080;" class=3D"styled-by-prettify">"500"</=
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: #080;" class=3D"styled-by-prettify">'!'</sp=
an><span
                style=3D"color: #660;" class=3D"styled-by-prettify">);</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                visit</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-by-prettify">,</span=
><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
                style=3D"color: #660;" class=3D"styled-by-prettify">[](</sp=
an><span
                style=3D"color: #008;" class=3D"styled-by-prettify">auto</s=
pan><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</=
span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> x</spa=
n><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"> std</s=
pan><span
                style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
                style=3D"color: #000;" class=3D"styled-by-prettify">cout </=
span><span
                style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt=
;</span><span
                style=3D"color: #000;" class=3D"styled-by-prettify"> x</spa=
n><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">});</sp=
an></div>
          </code></div>
        <div><br>
        </div>
        <div>So I suggest to add 'visit' functions to the &lt;tuple&gt;
          library. Just like for std::varinat.</div>
      </div>
    </blockquote>
    <br>
    I wrote a proposal that match a variadic number of sum
    (variant-like) types.<br>
    <br>
    =C2=A0=C2=A0=C2=A0
    <a class=3D"moz-txt-link-freetext" href=3D"http://www.open-std.org/jtc1=
/sc22/wg21/docs/papers/2015/p0050r0.pdf">http://www.open-std.org/jtc1/sc22/=
wg21/docs/papers/2015/p0050r0.pdf</a><br>
    <br>
    I would need to adapt it to the current std::variant interface.<br>
    <br>
    When we consider any type as a sum type with a single alternative,
    the variadic match function works for pack types and could as well
    work for tuples.<br>
    <br>
    At the same time there were other related proposals (for variant)
    and even if there were some interest, we need a common proposal. <br>
    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
    <br>
    =C2=A0=C2=A0=C2=A0
    <a class=3D"moz-txt-link-freetext" href=3D"http://www.open-std.org/jtc1=
/sc22/wg21/docs/papers/2015/p0080r0.pdf">http://www.open-std.org/jtc1/sc22/=
wg21/docs/papers/2015/p0080r0.pdf</a><br>
    <br>
    <br>
    <br>
    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
    Vicente<br>
  </body>
</html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2c8abb23-a029-51e0-08c7-253ad938b030%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2c8abb23-a029-51e0-08c7-253ad938b030=
%40wanadoo.fr</a>.<br />

--------------F406D6C2F09DC3A6FC524446--

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Mon, 6 Mar 2017 21:24:06 +0100
Raw View
This is a multi-part message in MIME format.
--------------84DC7DD9BFBA5CB72B49815A
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 06/03/2017 =C3=A0 16:24, Barry Revzin a =C3=A9crit :
>
>
> On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roman Orlov wrote:
>
>     Hi there,
>
>     Sometimes we need to iterate std::tuple instance and there is no
>     standard solution for it.
>     For myself I solved it like this
>
>     |
>     template<typenameT,typenameV,size_t...I>
>     voidvisit_impl(T&&t,V&&v,std::index_sequence<I...>)
>     {
>     (...,v(std::get<I>(t)));
>     }
>
>
>     template<typenameT,typenameV>
>     voidvisit(T&&t,V&&v)
>     {
>         visit_impl(std::forward<T>(t),std::forward<V>(v),
>             std::make_index_sequence<std::tuple_size<
>     typenamestd::decay<T>::type>::value>());
>     }
>
>
>     autot =3Dstd::make_tuple(100,"500",'!');
>     visit(t,[](auto&x){std::cout <<x;});
>     |
>
>     So I suggest to add 'visit' functions to the <tuple> library. Just
>     like for std::varinat.
>
>
> What you want isn't really visiting, it's more of a loop. There was a=20
> proposal for exactly that=20
> (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0589r0.pdf)=20
> but the response was that this would be better handled through=20
> reflection tools. Since basically you want to loop over all the=20
> members of the tuple - so if we had a good mechanism for reflection,=20
> this just falls out of that.
Well, reflection will give you the means but will not give you=20
visitation, nor loop. We need these kind of proposal on top of reflection.

In order to be able to do that for any product-type, as we are able to=20
extract all the elements using structure binding, we need a common=20
interface: to iterate, either to visit or either to access each one of=20
the members directly (tuple-like access). All the interfaces are=20
equivalent, that is, we can implement each function using the others.

In http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0327r1.pdf I=20
propose a tuple-like access that takes in account the same types that=20
support structure binding. Boost.Hana uses Sequence (iteration, fold and=20
make) as basic functions.

The question then is what is the complexity (performance) of all these=20
operations when implemented using the others.
The tuple-like access (direct access and the size) is what the compiler=20
knows already for a tuple-like type, as std::tuple, or a struct.
I believe that reflection should provide a tuple-like interface for=20
those kind of types. Then you wan implement visit for all of them.

I believe the function you are proposing is useful, as the=20
implementation is simple. p0327r1 names it for_each.

I like P0589, it makes it possible to do simple things simpler. People=20
know better how to iterate.
However I prefer in general the functional approach. No raw loops.

Vicente

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/690f6bf4-8641-974a-0b79-714396e5bc93%40wanadoo.f=
r.

--------------84DC7DD9BFBA5CB72B49815A
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">Le 06/03/2017 =C3=A0 16:24, Barry Revzin=
 a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote
      cite=3D"mid:fe027bb4-48fc-4144-bf15-a75291e71bfd@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr"><br>
        <br>
        On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roman Orlov wrote:
        <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>Hi there,</div>
            <div><br>
            </div>
            <div>Sometimes we need to iterate std::tuple instance and
              there is no standard solution for it.</div>
            <div>For myself I solved it like this</div>
            <div><br>
            </div>
            <div
style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bo=
rder-style:solid;border-width:1px;word-wrap:break-word"><code>
                <div><span style=3D"color:#008">template</span><span
                    style=3D"color:#660">&lt;</span><span
                    style=3D"color:#008">typename</span><span
                    style=3D"color:#000"> T</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"> V</span><span style=3D"color:#660=
">,</span><span
                    style=3D"color:#000"> size_t</span><span
                    style=3D"color:#660">...</span><span
                    style=3D"color:#000"> I</span><span style=3D"color:#660=
">&gt;</span><span
                    style=3D"color:#000"><br>
                  </span><span style=3D"color:#008">void</span><span
                    style=3D"color:#000"> visit_impl</span><span
                    style=3D"color:#660">(</span><span style=3D"color:#000"=
>T</span><span
                    style=3D"color:#660">&amp;&amp;</span><span
                    style=3D"color:#000"> t</span><span style=3D"color:#660=
">,</span><span
                    style=3D"color:#000"> V</span><span style=3D"color:#660=
">&amp;&amp;</span><span
                    style=3D"color:#000"> v</span><span style=3D"color:#660=
">,</span><span
                    style=3D"color:#000"> std</span><span
                    style=3D"color:#660">::</span><span style=3D"color:#000=
">index_sequence</span><span
                    style=3D"color:#660">&lt;</span><span
                    style=3D"color:#000">I</span><span style=3D"color:#660"=
>...&gt;)</span><span
                    style=3D"color:#000"><br>
                  </span><span style=3D"color:#660">{</span><span
                    style=3D"color:#000"><br>
                    =C2=A0 =C2=A0 </span><span style=3D"color:#660">(...,</=
span><span
                    style=3D"color:#000"> v</span><span style=3D"color:#660=
">(</span><span
                    style=3D"color:#000">std</span><span
                    style=3D"color:#660">::</span><span style=3D"color:#008=
">get</span><span
                    style=3D"color:#660">&lt;</span><span
                    style=3D"color:#000">I</span><span style=3D"color:#660"=
>&gt;(</span><span
                    style=3D"color:#000">t</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"><br>
                    <br>
                    <br>
                  </span><span style=3D"color:#008">template</span><span
                    style=3D"color:#660">&lt;</span><span
                    style=3D"color:#008">typename</span><span
                    style=3D"color:#000"> T</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"> V</span><span style=3D"color:#660=
">&gt;</span><span
                    style=3D"color:#000"><br>
                  </span><span style=3D"color:#008">void</span><span
                    style=3D"color:#000"> visit</span><span
                    style=3D"color:#660">(</span><span style=3D"color:#000"=
>T</span><span
                    style=3D"color:#660">&amp;&amp;</span><span
                    style=3D"color:#000"> t</span><span style=3D"color:#660=
">,</span><span
                    style=3D"color:#000"> V</span><span style=3D"color:#660=
">&amp;&amp;</span><span
                    style=3D"color:#000"> v</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"><br>
                    =C2=A0 =C2=A0 visit_impl</span><span style=3D"color:#66=
0">(</span><span
                    style=3D"color:#000">std</span><span
                    style=3D"color:#660">::</span><span style=3D"color:#000=
">forward</span><span
                    style=3D"color:#660">&lt;</span><span
                    style=3D"color:#000">T</span><span style=3D"color:#660"=
>&gt;(</span><span
                    style=3D"color:#000">t</span><span style=3D"color:#660"=
>),</span><span
                    style=3D"color:#000"> std</span><span
                    style=3D"color:#660">::</span><span style=3D"color:#000=
">forward</span><span
                    style=3D"color:#660">&lt;</span><span
                    style=3D"color:#000">V</span><span style=3D"color:#660"=
>&gt;(</span><span
                    style=3D"color:#000">v</span><span style=3D"color:#660"=
>),</span><span
                    style=3D"color:#000"> <br>
                    =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"co=
lor:#660">::</span><span
                    style=3D"color:#000">make_index_sequence</span><span
                    style=3D"color:#660">&lt;</span><span
                    style=3D"color:#000">std</span><span
                    style=3D"color:#660">::</span><span style=3D"color:#000=
"><wbr>tuple_size</span><span
                    style=3D"color:#660">&lt;</span><span
                    style=3D"color:#000"><br>
                    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span =
style=3D"color:#008">typename</span><span
                    style=3D"color:#000"> std</span><span
                    style=3D"color:#660">::</span><span style=3D"color:#000=
">decay</span><span
                    style=3D"color:#660">&lt;</span><span
                    style=3D"color:#000">T</span><span style=3D"color:#660"=
>&gt;::</span><span
                    style=3D"color:#000">type</span><span
                    style=3D"color:#660">&gt;::</span><span
                    style=3D"color:#000">value</span><span
                    style=3D"color:#660">&gt;()<wbr>);</span><span
                    style=3D"color:#000"><br>
                  </span><span style=3D"color:#660">}</span><span
                    style=3D"color:#000"><br>
                    <br>
                    <br>
                  </span><span style=3D"color:#008">auto</span><span
                    style=3D"color:#000"> t </span><span
                    style=3D"color:#660">=3D</span><span style=3D"color:#00=
0">
                    std</span><span style=3D"color:#660">::</span><span
                    style=3D"color:#000">make_tuple</span><span
                    style=3D"color:#660">(</span><span style=3D"color:#066"=
>100</span><span
                    style=3D"color:#660">,</span><span style=3D"color:#000"=
>
                  </span><span style=3D"color:#080">"500"</span><span
                    style=3D"color:#660">,</span><span style=3D"color:#000"=
>
                  </span><span style=3D"color:#080">'!'</span><span
                    style=3D"color:#660">);</span><span style=3D"color:#000=
"><br>
                    visit</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:#008">auto</span><span
                    style=3D"color:#660">&amp;</span><span
                    style=3D"color:#000"> x</span><span style=3D"color:#660=
">)</span><span
                    style=3D"color:#000"> </span><span style=3D"color:#660"=
>{</span><span
                    style=3D"color:#000"> std</span><span
                    style=3D"color:#660">::</span><span style=3D"color:#000=
">cout
                  </span><span style=3D"color:#660">&lt;&lt;</span><span
                    style=3D"color:#000"> x</span><span style=3D"color:#660=
">;</span><span
                    style=3D"color:#000"> </span><span style=3D"color:#660"=
>});</span></div>
              </code></div>
            <div><br>
            </div>
            <div>So I suggest to add 'visit' functions to the
              &lt;tuple&gt; library. Just like for std::varinat.</div>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div>What you want isn't really visiting, it's more of a loop.
          There was a proposal for exactly that
          (<a class=3D"moz-txt-link-freetext" href=3D"http://www.open-std.o=
rg/jtc1/sc22/wg21/docs/papers/2017/p0589r0.pdf">http://www.open-std.org/jtc=
1/sc22/wg21/docs/papers/2017/p0589r0.pdf</a>)
          but the response was that this would be better handled through
          reflection tools. Since basically you want to loop over all
          the members of the tuple - so if we had a good mechanism for
          reflection, this just falls out of that.=C2=A0</div>
      </div>
    </blockquote>
    Well, reflection will give you the means but will not give you
    visitation, nor loop. We need these kind of proposal on top of
    reflection.<br>
    <br>
    In order to be able to do that for any product-type, as we are able
    to extract all the elements using structure binding, we need a
    common interface: to iterate, either to visit or either to access
    each one of the members directly (tuple-like access). All the
    interfaces are equivalent, that is, we can implement each function
    using the others. <br>
    <br>
    In
    <a class=3D"moz-txt-link-freetext" href=3D"http://www.open-std.org/jtc1=
/sc22/wg21/docs/papers/2016/p0327r1.pdf">http://www.open-std.org/jtc1/sc22/=
wg21/docs/papers/2016/p0327r1.pdf</a>
    I propose a tuple-like access that takes in account the same types
    that support structure binding. Boost.Hana uses Sequence (iteration,
    fold and make) as basic functions.<br>
    <br>
    The question then is what is the complexity (performance) of all
    these operations when implemented using the others.<br>
    The tuple-like access (direct access and the size) is what the
    compiler knows already for a tuple-like type, as std::tuple, or a
    struct.<br>
    I believe that reflection should provide a tuple-like interface for
    those kind of types. Then you wan implement visit for all of them.<br>
    <br>
    I believe the function you are proposing is useful, as the
    implementation is simple. p0327r1 names it for_each.<br>
    <br>
    I like P0589, it makes it possible to do simple things simpler.
    People know better how to iterate.<br>
    However I prefer in general the functional approach. No raw loops.<br>
    <br>
    Vicente<br>
    =C2=A0<br>
  </body>
</html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/690f6bf4-8641-974a-0b79-714396e5bc93%=
40wanadoo.fr?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/690f6bf4-8641-974a-0b79-714396e5bc93=
%40wanadoo.fr</a>.<br />

--------------84DC7DD9BFBA5CB72B49815A--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 6 Mar 2017 12:54:26 -0800 (PST)
Raw View
------=_Part_1681_2116514708.1488833666583
Content-Type: multipart/alternative;
 boundary="----=_Part_1682_332301284.1488833666583"

------=_Part_1682_332301284.1488833666583
Content-Type: text/plain; charset=UTF-8

It seems to me that the generalized tuple unpacking proposal
<http://wg21.link/P0535> makes this all obsolete:

auto t = std::make_tuple(100, "500", '!');
[](auto& x) { std::cout << x; }([:]t)...;

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8a0cf5fb-7a49-4cb0-95ba-c90583548303%40isocpp.org.

------=_Part_1682_332301284.1488833666583
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It seems to me that the <a href=3D"http://wg21.link/P0535"=
>generalized tuple unpacking proposal</a> makes this all obsolete:<br><br><=
div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 1=
87, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word=
;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> t </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">make_tuple</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=
=3D"styled-by-prettify">100</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&=
quot;500&quot;</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #080;" class=3D"styled-by-prettify">&#39;!&#39;</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: #660;" class=3D"styled-by-prettify">[](</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">&amp;</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"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"> st=
d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">cout </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">&lt;&lt;</span><span s=
tyle=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: #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"=
styled-by-prettify">t</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">)...;</span></div></code></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8a0cf5fb-7a49-4cb0-95ba-c90583548303%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8a0cf5fb-7a49-4cb0-95ba-c90583548303=
%40isocpp.org</a>.<br />

------=_Part_1682_332301284.1488833666583--

------=_Part_1681_2116514708.1488833666583--

.


Author: Roman Orlov <mr.gordon.freman@gmail.com>
Date: Wed, 8 Mar 2017 03:04:25 -0800 (PST)
Raw View
------=_Part_115_385894570.1488971066011
Content-Type: multipart/alternative;
 boundary="----=_Part_116_810500386.1488971066011"

------=_Part_116_810500386.1488971066011
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Thanks for feedback, P0589 is a good solution. But besides raw loops there=
=20
should be 'visit' functions (implemented via tuple-based for loop) to use=
=20
them in higher-order functions.

=D0=BF=D0=BE=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA, 6 =D0=
=BC=D0=B0=D1=80=D1=82=D0=B0 2017 =D0=B3., 18:24:07 UTC+3 =D0=BF=D0=BE=D0=BB=
=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Barry Revzin=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
>
>
> On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roman Orlov wrote:
>>
>> Hi there,
>>
>> Sometimes we need to iterate std::tuple instance and there is no standar=
d=20
>> solution for it.
>> For myself I solved it like this
>>
>> template<typename T, typename V, size_t... I>
>> void visit_impl(T&& t, V&& v, std::index_sequence<I...>)
>> {
>>     (..., v(std::get<I>(t)));
>> }
>>
>>
>> template<typename T, typename V>
>> void visit(T&& t, V&& v)
>> {
>>     visit_impl(std::forward<T>(t), std::forward<V>(v),=20
>>         std::make_index_sequence<std::tuple_size<
>>             typename std::decay<T>::type>::value>());
>> }
>>
>>
>> auto t =3D std::make_tuple(100, "500", '!');
>> visit(t, [](auto& x) { std::cout << x; });
>>
>> So I suggest to add 'visit' functions to the <tuple> library. Just like=
=20
>> for std::varinat.
>>
>
> What you want isn't really visiting, it's more of a loop. There was a=20
> proposal for exactly that (
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0589r0.pdf) but=
=20
> the response was that this would be better handled through reflection=20
> tools. Since basically you want to loop over all the members of the tuple=
 -=20
> so if we had a good mechanism for reflection, this just falls out of that=
..=20
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/87b0ba34-2f7d-4736-bf7c-c0646ebe35c6%40isocpp.or=
g.

------=_Part_116_810500386.1488971066011
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thanks for feedback, P0589 is a good solution. But besides=
 raw loops there should be &#39;visit&#39; functions (implemented via tuple=
-based for loop) to use them in higher-order functions.<br><br>=D0=BF=D0=BE=
=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA, 6 =D0=BC=D0=B0=D1=
=80=D1=82=D0=B0 2017 =D0=B3., 18:24:07 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=
=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Barry Revzin =D0=BD=D0=B0=D0=BF=
=D0=B8=D1=81=D0=B0=D0=BB:<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"><br><br>On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roman Orl=
ov wrote:<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>Hi t=
here,</div><div><br></div><div>Sometimes we need to iterate std::tuple inst=
ance and there is no standard solution for it.</div><div>For myself I solve=
d it like this</div><div><br></div><div style=3D"background-color:rgb(250,2=
50,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;w=
ord-wrap:break-word"><code><div><span style=3D"color:#008">template</span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</s=
pan><span style=3D"color:#000"> T</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#008">typename</spa=
n><span style=3D"color:#000"> V</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"> size_t</span><span style=3D"color:#660">...</span=
><span style=3D"color:#000"> I</span><span style=3D"color:#660">&gt;</span>=
<span style=3D"color:#000"><br></span><span style=3D"color:#008">void</span=
><span style=3D"color:#000"> visit_impl</span><span style=3D"color:#660">(<=
/span><span style=3D"color:#000">T</span><span style=3D"color:#660">&amp;&a=
mp;</span><span style=3D"color:#000"> t</span><span style=3D"color:#660">,<=
/span><span style=3D"color:#000"> V</span><span style=3D"color:#660">&amp;&=
amp;</span><span style=3D"color:#000"> v</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#000">index_sequence</span><span style=3D"color:=
#660">&lt;</span><span style=3D"color:#000">I</span><span style=3D"color:#6=
60">...&gt;)</span><span style=3D"color:#000"><br></span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color:#660">(...,</span><span style=3D"color:#000"> v</span><span =
style=3D"color:#660">(</span><span style=3D"color:#000">std</span><span sty=
le=3D"color:#660">::</span><span style=3D"color:#008">get</span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#000">I</span><span style=
=3D"color:#660">&gt;(</span><span style=3D"color:#000">t</span><span style=
=3D"color:#660">)));</span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#660">}</span><span style=3D"color:#000"><br><br><br></span><spa=
n style=3D"color:#008">template</span><span style=3D"color:#660">&lt;</span=
><span style=3D"color:#008">typename</span><span style=3D"color:#000"> T</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><=
span style=3D"color:#008">typename</span><span style=3D"color:#000"> V</spa=
n><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">void</span><span style=3D"color:#000"> visit<=
/span><span style=3D"color:#660">(</span><span style=3D"color:#000">T</span=
><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000"> t<=
/span><span style=3D"color:#660">,</span><span style=3D"color:#000"> V</spa=
n><span style=3D"color:#660">&amp;&amp;</span><span style=3D"color:#000"> v=
</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"><br>=C2=
=A0 =C2=A0 visit_impl</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">forward</span><span style=3D"color:#660">&lt;</span><span s=
tyle=3D"color:#000">T</span><span style=3D"color:#660">&gt;(</span><span st=
yle=3D"color:#000">t</span><span style=3D"color:#660">),</span><span style=
=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">forward</span><span style=3D"color:#660">&lt;</span><span s=
tyle=3D"color:#000">V</span><span style=3D"color:#660">&gt;(</span><span st=
yle=3D"color:#000">v</span><span style=3D"color:#660">),</span><span style=
=3D"color:#000"> <br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"c=
olor:#660">::</span><span style=3D"color:#000">make_index_sequence</span><s=
pan style=3D"color:#660">&lt;</span><span style=3D"color:#000">std</span><s=
pan style=3D"color:#660">::</span><span style=3D"color:#000"><wbr>tuple_siz=
e</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#00=
8">typename</span><span style=3D"color:#000"> std</span><span style=3D"colo=
r:#660">::</span><span style=3D"color:#000">decay</span><span style=3D"colo=
r:#660">&lt;</span><span style=3D"color:#000">T</span><span style=3D"color:=
#660">&gt;::</span><span style=3D"color:#000">type</span><span style=3D"col=
or:#660">&gt;::</span><span style=3D"color:#000">value</span><span style=3D=
"color:#660">&gt;()<wbr>);</span><span style=3D"color:#000"><br></span><spa=
n style=3D"color:#660">}</span><span style=3D"color:#000"><br><br><br></spa=
n><span style=3D"color:#008">auto</span><span style=3D"color:#000"> t </spa=
n><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> std</spa=
n><span style=3D"color:#660">::</span><span style=3D"color:#000">make_tuple=
</span><span style=3D"color:#660">(</span><span style=3D"color:#066">100</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><=
span style=3D"color:#080">&quot;500&quot;</span><span style=3D"color:#660">=
,</span><span style=3D"color:#000"> </span><span style=3D"color:#080">&#39;=
!&#39;</span><span style=3D"color:#660">);</span><span style=3D"color:#000"=
><br>visit</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
00">t</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">[](</span><span style=3D"color:#008">auto=
</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"> x=
</span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">{</span><span style=3D"color:#000"> std</span>=
<span style=3D"color:#660">::</span><span style=3D"color:#000">cout </span>=
<span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000"> x</sp=
an><span style=3D"color:#660">;</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#660">});</span></div></code></div><div><br></div><div>S=
o I suggest to add &#39;visit&#39; functions to the &lt;tuple&gt; library. =
Just like for std::varinat.</div></div></blockquote><div><br></div><div>Wha=
t you want isn&#39;t really visiting, it&#39;s more of a loop. There was a =
proposal for exactly that (<a href=3D"http://www.open-std.org/jtc1/sc22/wg2=
1/docs/papers/2017/p0589r0.pdf" target=3D"_blank" rel=3D"nofollow" onmoused=
own=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.ope=
n-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0589r0.pdf\x26sa\x=
3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHo_z56PfjswdyRXRfRdD1Z_UpJFw&#39;;return t=
rue;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F=
%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0589r0.p=
df\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHo_z56PfjswdyRXRfRdD1Z_UpJFw&#39=
;;return true;">http://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/201=
7/<wbr>p0589r0.pdf</a>) but the response was that this would be better hand=
led through reflection tools. Since basically you want to loop over all the=
 members of the tuple - so if we had a good mechanism for reflection, this =
just falls out of that.=C2=A0</div></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/87b0ba34-2f7d-4736-bf7c-c0646ebe35c6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/87b0ba34-2f7d-4736-bf7c-c0646ebe35c6=
%40isocpp.org</a>.<br />

------=_Part_116_810500386.1488971066011--

------=_Part_115_385894570.1488971066011--

.


Author: Roman Orlov <mr.gordon.freman@gmail.com>
Date: Wed, 8 Mar 2017 03:16:41 -0800 (PST)
Raw View
------=_Part_109_1502832698.1488971802000
Content-Type: multipart/alternative;
 boundary="----=_Part_110_323159884.1488971802001"

------=_Part_110_323159884.1488971802001
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I agree with you. I think there should be a choice to use raw loops or to=
=20
use functional approach. Such functions can be implemented via raw loops=20
(P0589). But if there are only raw loops we have to manually implement=20
'visit' functions to use them in higher-order functions. I'd like to have=
=20
these functions in the standard library.

=D0=BF=D0=BE=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA, 6 =D0=
=BC=D0=B0=D1=80=D1=82=D0=B0 2017 =D0=B3., 23:24:09 UTC+3 =D0=BF=D0=BE=D0=BB=
=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Vicente J. Botet=20
Escriba =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> Le 06/03/2017 =C3=A0 16:24, Barry Revzin a =C3=A9crit :
>
>
>
> On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roman Orlov wrote:=20
>>
>> Hi there,
>>
>> Sometimes we need to iterate std::tuple instance and there is no standar=
d=20
>> solution for it.
>> For myself I solved it like this
>>
>> template<typename T, typename V, size_t... I>
>> void visit_impl(T&& t, V&& v, std::index_sequence<I...>)
>> {
>>     (..., v(std::get<I>(t)));
>> }
>>
>>
>> template<typename T, typename V>
>> void visit(T&& t, V&& v)
>> {
>>     visit_impl(std::forward<T>(t), std::forward<V>(v),=20
>>         std::make_index_sequence<std::tuple_size<
>>             typename std::decay<T>::type>::value>());
>> }
>>
>>
>> auto t =3D std::make_tuple(100, "500", '!');
>> visit(t, [](auto& x) { std::cout << x; });
>>
>> So I suggest to add 'visit' functions to the <tuple> library. Just like=
=20
>> for std::varinat.
>>
>
> What you want isn't really visiting, it's more of a loop. There was a=20
> proposal for exactly that (
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0589r0.pdf) but=
=20
> the response was that this would be better handled through reflection=20
> tools. Since basically you want to loop over all the members of the tuple=
 -=20
> so if we had a good mechanism for reflection, this just falls out of that=
..=20
>
> Well, reflection will give you the means but will not give you visitation=
,=20
> nor loop. We need these kind of proposal on top of reflection.
>
> In order to be able to do that for any product-type, as we are able to=20
> extract all the elements using structure binding, we need a common=20
> interface: to iterate, either to visit or either to access each one of th=
e=20
> members directly (tuple-like access). All the interfaces are equivalent,=
=20
> that is, we can implement each function using the others.=20
>
> In http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0327r1.pdf I=
=20
> propose a tuple-like access that takes in account the same types that=20
> support structure binding. Boost.Hana uses Sequence (iteration, fold and=
=20
> make) as basic functions.
>
> The question then is what is the complexity (performance) of all these=20
> operations when implemented using the others.
> The tuple-like access (direct access and the size) is what the compiler=
=20
> knows already for a tuple-like type, as std::tuple, or a struct.
> I believe that reflection should provide a tuple-like interface for those=
=20
> kind of types. Then you wan implement visit for all of them.
>
> I believe the function you are proposing is useful, as the implementation=
=20
> is simple. p0327r1 names it for_each.
>
> I like P0589, it makes it possible to do simple things simpler. People=20
> know better how to iterate.
> However I prefer in general the functional approach. No raw loops.
>
> Vicente
> =20
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/889e8bcc-b370-429a-8228-685af733f79b%40isocpp.or=
g.

------=_Part_110_323159884.1488971802001
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I agree with you. I think there should be a choice to use =
raw loops or to use functional approach. Such functions can be implemented =
via raw loops (P0589). But if there are only raw loops we have to manually =
implement &#39;visit&#39; functions to use them in higher-order functions. =
I&#39;d like to have these functions in the standard library.<br><br>=D0=BF=
=D0=BE=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA, 6 =D0=BC=D0=
=B0=D1=80=D1=82=D0=B0 2017 =D0=B3., 23:24:09 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=
=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Vicente J. Botet Escriba =
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote=
" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding=
-left: 1ex;">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div>Le 06/03/2017 =C3=A0 16:24, Barry Revzin a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr"><br>
        <br>
        On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roman Orlov wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir=3D"ltr">
            <div>Hi there,</div>
            <div><br>
            </div>
            <div>Sometimes we need to iterate std::tuple instance and
              there is no standard solution for it.</div>
            <div>For myself I solved it like this</div>
            <div><br>
            </div>
            <div style=3D"background-color:rgb(250,250,250);border-color:rg=
b(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><c=
ode>
                <div><span style=3D"color:#008">template</span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> T</span><span style=3D"color:#660">,</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#008">typename</span><span st=
yle=3D"color:#000"> V</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> size_t</span><span style=3D"color:#660">...</span><span st=
yle=3D"color:#000"> I</span><span style=3D"color:#660">&gt;</span><span sty=
le=3D"color:#000"><br>
                  </span><span style=3D"color:#008">void</span><span style=
=3D"color:#000"> visit_impl</span><span style=3D"color:#660">(</span><span =
style=3D"color:#000">T</span><span style=3D"color:#660">&amp;&amp;</span><s=
pan style=3D"color:#000"> t</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000"> V</span><span style=3D"color:#660">&amp;&amp;</span><=
span style=3D"color:#000"> v</span><span style=3D"color:#660">,</span><span=
 style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span =
style=3D"color:#000">index_sequence</span><span style=3D"color:#660">&lt;</=
span><span style=3D"color:#000">I</span><span style=3D"color:#660">...&gt;)=
</span><span style=3D"color:#000"><br>
                  </span><span style=3D"color:#660">{</span><span style=3D"=
color:#000"><br>
                    =C2=A0 =C2=A0 </span><span style=3D"color:#660">(...,</=
span><span style=3D"color:#000"> v</span><span style=3D"color:#660">(</span=
><span style=3D"color:#000">std</span><span style=3D"color:#660">::</span><=
span style=3D"color:#008">get</span><span style=3D"color:#660">&lt;</span><=
span style=3D"color:#000">I</span><span style=3D"color:#660">&gt;(</span><s=
pan style=3D"color:#000">t</span><span style=3D"color:#660">)));</span><spa=
n style=3D"color:#000"><br>
                  </span><span style=3D"color:#660">}</span><span style=3D"=
color:#000"><br>
                    <br>
                    <br>
                  </span><span style=3D"color:#008">template</span><span st=
yle=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</span><sp=
an style=3D"color:#000"> T</span><span style=3D"color:#660">,</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#008">typename</span><span=
 style=3D"color:#000"> V</span><span style=3D"color:#660">&gt;</span><span =
style=3D"color:#000"><br>
                  </span><span style=3D"color:#008">void</span><span style=
=3D"color:#000"> visit</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">T</span><span style=3D"color:#660">&amp;&amp;</span><span s=
tyle=3D"color:#000"> t</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> V</span><span style=3D"color:#660">&amp;&amp;</span><span =
style=3D"color:#000"> v</span><span style=3D"color:#660">)</span><span styl=
e=3D"color:#000"><br>
                  </span><span style=3D"color:#660">{</span><span style=3D"=
color:#000"><br>
                    =C2=A0 =C2=A0 visit_impl</span><span style=3D"color:#66=
0">(</span><span style=3D"color:#000">std</span><span style=3D"color:#660">=
::</span><span style=3D"color:#000">forward</span><span style=3D"color:#660=
">&lt;</span><span style=3D"color:#000">T</span><span style=3D"color:#660">=
&gt;(</span><span style=3D"color:#000">t</span><span style=3D"color:#660">)=
,</span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::=
</span><span style=3D"color:#000">forward</span><span style=3D"color:#660">=
&lt;</span><span style=3D"color:#000">V</span><span style=3D"color:#660">&g=
t;(</span><span style=3D"color:#000">v</span><span style=3D"color:#660">),<=
/span><span style=3D"color:#000"> <br>
                    =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"co=
lor:#660">::</span><span style=3D"color:#000">make_index_sequence</span><sp=
an style=3D"color:#660">&lt;</span><span style=3D"color:#000">std</span><sp=
an style=3D"color:#660">::</span><span style=3D"color:#000"><wbr>tuple_size=
</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000"><br=
>
                    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span =
style=3D"color:#008">typename</span><span style=3D"color:#000"> std</span><=
span style=3D"color:#660">::</span><span style=3D"color:#000">decay</span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#000">T</span><sp=
an style=3D"color:#660">&gt;::</span><span style=3D"color:#000">type</span>=
<span style=3D"color:#660">&gt;::</span><span style=3D"color:#000">value</s=
pan><span style=3D"color:#660">&gt;()<wbr>);</span><span style=3D"color:#00=
0"><br>
                  </span><span style=3D"color:#660">}</span><span style=3D"=
color:#000"><br>
                    <br>
                    <br>
                  </span><span style=3D"color:#008">auto</span><span style=
=3D"color:#000"> t </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000">
                    std</span><span style=3D"color:#660">::</span><span sty=
le=3D"color:#000">make_tuple</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#066">100</span><span style=3D"color:#660">,</span><span st=
yle=3D"color:#000">
                  </span><span style=3D"color:#080">&quot;500&quot;</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000">
                  </span><span style=3D"color:#080">&#39;!&#39;</span><span=
 style=3D"color:#660">);</span><span style=3D"color:#000"><br>
                    visit</span><span style=3D"color:#660">(</span><span st=
yle=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:#008">auto</span><span style=3D"color:#660">&amp;</span><span style=
=3D"color:#000"> x</span><span style=3D"color:#660">)</span><span style=3D"=
color:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color=
:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"color:=
#000">cout
                  </span><span style=3D"color:#660">&lt;&lt;</span><span st=
yle=3D"color:#000"> x</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">});</span></div>
              </code></div>
            <div><br>
            </div>
            <div>So I suggest to add &#39;visit&#39; functions to the
              &lt;tuple&gt; library. Just like for std::varinat.</div>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div>What you want isn&#39;t really visiting, it&#39;s more of a lo=
op.
          There was a proposal for exactly that
          (<a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/20=
17/p0589r0.pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=
=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1=
%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0589r0.pdf\x26sa\x3dD\x26sntz\x3d1=
\x26usg\x3dAFQjCNHo_z56PfjswdyRXRfRdD1Z_UpJFw&#39;;return true;" onclick=3D=
"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.=
org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0589r0.pdf\x26sa\x3dD\x2=
6sntz\x3d1\x26usg\x3dAFQjCNHo_z56PfjswdyRXRfRdD1Z_UpJFw&#39;;return true;">=
http://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2017/<wbr>p0589r0.p=
df</a>)
          but the response was that this would be better handled through
          reflection tools. Since basically you want to loop over all
          the members of the tuple - so if we had a good mechanism for
          reflection, this just falls out of that.=C2=A0</div>
      </div>
    </blockquote>
    Well, reflection will give you the means but will not give you
    visitation, nor loop. We need these kind of proposal on top of
    reflection.<br>
    <br>
    In order to be able to do that for any product-type, as we are able
    to extract all the elements using structure binding, we need a
    common interface: to iterate, either to visit or either to access
    each one of the members directly (tuple-like access). All the
    interfaces are equivalent, that is, we can implement each function
    using the others. <br>
    <br>
    In
    <a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p032=
7r1.pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39=
;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22=
%2Fwg21%2Fdocs%2Fpapers%2F2016%2Fp0327r1.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg=
\x3dAFQjCNF4e9GrHLQXLFXnhzQZSI_bHGpUeQ&#39;;return true;" onclick=3D"this.h=
ref=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fj=
tc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2016%2Fp0327r1.pdf\x26sa\x3dD\x26sntz\x=
3d1\x26usg\x3dAFQjCNF4e9GrHLQXLFXnhzQZSI_bHGpUeQ&#39;;return true;">http://=
www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2016/<wbr>p0327r1.pdf</a>
    I propose a tuple-like access that takes in account the same types
    that support structure binding. Boost.Hana uses Sequence (iteration,
    fold and make) as basic functions.<br>
    <br>
    The question then is what is the complexity (performance) of all
    these operations when implemented using the others.<br>
    The tuple-like access (direct access and the size) is what the
    compiler knows already for a tuple-like type, as std::tuple, or a
    struct.<br>
    I believe that reflection should provide a tuple-like interface for
    those kind of types. Then you wan implement visit for all of them.<br>
    <br>
    I believe the function you are proposing is useful, as the
    implementation is simple. p0327r1 names it for_each.<br>
    <br>
    I like P0589, it makes it possible to do simple things simpler.
    People know better how to iterate.<br>
    However I prefer in general the functional approach. No raw loops.<br>
    <br>
    Vicente<br>
    =C2=A0<br>
  </div>

</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/889e8bcc-b370-429a-8228-685af733f79b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/889e8bcc-b370-429a-8228-685af733f79b=
%40isocpp.org</a>.<br />

------=_Part_110_323159884.1488971802001--

------=_Part_109_1502832698.1488971802000--

.


Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Wed, 8 Mar 2017 16:36:38 -0800 (PST)
Raw View
------=_Part_2475_1611414541.1489019798087
Content-Type: multipart/alternative;
 boundary="----=_Part_2476_65467196.1489019798088"

------=_Part_2476_65467196.1489019798088
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

It strikes me that what you're asking for is not tuple_visit, but rather=20
tuple_map (in the functional-programming sense): I have a tuple<A,B,C>, and=
=20
I have a functor X that signifies a mapping from A to D, from B to E, from=
=20
C to F; and I want to jam the two things together somehow to produce a=20
tuple<D,E,F>.  The case where D,E,F all happen to be "void" (or rather,=20
"std::monostate" =E2=80=94 paging Matt Calabrese! where's my regular void? =
;)) is=20
just a particularly boring special case of the general problem.
Alternatively/additionally, you could use tuple_foldl or tuple_foldr, which=
=20
would allow you to use void instead of monostate; but those would=20
unnecessarily imply an ordering (left-to-right or right-to-left) that you=
=20
might not care about in the general case where you just want to visit all=
=20
the members and don't really care in what *order* they're visited.

All of these (tuple_map, tuple_foldl, tuple_foldr) are available in Jared=
=20
Hoberock's <tuple_utility> header, and probably elsewhere too.
https://github.com/jaredhoberock/tuple_utility
Should they be standardized? IMHO, yes. But not with such a confusing name=
=20
as "std::visit".

=E2=80=93Arthur


On Wednesday, March 8, 2017 at 3:16:42 AM UTC-8, Roman Orlov wrote:
>
> I agree with you. I think there should be a choice to use raw loops or to=
=20
> use functional approach. Such functions can be implemented via raw loops=
=20
> (P0589). But if there are only raw loops we have to manually implement=20
> 'visit' functions to use them in higher-order functions. I'd like to have=
=20
> these functions in the standard library.
>
> =D0=BF=D0=BE=D0=BD=D0=B5=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA, 6 =D0=
=BC=D0=B0=D1=80=D1=82=D0=B0 2017 =D0=B3., 23:24:09 UTC+3 =D0=BF=D0=BE=D0=BB=
=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Vicente J. Botet=20
> Escriba =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>
>> Le 06/03/2017 =C3=A0 16:24, Barry Revzin a =C3=A9crit :
>>
>>
>>
>> On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roman Orlov wrote:=20
>>>
>>> Hi there,
>>>
>>> Sometimes we need to iterate std::tuple instance and there is no=20
>>> standard solution for it.
>>> For myself I solved it like this
>>>
>>> template<typename T, typename V, size_t... I>
>>> void visit_impl(T&& t, V&& v, std::index_sequence<I...>)
>>> {
>>>     (..., v(std::get<I>(t)));
>>> }
>>>
>>>
>>> template<typename T, typename V>
>>> void visit(T&& t, V&& v)
>>> {
>>>     visit_impl(std::forward<T>(t), std::forward<V>(v),=20
>>>         std::make_index_sequence<std::tuple_size<
>>>             typename std::decay<T>::type>::value>());
>>> }
>>>
>>>
>>> auto t =3D std::make_tuple(100, "500", '!');
>>> visit(t, [](auto& x) { std::cout << x; });
>>>
>>> So I suggest to add 'visit' functions to the <tuple> library. Just like=
=20
>>> for std::varinat.
>>>
>>
>> What you want isn't really visiting, it's more of a loop. There was a=20
>> proposal for exactly that (
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0589r0.pdf) but=
=20
>> the response was that this would be better handled through reflection=20
>> tools. Since basically you want to loop over all the members of the tupl=
e -=20
>> so if we had a good mechanism for reflection, this just falls out of tha=
t.=20
>>
>> Well, reflection will give you the means but will not give you=20
>> visitation, nor loop. We need these kind of proposal on top of reflectio=
n.
>>
>> In order to be able to do that for any product-type, as we are able to=
=20
>> extract all the elements using structure binding, we need a common=20
>> interface: to iterate, either to visit or either to access each one of t=
he=20
>> members directly (tuple-like access). All the interfaces are equivalent,=
=20
>> that is, we can implement each function using the others.=20
>>
>> In http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0327r1.pdf I=
=20
>> propose a tuple-like access that takes in account the same types that=20
>> support structure binding. Boost.Hana uses Sequence (iteration, fold and=
=20
>> make) as basic functions.
>>
>> The question then is what is the complexity (performance) of all these=
=20
>> operations when implemented using the others.
>> The tuple-like access (direct access and the size) is what the compiler=
=20
>> knows already for a tuple-like type, as std::tuple, or a struct.
>> I believe that reflection should provide a tuple-like interface for thos=
e=20
>> kind of types. Then you wan implement visit for all of them.
>>
>> I believe the function you are proposing is useful, as the implementatio=
n=20
>> is simple. p0327r1 names it for_each.
>>
>> I like P0589, it makes it possible to do simple things simpler. People=
=20
>> know better how to iterate.
>> However I prefer in general the functional approach. No raw loops.
>>
>> Vicente
>> =20
>>
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/3e485070-bd02-4daf-ad1a-c48ba5eddd14%40isocpp.or=
g.

------=_Part_2476_65467196.1489019798088
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It strikes me that what you&#39;re asking for is not tuple=
_visit, but rather tuple_map (in the functional-programming sense): I have =
a tuple&lt;A,B,C&gt;, and I have a functor X that signifies a mapping from =
A to D, from B to E, from C to F; and I want to jam the two things together=
 somehow to produce a tuple&lt;D,E,F&gt;. =C2=A0The case where D,E,F all ha=
ppen to be &quot;void&quot; (or rather, &quot;std::monostate&quot; =E2=80=
=94 paging Matt Calabrese! where&#39;s my regular void? ;)) is just a parti=
cularly boring special case of the general problem.<div>Alternatively/addit=
ionally, you could use tuple_foldl or tuple_foldr, which would allow you to=
 use <font face=3D"courier new, monospace">void</font> instead of <font fac=
e=3D"courier new, monospace">monostate</font>; but those would unnecessaril=
y imply an ordering (left-to-right or right-to-left) that you might not car=
e about in the general case where you just want to visit all the members an=
d don&#39;t really care in what <i>order</i> they&#39;re visited.</div><div=
><br></div><div>All of these (tuple_map, tuple_foldl, tuple_foldr) are avai=
lable in Jared Hoberock&#39;s &lt;tuple_utility&gt; header, and probably el=
sewhere too.</div><div><a href=3D"https://github.com/jaredhoberock/tuple_ut=
ility">https://github.com/jaredhoberock/tuple_utility</a><br></div><div>Sho=
uld they be standardized? IMHO, yes. But not with such a confusing name as =
&quot;std::visit&quot;.</div><div><br></div><div>=E2=80=93Arthur</div><div>=
<br></div><div><br>On Wednesday, March 8, 2017 at 3:16:42 AM UTC-8, Roman O=
rlov wrote:<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">I =
agree with you. I think there should be a choice to use raw loops or to use=
 functional approach. Such functions can be implemented via raw loops (P058=
9). But if there are only raw loops we have to manually implement &#39;visi=
t&#39; functions to use them in higher-order functions. I&#39;d like to hav=
e these functions in the standard library.<br><br>=D0=BF=D0=BE=D0=BD=D0=B5=
=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA, 6 =D0=BC=D0=B0=D1=80=D1=82=D0=
=B0 2017 =D0=B3., 23:24:09 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=
=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Vicente J. Botet Escriba =D0=BD=D0=B0=D0=BF=
=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" style=3D"margin:=
0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
 =20
   =20
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div>Le 06/03/2017 =C3=A0 16:24, Barry Revzin a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote type=3D"cite">
      <div dir=3D"ltr"><br>
        <br>
        On Monday, March 6, 2017 at 7:48:33 AM UTC-6, Roman Orlov wrote:
        <blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
          <div dir=3D"ltr">
            <div>Hi there,</div>
            <div><br>
            </div>
            <div>Sometimes we need to iterate std::tuple instance and
              there is no standard solution for it.</div>
            <div>For myself I solved it like this</div>
            <div><br>
            </div>
            <div style=3D"background-color:rgb(250,250,250);border-color:rg=
b(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><c=
ode>
                <div><span style=3D"color:#008">template</span><span style=
=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> T</span><span style=3D"color:#660">,</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#008">typename</span><span st=
yle=3D"color:#000"> V</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> size_t</span><span style=3D"color:#660">...</span><span st=
yle=3D"color:#000"> I</span><span style=3D"color:#660">&gt;</span><span sty=
le=3D"color:#000"><br>
                  </span><span style=3D"color:#008">void</span><span style=
=3D"color:#000"> visit_impl</span><span style=3D"color:#660">(</span><span =
style=3D"color:#000">T</span><span style=3D"color:#660">&amp;&amp;</span><s=
pan style=3D"color:#000"> t</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000"> V</span><span style=3D"color:#660">&amp;&amp;</span><=
span style=3D"color:#000"> v</span><span style=3D"color:#660">,</span><span=
 style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span =
style=3D"color:#000">index_sequence</span><span style=3D"color:#660">&lt;</=
span><span style=3D"color:#000">I</span><span style=3D"color:#660">...&gt;)=
</span><span style=3D"color:#000"><br>
                  </span><span style=3D"color:#660">{</span><span style=3D"=
color:#000"><br>
                    =C2=A0 =C2=A0 </span><span style=3D"color:#660">(...,</=
span><span style=3D"color:#000"> v</span><span style=3D"color:#660">(</span=
><span style=3D"color:#000">std</span><span style=3D"color:#660">::</span><=
span style=3D"color:#008">get</span><span style=3D"color:#660">&lt;</span><=
span style=3D"color:#000">I</span><span style=3D"color:#660">&gt;(</span><s=
pan style=3D"color:#000">t</span><span style=3D"color:#660">)));</span><spa=
n style=3D"color:#000"><br>
                  </span><span style=3D"color:#660">}</span><span style=3D"=
color:#000"><br>
                    <br>
                    <br>
                  </span><span style=3D"color:#008">template</span><span st=
yle=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</span><sp=
an style=3D"color:#000"> T</span><span style=3D"color:#660">,</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#008">typename</span><span=
 style=3D"color:#000"> V</span><span style=3D"color:#660">&gt;</span><span =
style=3D"color:#000"><br>
                  </span><span style=3D"color:#008">void</span><span style=
=3D"color:#000"> visit</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">T</span><span style=3D"color:#660">&amp;&amp;</span><span s=
tyle=3D"color:#000"> t</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> V</span><span style=3D"color:#660">&amp;&amp;</span><span =
style=3D"color:#000"> v</span><span style=3D"color:#660">)</span><span styl=
e=3D"color:#000"><br>
                  </span><span style=3D"color:#660">{</span><span style=3D"=
color:#000"><br>
                    =C2=A0 =C2=A0 visit_impl</span><span style=3D"color:#66=
0">(</span><span style=3D"color:#000">std</span><span style=3D"color:#660">=
::</span><span style=3D"color:#000">forward</span><span style=3D"color:#660=
">&lt;</span><span style=3D"color:#000">T</span><span style=3D"color:#660">=
&gt;(</span><span style=3D"color:#000">t</span><span style=3D"color:#660">)=
,</span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::=
</span><span style=3D"color:#000">forward</span><span style=3D"color:#660">=
&lt;</span><span style=3D"color:#000">V</span><span style=3D"color:#660">&g=
t;(</span><span style=3D"color:#000">v</span><span style=3D"color:#660">),<=
/span><span style=3D"color:#000"> <br>
                    =C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"co=
lor:#660">::</span><span style=3D"color:#000">make_index_sequence</span><sp=
an style=3D"color:#660">&lt;</span><span style=3D"color:#000">std</span><sp=
an style=3D"color:#660">::</span><span style=3D"color:#000"><wbr>tuple_size=
</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#000"><br=
>
                    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span =
style=3D"color:#008">typename</span><span style=3D"color:#000"> std</span><=
span style=3D"color:#660">::</span><span style=3D"color:#000">decay</span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#000">T</span><sp=
an style=3D"color:#660">&gt;::</span><span style=3D"color:#000">type</span>=
<span style=3D"color:#660">&gt;::</span><span style=3D"color:#000">value</s=
pan><span style=3D"color:#660">&gt;()<wbr>);</span><span style=3D"color:#00=
0"><br>
                  </span><span style=3D"color:#660">}</span><span style=3D"=
color:#000"><br>
                    <br>
                    <br>
                  </span><span style=3D"color:#008">auto</span><span style=
=3D"color:#000"> t </span><span style=3D"color:#660">=3D</span><span style=
=3D"color:#000">
                    std</span><span style=3D"color:#660">::</span><span sty=
le=3D"color:#000">make_tuple</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#066">100</span><span style=3D"color:#660">,</span><span st=
yle=3D"color:#000">
                  </span><span style=3D"color:#080">&quot;500&quot;</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000">
                  </span><span style=3D"color:#080">&#39;!&#39;</span><span=
 style=3D"color:#660">);</span><span style=3D"color:#000"><br>
                    visit</span><span style=3D"color:#660">(</span><span st=
yle=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:#008">auto</span><span style=3D"color:#660">&amp;</span><span style=
=3D"color:#000"> x</span><span style=3D"color:#660">)</span><span style=3D"=
color:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color=
:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"color:=
#000">cout
                  </span><span style=3D"color:#660">&lt;&lt;</span><span st=
yle=3D"color:#000"> x</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">});</span></div>
              </code></div>
            <div><br>
            </div>
            <div>So I suggest to add &#39;visit&#39; functions to the
              &lt;tuple&gt; library. Just like for std::varinat.</div>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div>What you want isn&#39;t really visiting, it&#39;s more of a lo=
op.
          There was a proposal for exactly that
          (<a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/20=
17/p0589r0.pdf" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=
=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1=
%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0589r0.pdf\x26sa\x3dD\x26sntz\x3d1=
\x26usg\x3dAFQjCNHo_z56PfjswdyRXRfRdD1Z_UpJFw&#39;;return true;" onclick=3D=
"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.=
org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0589r0.pdf\x26sa\x3dD\x2=
6sntz\x3d1\x26usg\x3dAFQjCNHo_z56PfjswdyRXRfRdD1Z_UpJFw&#39;;return true;">=
http://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2017/<wbr>p0589r0.p=
df</a>)
          but the response was that this would be better handled through
          reflection tools. Since basically you want to loop over all
          the members of the tuple - so if we had a good mechanism for
          reflection, this just falls out of that.=C2=A0</div>
      </div>
    </blockquote>
    Well, reflection will give you the means but will not give you
    visitation, nor loop. We need these kind of proposal on top of
    reflection.<br>
    <br>
    In order to be able to do that for any product-type, as we are able
    to extract all the elements using structure binding, we need a
    common interface: to iterate, either to visit or either to access
    each one of the members directly (tuple-like access). All the
    interfaces are equivalent, that is, we can implement each function
    using the others. <br>
    <br>
    In
    <a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p032=
7r1.pdf" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#39=
;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22=
%2Fwg21%2Fdocs%2Fpapers%2F2016%2Fp0327r1.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg=
\x3dAFQjCNF4e9GrHLQXLFXnhzQZSI_bHGpUeQ&#39;;return true;" onclick=3D"this.h=
ref=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fj=
tc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2016%2Fp0327r1.pdf\x26sa\x3dD\x26sntz\x=
3d1\x26usg\x3dAFQjCNF4e9GrHLQXLFXnhzQZSI_bHGpUeQ&#39;;return true;">http://=
www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2016/<wbr>p0327r1.pdf</a>
    I propose a tuple-like access that takes in account the same types
    that support structure binding. Boost.Hana uses Sequence (iteration,
    fold and make) as basic functions.<br>
    <br>
    The question then is what is the complexity (performance) of all
    these operations when implemented using the others.<br>
    The tuple-like access (direct access and the size) is what the
    compiler knows already for a tuple-like type, as std::tuple, or a
    struct.<br>
    I believe that reflection should provide a tuple-like interface for
    those kind of types. Then you wan implement visit for all of them.<br>
    <br>
    I believe the function you are proposing is useful, as the
    implementation is simple. p0327r1 names it for_each.<br>
    <br>
    I like P0589, it makes it possible to do simple things simpler.
    People know better how to iterate.<br>
    However I prefer in general the functional approach. No raw loops.<br>
    <br>
    Vicente<br>
    =C2=A0<br>
  </div>

</blockquote></div></blockquote></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3e485070-bd02-4daf-ad1a-c48ba5eddd14%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3e485070-bd02-4daf-ad1a-c48ba5eddd14=
%40isocpp.org</a>.<br />

------=_Part_2476_65467196.1489019798088--

------=_Part_2475_1611414541.1489019798087--

.


Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Thu, 9 Mar 2017 11:27:08 -0500
Raw View
On 2017-03-06 10:24, Barry Revzin wrote:
> What you want isn't really visiting, it's more of a loop. There was a
> proposal for exactly that
> (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0589r0.pdf) but
> the response was that this would be better handled through reflection
> tools.

That's not exactly how I remember it. Note:

  Do we want a facility like this? SF 20 | F 6 | N 1 | A 0 | SA 0

The biggest objection, based on the wiki notes, seems to be that "it's
not a loop", and also folks concerned that if you exit the loop from an
early instantiation, the remaining instantiations still need to be well
formed. There were also various mutterings about the syntax (e.g. should
we write `static for` or `constexpr for` or some such instead of just
`for`).

That said, IIRC the consensus was to send it to SG7 to bake for a while...

On 2017-03-06 15:54, Nicol Bolas wrote:
> It seems to me that the generalized tuple unpacking proposal
> <http://wg21.link/P0535> makes this all obsolete:
>
> auto t = std::make_tuple(100, "500", '!');
> [](auto& x) { std::cout << x; }([:]t)...;

This is probably true for the OP's proposal. Less so for P0589; it
doesn't allow for the flow control that P0589 can provide.

--
Matthew

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/58C1825C.20705%40gmail.com.

.