Topic: Proposal Ternary Right Fold Expression


Author: f.zingsheim@gmx.de
Date: Sat, 20 Jan 2018 03:20:55 -0800 (PST)
Raw View
------=_Part_1832_716281460.1516447255251
Content-Type: multipart/alternative;
 boundary="----=_Part_1833_350450749.1516447255251"

------=_Part_1833_350450749.1516447255251
Content-Type: text/plain; charset="UTF-8"

C++17 offers fold expressions for binary operators.

I want to make a proposal to add a right fold expression for the ternary
operator ?:

( C ? E : ... : I )

should expand to ( C(1) ? E(1) : ( ... ( C(N-1) ? E(N-1) : ( C(N) ? E(N) :
I ) ) ) )


and


( C ? E : ... )
should expand to

( C(1) ? E(1) : ( ... ( C(N-2) ? E(N-2) : ( C(N-1) ? E(N-1) : E(N) ) ) )


The full proposal with motivating examples can be found on
https://github.com/zingsheim/ProposalTernaryFold/blob/master/ProposalTernaryFold.md

Note: A initial idea of this proposal has already been publish on reddit
<https://www.reddit.com/r/cpp/comments/7qcgne/rfc_proposal_ternary_fold_expression/>
..

Comments on this initial version of the proposal are welcome.

--
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/95b46782-075f-4e96-8c1f-6b4757a4d049%40isocpp.org.

------=_Part_1833_350450749.1516447255251
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">C++17 offers fold expressions for binary operators.<br><br=
>I want to make a proposal to add a right fold expression for the ternary o=
perator <span style=3D"font-family: courier new, monospace;">?:<br></span><=
br><span style=3D"font-family: courier new, monospace;">
<style type=3D"text/css">
p, li { white-space: pre-wrap; }
</style>
</span><p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; mar=
gin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=3D"font-fa=
mily: courier new, monospace;">( C ? E : ... : I )</span></p><p style=3D" m=
argin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-bl=
ock-indent:0; text-indent:0px;"><span style=3D"font-family: arial, sans-ser=
if;">should expand to
</span><style type=3D"text/css"><span style=3D"font-family: arial, sans-ser=
if;">
p, li { white-space: pre-wra</span></style><span style=3D"font-family: cour=
ier new, monospace;">( C(1) ? E(1) : ( ... ( C(N-1) ? E(N-1) : ( C(N) ? E(N=
) : I ) ) ) )</span></p><p style=3D" margin-top:0px; margin-bottom:0px; mar=
gin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span=
 style=3D"font-family: arial, sans-serif;"><br></span></p><p style=3D" marg=
in-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block=
-indent:0; text-indent:0px;"><span style=3D"font-family: arial, sans-serif;=
">and</span></p><p style=3D" margin-top:0px; margin-bottom:0px; margin-left=
:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=
=3D"font-family: arial, sans-serif;"><br></span></p><span style=3D"font-fam=
ily: courier new, monospace;">( C ? E : ... )<br><span style=3D"font-family=
: arial, sans-serif;">should expand to</span></span><span style=3D"font-fam=
ily: arial, sans-serif;"><br>
</span><style type=3D"text/css"><span style=3D"font-family: arial, sans-ser=
if;">
p, li { white-space: pre-wrap; }
</span></style><span style=3D"font-family: arial, sans-serif;">
</span><p style=3D" margin-top:0px; margin-bottom:0px; margin-left:0px; mar=
gin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=3D"font-fa=
mily: courier new, monospace;">( C(1) ? E(1) : ( ... ( C(N-2) ? E(N-2) : ( =
C(N-1) ? E(N-1) : E(N) ) ) )</span></p><p style=3D" margin-top:0px; margin-=
bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-ind=
ent:0px;"><br></p><p style=3D" margin-top:0px; margin-bottom:0px; margin-le=
ft:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The full pr=
oposal with motivating examples can be found on<br></p><span style=3D"font-=
family: courier new, monospace;"></span><a href=3D"https://github.com/zings=
heim/ProposalTernaryFold/blob/master/ProposalTernaryFold.md">https://github=
..com/zingsheim/ProposalTernaryFold/blob/master/ProposalTernaryFold.md</a><b=
r><br>Note: A initial idea of this proposal has already been publish on <a =
href=3D"https://www.reddit.com/r/cpp/comments/7qcgne/rfc_proposal_ternary_f=
old_expression/">reddit</a>.<br><br>Comments on this initial version of the=
 proposal are welcome.<br><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/95b46782-075f-4e96-8c1f-6b4757a4d049%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/95b46782-075f-4e96-8c1f-6b4757a4d049=
%40isocpp.org</a>.<br />

------=_Part_1833_350450749.1516447255251--

------=_Part_1832_716281460.1516447255251--

.


Author: mihailnajdenov@gmail.com
Date: Sat, 20 Jan 2018 04:52:29 -0800 (PST)
Raw View
------=_Part_1931_1221662662.1516452749365
Content-Type: multipart/alternative;
 boundary="----=_Part_1932_118934508.1516452749365"

------=_Part_1932_118934508.1516452749365
Content-Type: text/plain; charset="UTF-8"

Are there any uses besides search in a parameter pack?

Because I believe there should be a cleaner way to represent that.

I believe something like this was proposed

for...(const auto i : js)
{
 if(i == j)
   return f<i>();
}

You can test if j is out of bounds even today if(j >= sizeof...(js)) throw


There is no established practice of ternary operator to do search among
values, hence using it that way is no less confusing then recursion.

I don't say I am against the proposal! Just that one example should be
handled better.


--
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/67153695-17bb-4c77-805b-4e36efc5ace6%40isocpp.org.

------=_Part_1932_118934508.1516452749365
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Are there any uses besides search in a parameter pack=
?</div><div><br></div><div> Because I believe there should be a cleaner way=
 to represent that.=C2=A0</div><div><br></div><div>I believe something like=
 this was proposed</div><div><br></div><div><font face=3D"courier new,monos=
pace">for...(const auto i :  js) </font><font face=3D"courier new">=C2=A0</=
font></div><div><font face=3D"courier new">{</font></div><div><font face=3D=
"courier new">=C2=A0if(i =3D=3D j)</font></div><div><font face=3D"courier n=
ew">=C2=A0=C2=A0 return f&lt;i&gt;();</font></div><div><font face=3D"courie=
r new">}</font></div><div><font face=3D"courier new"><br></font></div><div>=
<font face=3D"arial,sans-serif">You can test if <font face=3D"courier new,m=
onospace">j</font> is out of bounds even today </font><font face=3D"courier=
 new,monospace">if(j &gt;=3D sizeof...(js)) throw</font></div><div><font fa=
ce=3D"courier new"><br></font></div><div><font face=3D"courier new"><br></f=
ont></div><div><font face=3D"arial,sans-serif">There is no established prac=
tice of ternary operator to do search among values, hence using it that way=
 is no less confusing then recursion.=C2=A0</font></div><div><br></div><div=
><span style=3D"display: inline !important; float: none; background-color: =
transparent; color: rgb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;H=
elvetica&quot;,sans-serif; font-size: 13px; font-style: normal; font-varian=
t: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align=
: left; text-decoration: none; text-indent: 0px; text-transform: none; -web=
kit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">I don&=
#39;t say I am against the proposal! Just that one example should be handle=
d better.</span></div><div><font face=3D"arial,sans-serif"><b><br></b></fon=
t></div><div><font face=3D"courier new"><br></font></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/67153695-17bb-4c77-805b-4e36efc5ace6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/67153695-17bb-4c77-805b-4e36efc5ace6=
%40isocpp.org</a>.<br />

------=_Part_1932_118934508.1516452749365--

------=_Part_1931_1221662662.1516452749365--

.


Author: mihailnajdenov@gmail.com
Date: Sat, 20 Jan 2018 06:53:41 -0800 (PST)
Raw View
------=_Part_1825_1695302955.1516460021843
Content-Type: multipart/alternative;
 boundary="----=_Part_1826_91203788.1516460021844"

------=_Part_1826_91203788.1516460021844
Content-Type: text/plain; charset="UTF-8"

Because we are speculating

template <std::size_t... js>
auto test_impl(std::size_t j, std::index_sequence<js...>)
{
   switch(j)
   {
      case js: { return f<js>; break; } ... *//< expand to switch blocks*
      default: break;
   }
}

Or without the need of index_sequence

template <std::size_t n>
auto test(std::size_t j)
{
  constexpr for(auto i; i < n; ++i )  *//< both i and n are constexpr*
  {
    if(i == j)
      return f<i>();
  }
}

The latter will be equivalent of:


template <std::size_t n>
auto test(std::size_t j)
{
  {
     constexpr int i = 0;

     if(i == j)
       return f<i>();
  }

   ......

  {
     constexpr int i = n-1;

     if(i == j)
       return f<i>();
  }
}

OR also equivalent  to a switch statement - depending on how smart the
compiler is and what type of code there is in the for block





On Saturday, January 20, 2018 at 1:20:55 PM UTC+2, f.zin...@gmx.de wrote:

> C++17 offers fold expressions for binary operators.
>
> I want to make a proposal to add a right fold expression for the ternary
> operator ?:
>
> ( C ? E : ... : I )
>
> should expand to ( C(1) ? E(1) : ( ... ( C(N-1) ? E(N-1) : ( C(N) ? E(N)
> : I ) ) ) )
>
>
> and
>
>
> ( C ? E : ... )
> should expand to
>
> ( C(1) ? E(1) : ( ... ( C(N-2) ? E(N-2) : ( C(N-1) ? E(N-1) : E(N) ) ) )
>
>
> The full proposal with motivating examples can be found on
>
> https://github.com/zingsheim/ProposalTernaryFold/blob/master/ProposalTernaryFold.md
>
> Note: A initial idea of this proposal has already been publish on reddit
> <https://www.reddit.com/r/cpp/comments/7qcgne/rfc_proposal_ternary_fold_expression/>
> .
>
> Comments on this initial version of the proposal are welcome.
>
>

--
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/f75cbe71-9f5c-43fe-898e-06318e301b6f%40isocpp.org.

------=_Part_1826_91203788.1516460021844
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><font face=3D"arial,sans-serif">Because we are specul=
ating</font></div><div><font face=3D"arial,sans-serif"><br></font></div><di=
v><font face=3D"courier new,monospace">template &lt;std::size_t... js&gt;</=
font><br><font face=3D"courier new,monospace">auto test_impl(std::size_t j,=
 std::index_sequence&lt;js...&gt;)<br>{<br>=C2=A0=C2=A0 switch(j)<br>=C2=A0=
=C2=A0 {<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 case js: { return f&lt;js&gt;; b=
reak; } ... <i>//&lt; expand to switch blocks</i></font></div><div><font fa=
ce=3D"courier new,monospace">=C2=A0 =C2=A0 =C2=A0 default: break;<br>=C2=A0=
=C2=A0 }<br>}</font></div><div><font face=3D"courier new"><br></font></div>=
<div><font face=3D"arial,sans-serif">Or without the need of</font><font fac=
e=3D"courier new,monospace">=C2=A0<span style=3D"text-align: left; color: r=
gb(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: nor=
mal; font-size: 13px; font-style: normal; font-variant: normal; font-weight=
: 400; text-decoration: none; word-spacing: 0px; display: inline !important=
; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: =
0px; background-color: transparent;">index_sequence</span></font></div><div=
><font face=3D"courier new,monospace"><span style=3D"display: inline !impor=
tant; float: none; background-color: transparent; color: rgb(34, 34, 34); f=
ont-family: courier new,monospace; font-size: 13px; font-style: normal; fon=
t-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; te=
xt-align: left; text-decoration: none; text-indent: 0px; text-transform: no=
ne; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;=
"><br></span></font></div><div><font face=3D"courier new"><span style=3D"di=
splay: inline !important; float: none; background-color: transparent; color=
: rgb(34, 34, 34); font-family: courier new,monospace; font-size: 13px; fon=
t-style: normal; font-variant: normal; font-weight: 400; letter-spacing: no=
rmal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px=
; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal=
; word-spacing: 0px;">template &lt;std::size_t n&gt;<br>auto test(std::size=
_t j)<br>{<br></span></font></div><font face=3D"courier new"><span style=3D=
"display: inline !important; float: none; background-color: transparent; co=
lor: rgb(34, 34, 34); font-family: courier new,monospace; font-size: 13px; =
font-style: normal; font-variant: normal; font-weight: 400; letter-spacing:=
 normal; orphans: 2; text-align: left; text-decoration: none; text-indent: =
0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: nor=
mal; word-spacing: 0px;"><div style=3D"background-color: transparent; borde=
r-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-w=
idth: 0px; border-image-outset: 0; border-image-repeat: stretch; border-ima=
ge-slice: 100%; border-image-source: none; border-image-width: 1; border-le=
ft-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px;=
 border-right-color: rgb(34, 34, 34); border-right-style: none; border-righ=
t-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; bo=
rder-top-width: 0px; color: rgb(34, 34, 34); font-family: &amp;quot;Arial&a=
mp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px; font-st=
yle: normal; font-variant: normal; font-weight: 400; letter-spacing: normal=
; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;=
 orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; pa=
dding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; =
text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; =
word-spacing: 0px;"><font face=3D"courier new,monospace" style=3D"border-bo=
ttom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width=
: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-s=
lice: 100%; border-image-source: none; border-image-width: 1; border-left-c=
olor: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; bor=
der-right-color: rgb(34, 34, 34); border-right-style: none; border-right-wi=
dth: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border=
-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; m=
argin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px;=
 padding-top: 0px;">=C2=A0 constexpr for(auto i; i &lt; n; ++i )=C2=A0</fon=
t><font face=3D"courier new" style=3D"border-bottom-color: rgb(34, 34, 34);=
 border-bottom-style: none; border-bottom-width: 0px; border-image-outset: =
0; border-image-repeat: stretch; border-image-slice: 100%; border-image-sou=
rce: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); borde=
r-left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34,=
 34); border-right-style: none; border-right-width: 0px; border-top-color: =
rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; margin-bott=
om: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bott=
om: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <i>//&l=
t; both i and n are constexpr</i></font></div><div style=3D"background-colo=
r: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: =
none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat=
: stretch; border-image-slice: 100%; border-image-source: none; border-imag=
e-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; bo=
rder-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-sty=
le: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); borde=
r-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); font-fami=
ly: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; fon=
t-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; l=
etter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: =
0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; p=
adding-right: 0px; padding-top: 0px; text-align: left; text-decoration: non=
e; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; =
white-space: normal; word-spacing: 0px;"><font face=3D"courier new" style=
=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border=
-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; b=
order-image-slice: 100%; border-image-source: none; border-image-width: 1; =
border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-wi=
dth: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; bo=
rder-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style:=
 none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-=
right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; paddin=
g-right: 0px; padding-top: 0px;">=C2=A0 {</font></div><div style=3D"backgro=
und-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom=
-style: none; border-bottom-width: 0px; border-image-outset: 0; border-imag=
e-repeat: stretch; border-image-slice: 100%; border-image-source: none; bor=
der-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: =
none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-r=
ight-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34=
); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); f=
ont-family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-se=
rif; font-size: 13px; font-style: normal; font-variant: normal; font-weight=
: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin=
-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left=
: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decorat=
ion: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-widt=
h: 0px; white-space: normal; word-spacing: 0px;"><font face=3D"courier new"=
 style=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; =
border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stre=
tch; border-image-slice: 100%; border-image-source: none; border-image-widt=
h: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-l=
eft-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: no=
ne; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-=
style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; m=
argin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; =
padding-right: 0px; padding-top: 0px;">=C2=A0 =C2=A0 if(i =3D=3D j)</font><=
/div><div style=3D"background-color: transparent; border-bottom-color: rgb(=
34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-im=
age-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; bord=
er-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34=
, 34); border-left-style: none; border-left-width: 0px; border-right-color:=
 rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border=
-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px;=
 color: rgb(34, 34, 34); font-family: &amp;quot;Arial&amp;quot;,&amp;quot;H=
elvetica&amp;quot;,sans-serif; font-size: 13px; font-style: normal; font-va=
riant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px=
; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding=
-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text=
-align: left; text-decoration: none; text-indent: 0px; text-transform: none=
; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">=
<font face=3D"courier new" style=3D"border-bottom-color: rgb(34, 34, 34); b=
order-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0;=
 border-image-repeat: stretch; border-image-slice: 100%; border-image-sourc=
e: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-=
left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 3=
4); border-right-style: none; border-right-width: 0px; border-top-color: rg=
b(34, 34, 34); border-top-style: none; border-top-width: 0px; margin-bottom=
: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom=
: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">=C2=A0 =C2=
=A0 =C2=A0 return f&lt;i&gt;();=C2=A0</font></div><div style=3D"background-=
color: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-sty=
le: none; border-bottom-width: 0px; border-image-outset: 0; border-image-re=
peat: stretch; border-image-slice: 100%; border-image-source: none; border-=
image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none=
; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right=
-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); b=
order-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); font-=
family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif;=
 font-size: 13px; font-style: normal; font-variant: normal; font-weight: 40=
0; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-rig=
ht: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0p=
x; padding-right: 0px; padding-top: 0px; text-align: left; text-decoration:=
 none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0=
px; white-space: normal; word-spacing: 0px;"><font face=3D"courier new" sty=
le=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; bord=
er-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch;=
 border-image-slice: 100%; border-image-source: none; border-image-width: 1=
; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-=
width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; =
border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-styl=
e: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margi=
n-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padd=
ing-right: 0px; padding-top: 0px;">=C2=A0 }</font><br></div></span></font><=
div><font face=3D"courier new"><span style=3D"display: inline !important; f=
loat: none; background-color: transparent; color: rgb(34, 34, 34); font-fam=
ily: courier new,monospace; font-size: 13px; font-style: normal; font-varia=
nt: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-alig=
n: left; text-decoration: none; text-indent: 0px; text-transform: none; -we=
bkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">}</sp=
an></font></div><div><font face=3D"courier new"><span style=3D"display: inl=
ine !important; float: none; background-color: transparent; color: rgb(34, =
34, 34); font-family: courier new,monospace; font-size: 13px; font-style: n=
ormal; font-variant: normal; font-weight: 400; letter-spacing: normal; orph=
ans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-tra=
nsform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spa=
cing: 0px;"><br></span></font></div><div><span style=3D"text-align: left; c=
olor: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-spaci=
ng: normal; font-size: 13px; font-style: normal; font-variant: normal; font=
-weight: 400; text-decoration: none; word-spacing: 0px; display: inline !im=
portant; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-=
width: 0px; background-color: transparent;"><font face=3D"arial,sans-serif"=
>The latter will be equivalent of:=C2=A0</font></span></div><div><span styl=
e=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; text-i=
ndent: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; fo=
nt-variant: normal; font-weight: 400; text-decoration: none; word-spacing: =
0px; display: inline !important; white-space: normal; orphans: 2; float: no=
ne; -webkit-text-stroke-width: 0px; background-color: transparent;"><br></s=
pan></div><div><span style=3D"text-align: left; color: rgb(34, 34, 34); tex=
t-transform: none; text-indent: 0px; letter-spacing: normal; font-size: 13p=
x; font-style: normal; font-variant: normal; font-weight: 400; text-decorat=
ion: none; word-spacing: 0px; display: inline !important; white-space: norm=
al; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-col=
or: transparent;"><br></span></div><div><span style=3D"text-align: left; co=
lor: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacin=
g: normal; font-size: 13px; font-variant: normal; word-spacing: 0px; displa=
y: inline !important; white-space: normal; orphans: 2; float: none; -webkit=
-text-stroke-width: 0px; background-color: transparent;"><font face=3D"cour=
ier new,monospace"><span style=3D"text-align: left; color: rgb(34, 34, 34);=
 text-transform: none; text-indent: 0px; letter-spacing: normal; font-size:=
 13px; font-style: normal; font-variant: normal; font-weight: 400; text-dec=
oration: none; word-spacing: 0px; display: inline !important; white-space: =
normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background=
-color: transparent;">template &lt;std::size_t n&gt;</span><br style=3D"mar=
gin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-image: none; te=
xt-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent: =
0px; letter-spacing: normal; font-size: 13px; font-style: normal; font-vari=
ant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; wh=
ite-space: normal; orphans: 2; -webkit-text-stroke-width: 0px; background-c=
olor: transparent;"><span style=3D"text-align: left; color: rgb(34, 34, 34)=
; text-transform: none; text-indent: 0px; letter-spacing: normal; font-size=
: 13px; font-style: normal; font-variant: normal; font-weight: 400; text-de=
coration: none; word-spacing: 0px; display: inline !important; white-space:=
 normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; backgroun=
d-color: transparent;">auto test(std::size_t j)</span><br style=3D"margin: =
0px; padding: 0px; border: 0px rgb(34, 34, 34); border-image: none; text-al=
ign: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; =
letter-spacing: normal; font-size: 13px; font-style: normal; font-variant: =
normal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-s=
pace: normal; orphans: 2; -webkit-text-stroke-width: 0px; background-color:=
 transparent;"></font><span style=3D"text-align: left; color: rgb(34, 34, 3=
4); text-transform: none; text-indent: 0px; letter-spacing: normal; font-si=
ze: 13px; font-style: normal; font-variant: normal; font-weight: 400; text-=
decoration: none; word-spacing: 0px; display: inline !important; white-spac=
e: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; backgro=
und-color: transparent;"><font face=3D"courier new,monospace">{</font></spa=
n></span></div><div><span style=3D"text-align: left; color: rgb(34, 34, 34)=
; text-transform: none; text-indent: 0px; letter-spacing: normal; font-size=
: 13px; font-variant: normal; word-spacing: 0px; display: inline !important=
; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: =
0px; background-color: transparent;"><span style=3D"text-align: left; color=
: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: =
normal; font-size: 13px; font-style: normal; font-variant: normal; font-wei=
ght: 400; text-decoration: none; word-spacing: 0px; display: inline !import=
ant; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-widt=
h: 0px; background-color: transparent;"><font face=3D"courier new">=C2=A0 {=
</font></span></span></div><div><span style=3D"text-align: left; color: rgb=
(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: norma=
l; font-size: 13px; font-variant: normal; word-spacing: 0px; display: inlin=
e !important; white-space: normal; orphans: 2; float: none; -webkit-text-st=
roke-width: 0px; background-color: transparent;"><span style=3D"text-align:=
 left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; lett=
er-spacing: normal; font-size: 13px; font-variant: normal; word-spacing: 0p=
x; display: inline !important; white-space: normal; orphans: 2; float: none=
; -webkit-text-stroke-width: 0px; background-color: transparent;"><font fac=
e=3D"courier new"><span style=3D"display: inline !important; float: none; b=
ackground-color: transparent; color: rgb(34, 34, 34); font-family: courier =
new,monospace; font-size: 13px; font-style: normal; font-variant: normal; f=
ont-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text=
-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-str=
oke-width: 0px; white-space: normal; word-spacing: 0px;">=C2=A0 =C2=A0=C2=
=A0 constexpr </span><span style=3D"background-color: transparent; border-b=
ottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-widt=
h: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-=
slice: 100%; border-image-source: none; border-image-width: 1; border-left-=
color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; bo=
rder-right-color: rgb(34, 34, 34); border-right-style: none; border-right-w=
idth: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; borde=
r-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: none; fon=
t-family: courier new,monospace; font-size: 13px; font-style: normal; font-=
variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0=
px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; paddi=
ng-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; te=
xt-align: left; text-decoration: none; text-indent: 0px; text-transform: no=
ne; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;=
">int i =3D 0; </span></font></span></span></div><div><span style=3D"text-a=
lign: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px;=
 letter-spacing: normal; font-size: 13px; font-variant: normal; word-spacin=
g: 0px; display: inline !important; white-space: normal; orphans: 2; float:=
 none; -webkit-text-stroke-width: 0px; background-color: transparent;"><spa=
n style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; =
text-indent: 0px; letter-spacing: normal; font-size: 13px; font-variant: no=
rmal; word-spacing: 0px; display: inline !important; white-space: normal; o=
rphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color: t=
ransparent;"><font face=3D"courier new"><span style=3D"background-color: tr=
ansparent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none;=
 border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: str=
etch; border-image-slice: 100%; border-image-source: none; border-image-wid=
th: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-=
left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: n=
one; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top=
-style: none; border-top-width: 0px; color: rgb(34, 34, 34); display: inlin=
e; float: none; font-family: courier new,monospace; font-size: 13px; font-s=
tyle: normal; font-variant: normal; font-weight: 400; letter-spacing: norma=
l; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px=
; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; p=
adding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px;=
 text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal;=
 word-spacing: 0px;">=C2=A0 =C2=A0 =C2=A0</span></font></span></span></div>=
<div><font face=3D"courier new,monospace">=C2=A0 =C2=A0=C2=A0 <span style=
=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; text-in=
dent: 0px; letter-spacing: normal; font-size: 13px; font-variant: normal; w=
ord-spacing: 0px; display: inline !important; white-space: normal; orphans:=
 2; float: none; -webkit-text-stroke-width: 0px; background-color: transpar=
ent;"><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34)=
; border-image: none; text-align: left; color: rgb(34, 34, 34); text-transf=
orm: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; text-decoration: non=
e; word-spacing: 0px; display: inline; white-space: normal; orphans: 2; flo=
at: none; -webkit-text-stroke-width: 0px; background-color: transparent;">i=
f(i =3D=3D j)</span><br style=3D"margin: 0px; padding: 0px; border: 0px rgb=
(34, 34, 34); border-image: none; text-align: left; color: rgb(34, 34, 34);=
 text-transform: none; text-indent: 0px; letter-spacing: normal; font-size:=
 13px; font-style: normal; font-variant: normal; font-weight: 400; text-dec=
oration: none; word-spacing: 0px; white-space: normal; orphans: 2; -webkit-=
text-stroke-width: 0px; background-color: transparent;"><span style=3D"marg=
in: 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-image: none; tex=
t-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0=
px; letter-spacing: normal; font-size: 13px; font-style: normal; font-varia=
nt: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; dis=
play: inline; white-space: normal; orphans: 2; float: none; -webkit-text-st=
roke-width: 0px; background-color: transparent;">=C2=A0 =C2=A0 =C2=A0=C2=A0=
 return f&lt;i&gt;();</span></span></font></div><div><font face=3D"courier =
new,monospace"><span style=3D"text-align: left; color: rgb(34, 34, 34); tex=
t-transform: none; text-indent: 0px; letter-spacing: normal; font-size: 13p=
x; font-variant: normal; word-spacing: 0px; display: inline !important; whi=
te-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; =
background-color: transparent;"><span style=3D"margin: 0px; padding: 0px; b=
order: 0px rgb(34, 34, 34); border-image: none; text-align: left; color: rg=
b(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: norm=
al; font-size: 13px; font-style: normal; font-variant: normal; font-weight:=
 400; text-decoration: none; word-spacing: 0px; display: inline; white-spac=
e: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; backgro=
und-color: transparent;">=C2=A0 }</span></span></font></div><div><span styl=
e=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; text-i=
ndent: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; fo=
nt-variant: normal; font-weight: 400; text-decoration: none; word-spacing: =
0px; display: inline !important; white-space: normal; orphans: 2; float: no=
ne; -webkit-text-stroke-width: 0px; background-color: transparent;"><font f=
ace=3D"courier new,monospace"><b><i><br></i></b></font></span></div><div><s=
pan style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none=
; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-style: no=
rmal; font-variant: normal; font-weight: 400; text-decoration: none; word-s=
pacing: 0px; display: inline !important; white-space: normal; orphans: 2; f=
loat: none; -webkit-text-stroke-width: 0px; background-color: transparent;"=
><font face=3D"courier new,monospace">=C2=A0=C2=A0 ......</font></span></di=
v><div><br></div><div><span style=3D"text-align: left; color: rgb(34, 34, 3=
4); text-transform: none; text-indent: 0px; letter-spacing: normal; font-si=
ze: 13px; font-variant: normal; word-spacing: 0px; display: inline !importa=
nt; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width=
: 0px; background-color: transparent;"><font face=3D"courier new,monospace"=
><div style=3D"background-color: transparent; border-bottom-color: rgb(34, =
34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-=
outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-i=
mage-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34=
); border-left-style: none; border-left-width: 0px; border-right-color: rgb=
(34, 34, 34); border-right-style: none; border-right-width: 0px; border-top=
-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; col=
or: rgb(34, 34, 34); font-family: &amp;quot;Arial&amp;quot;,&amp;quot;Helve=
tica&amp;quot;,sans-serif; font-size: 13px; font-style: normal; font-varian=
t: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; ma=
rgin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bot=
tom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-ali=
gn: left; text-decoration: none; text-indent: 0px; text-transform: none; -w=
ebkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><spa=
n style=3D"background-color: transparent; border-bottom-color: rgb(34, 34, =
34); border-bottom-style: none; border-bottom-width: 0px; border-image-outs=
et: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image=
-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); b=
order-left-style: none; border-left-width: 0px; border-right-color: rgb(34,=
 34, 34); border-right-style: none; border-right-width: 0px; border-top-col=
or: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: =
rgb(34, 34, 34); display: inline; float: none; font-family: &amp;quot;Arial=
&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; letter-spacing: norm=
al; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0p=
x; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; =
padding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px=
; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal=
; word-spacing: 0px;"><span style=3D"background-color: transparent; border-=
bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-wid=
th: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image=
-slice: 100%; border-image-source: none; border-image-width: 1; border-left=
-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; b=
order-right-color: rgb(34, 34, 34); border-right-style: none; border-right-=
width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; bord=
er-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: none; fo=
nt-family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-ser=
if; font-size: 13px; font-style: normal; font-variant: normal; font-weight:=
 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-=
right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left:=
 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decorati=
on: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width=
: 0px; white-space: normal; word-spacing: 0px;"><font face=3D"courier new" =
style=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; b=
order-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stret=
ch; border-image-slice: 100%; border-image-source: none; border-image-width=
: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-le=
ft-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: non=
e; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-s=
tyle: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; ma=
rgin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; p=
adding-right: 0px; padding-top: 0px;">=C2=A0 {</font></span></span></div><d=
iv style=3D"background-color: transparent; border-bottom-color: rgb(34, 34,=
 34); border-bottom-style: none; border-bottom-width: 0px; border-image-out=
set: 0; border-image-repeat: stretch; border-image-slice: 100%; border-imag=
e-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); =
border-left-style: none; border-left-width: 0px; border-right-color: rgb(34=
, 34, 34); border-right-style: none; border-right-width: 0px; border-top-co=
lor: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color:=
 rgb(34, 34, 34); font-family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetic=
a&amp;quot;,sans-serif; font-size: 13px; font-style: normal; font-variant: =
normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margi=
n-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom=
: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align:=
 left; text-decoration: none; text-indent: 0px; text-transform: none; -webk=
it-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><span s=
tyle=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 34)=
; border-bottom-style: none; border-bottom-width: 0px; border-image-outset:=
 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-so=
urce: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bord=
er-left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34=
, 34); border-right-style: none; border-right-width: 0px; border-top-color:=
 rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: rgb=
(34, 34, 34); display: inline; float: none; font-family: &amp;quot;Arial&am=
p;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px; font-sty=
le: normal; font-variant: normal; font-weight: 400; letter-spacing: normal;=
 margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; =
orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; pad=
ding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; t=
ext-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; w=
ord-spacing: 0px;"><span style=3D"background-color: transparent; border-bot=
tom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width:=
 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-sl=
ice: 100%; border-image-source: none; border-image-width: 1; border-left-co=
lor: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; bord=
er-right-color: rgb(34, 34, 34); border-right-style: none; border-right-wid=
th: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-=
top-width: 0px; color: rgb(34, 34, 34); display: inline; float: none; font-=
family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif;=
 font-size: 13px; font-style: normal; font-variant: normal; font-weight: 40=
0; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-rig=
ht: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0p=
x; padding-right: 0px; padding-top: 0px; text-align: left; text-decoration:=
 none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0=
px; white-space: normal; word-spacing: 0px;"><font face=3D"courier new" sty=
le=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; bord=
er-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch;=
 border-image-slice: 100%; border-image-source: none; border-image-width: 1=
; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-=
width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; =
border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-styl=
e: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margi=
n-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padd=
ing-right: 0px; padding-top: 0px;"><span style=3D"background-color: transpa=
rent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; bord=
er-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch;=
 border-image-slice: 100%; border-image-source: none; border-image-width: 1=
; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-=
width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; =
border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-styl=
e: none; border-top-width: 0px; color: rgb(34, 34, 34); display: inline; fl=
oat: none; font-family: courier new,monospace; font-size: 13px; font-style:=
 normal; font-variant: normal; font-weight: 400; letter-spacing: normal; ma=
rgin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orp=
hans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; paddin=
g-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; text=
-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word=
-spacing: 0px;">=C2=A0 =C2=A0=C2=A0 constexpr </span><span style=3D"backgro=
und-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom=
-style: none; border-bottom-width: 0px; border-image-outset: 0; border-imag=
e-repeat: stretch; border-image-slice: 100%; border-image-source: none; bor=
der-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: =
none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-r=
ight-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34=
); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); d=
isplay: inline; float: none; font-family: courier new,monospace; font-size:=
 13px; font-style: normal; font-variant: normal; font-weight: 400; letter-s=
pacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; ma=
rgin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-=
right: 0px; padding-top: 0px; text-align: left; text-decoration: none; text=
-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-s=
pace: normal; word-spacing: 0px;">int i =3D n-1; </span></font></span></spa=
n></div><div style=3D"background-color: transparent; border-bottom-color: r=
gb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border=
-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; b=
order-image-source: none; border-image-width: 1; border-left-color: rgb(34,=
 34, 34); border-left-style: none; border-left-width: 0px; border-right-col=
or: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; bor=
der-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0=
px; color: rgb(34, 34, 34); font-family: &amp;quot;Arial&amp;quot;,&amp;quo=
t;Helvetica&amp;quot;,sans-serif; font-size: 13px; font-style: normal; font=
-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: =
0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padd=
ing-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; t=
ext-align: left; text-decoration: none; text-indent: 0px; text-transform: n=
one; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px=
;"><span style=3D"background-color: transparent; border-bottom-color: rgb(3=
4, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-ima=
ge-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; borde=
r-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34,=
 34); border-left-style: none; border-left-width: 0px; border-right-color: =
rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-=
top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; =
color: rgb(34, 34, 34); display: inline; float: none; font-family: &amp;quo=
t;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px=
; font-style: normal; font-variant: normal; font-weight: 400; letter-spacin=
g: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-=
top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right=
: 0px; padding-top: 0px; text-align: left; text-decoration: none; text-inde=
nt: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space:=
 normal; word-spacing: 0px;"><span style=3D"background-color: transparent; =
border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bot=
tom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; borde=
r-image-slice: 100%; border-image-source: none; border-image-width: 1; bord=
er-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width:=
 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; border=
-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: non=
e; border-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: n=
one; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,s=
ans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-=
weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; =
margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; paddin=
g-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-d=
ecoration: none; text-indent: 0px; text-transform: none; -webkit-text-strok=
e-width: 0px; white-space: normal; word-spacing: 0px;"><font face=3D"courie=
r new" style=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: =
none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat=
: stretch; border-image-slice: 100%; border-image-source: none; border-imag=
e-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; bo=
rder-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-sty=
le: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); borde=
r-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: =
0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left:=
 0px; padding-right: 0px; padding-top: 0px;"><span style=3D"background-colo=
r: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: =
none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat=
: stretch; border-image-slice: 100%; border-image-source: none; border-imag=
e-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; bo=
rder-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-sty=
le: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); borde=
r-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); display: =
inline; float: none; font-family: courier new,monospace; font-size: 13px; f=
ont-style: normal; font-variant: normal; font-weight: 400; letter-spacing: =
normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top=
: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0=
px; padding-top: 0px; text-align: left; text-decoration: none; text-indent:=
 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: no=
rmal; word-spacing: 0px;">=C2=A0 =C2=A0 =C2=A0</span></font></span></span><=
/div><div style=3D"background-color: transparent; border-bottom-color: rgb(=
34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-im=
age-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; bord=
er-image-source: none; border-image-width: 1; border-left-color: rgb(34, 34=
, 34); border-left-style: none; border-left-width: 0px; border-right-color:=
 rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; border=
-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px;=
 color: rgb(34, 34, 34); font-family: &amp;quot;Arial&amp;quot;,&amp;quot;H=
elvetica&amp;quot;,sans-serif; font-size: 13px; font-style: normal; font-va=
riant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px=
; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding=
-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text=
-align: left; text-decoration: none; text-indent: 0px; text-transform: none=
; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">=
<font face=3D"courier new,monospace" style=3D"border-bottom-color: rgb(34, =
34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-=
outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-i=
mage-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34=
); border-left-style: none; border-left-width: 0px; border-right-color: rgb=
(34, 34, 34); border-right-style: none; border-right-width: 0px; border-top=
-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; mar=
gin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padd=
ing-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">=
=C2=A0 =C2=A0=C2=A0 <span style=3D"background-color: transparent; border-bo=
ttom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width=
: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-s=
lice: 100%; border-image-source: none; border-image-width: 1; border-left-c=
olor: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; bor=
der-right-color: rgb(34, 34, 34); border-right-style: none; border-right-wi=
dth: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border=
-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: none; font=
-family: courier new,monospace; font-size: 13px; font-style: normal; font-v=
ariant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0p=
x; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; paddin=
g-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; tex=
t-align: left; text-decoration: none; text-indent: 0px; text-transform: non=
e; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"=
><span style=3D"background-color: transparent; border-bottom-color: rgb(34,=
 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image=
-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-=
image-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 3=
4); border-left-style: none; border-left-width: 0px; border-right-color: rg=
b(34, 34, 34); border-right-style: none; border-right-width: 0px; border-to=
p-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; co=
lor: rgb(34, 34, 34); display: inline; float: none; font-family: courier ne=
w,monospace; font-size: 13px; font-style: normal; font-variant: normal; fon=
t-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px=
; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padd=
ing-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text=
-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-str=
oke-width: 0px; white-space: normal; word-spacing: 0px;">if(i =3D=3D j)</sp=
an><br style=3D"background-color: transparent; border-bottom-color: rgb(34,=
 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image=
-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-=
image-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 3=
4); border-left-style: none; border-left-width: 0px; border-right-color: rg=
b(34, 34, 34); border-right-style: none; border-right-width: 0px; border-to=
p-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; co=
lor: rgb(34, 34, 34); font-family: courier new,monospace; font-size: 13px; =
font-style: normal; font-variant: normal; font-weight: 400; letter-spacing:=
 normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-to=
p: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: =
0px; padding-top: 0px; text-align: left; text-decoration: none; text-indent=
: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: n=
ormal; word-spacing: 0px;"><span style=3D"background-color: transparent; bo=
rder-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-botto=
m-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-=
image-slice: 100%; border-image-source: none; border-image-width: 1; border=
-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0=
px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-r=
ight-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none;=
 border-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: non=
e; font-family: courier new,monospace; font-size: 13px; font-style: normal;=
 font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bot=
tom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2;=
 padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0=
px; text-align: left; text-decoration: none; text-indent: 0px; text-transfo=
rm: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing=
: 0px;">=C2=A0 =C2=A0 =C2=A0=C2=A0 return f&lt;i&gt;();</span></span></font=
></div></font></span><div style=3D"background-color: transparent; border-bo=
ttom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width=
: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-s=
lice: 100%; border-image-source: none; border-image-width: 1; border-left-c=
olor: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; bor=
der-right-color: rgb(34, 34, 34); border-right-style: none; border-right-wi=
dth: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border=
-top-width: 0px; color: rgb(34, 34, 34); font-family: &amp;quot;Arial&amp;q=
uot;,&amp;quot;Helvetica&amp;quot;,sans-serif; font-size: 13px; font-style:=
 normal; font-variant: normal; font-weight: 400; letter-spacing: normal; ma=
rgin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orp=
hans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; paddin=
g-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; text=
-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word=
-spacing: 0px;"><span style=3D"text-align: left; color: rgb(34, 34, 34); te=
xt-transform: none; text-indent: 0px; letter-spacing: normal; font-size: 13=
px; font-variant: normal; word-spacing: 0px; display: inline !important; wh=
ite-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px;=
 background-color: transparent;"><font face=3D"courier new,monospace"><font=
 face=3D"courier new,monospace" style=3D"border-bottom-color: rgb(34, 34, 3=
4); border-bottom-style: none; border-bottom-width: 0px; border-image-outse=
t: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-=
source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bo=
rder-left-style: none; border-left-width: 0px; border-right-color: rgb(34, =
34, 34); border-right-style: none; border-right-width: 0px; border-top-colo=
r: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; margin-b=
ottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-b=
ottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span=
 style=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 3=
4); border-bottom-style: none; border-bottom-width: 0px; border-image-outse=
t: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-=
source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bo=
rder-left-style: none; border-left-width: 0px; border-right-color: rgb(34, =
34, 34); border-right-style: none; border-right-width: 0px; border-top-colo=
r: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: r=
gb(34, 34, 34); display: inline; float: none; font-family: courier new,mono=
space; font-size: 13px; font-style: normal; font-variant: normal; font-weig=
ht: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; marg=
in-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-le=
ft: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decor=
ation: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-wi=
dth: 0px; white-space: normal; word-spacing: 0px;"><span style=3D"backgroun=
d-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-s=
tyle: none; border-bottom-width: 0px; border-image-outset: 0; border-image-=
repeat: stretch; border-image-slice: 100%; border-image-source: none; borde=
r-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: no=
ne; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-rig=
ht-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34);=
 border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); dis=
play: inline; float: none; font-family: courier new,monospace; font-size: 1=
3px; font-style: normal; font-variant: normal; font-weight: 400; letter-spa=
cing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; marg=
in-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-ri=
ght: 0px; padding-top: 0px; text-align: left; text-decoration: none; text-i=
ndent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-spa=
ce: normal; word-spacing: 0px;">=C2=A0 }</span></span></font></font></span>=
<span style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: no=
ne; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-variant=
: normal; word-spacing: 0px; display: inline !important; white-space: norma=
l; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-colo=
r: transparent;"><font face=3D"courier new,monospace"><br style=3D"backgrou=
nd-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-=
style: none; border-bottom-width: 0px; border-image-outset: 0; border-image=
-repeat: stretch; border-image-slice: 100%; border-image-source: none; bord=
er-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: n=
one; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-ri=
ght-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34)=
; border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); fo=
nt-family: &amp;quot;Arial&amp;quot;,&amp;quot;Helvetica&amp;quot;,sans-ser=
if; font-size: 13px; font-style: normal; font-variant: normal; font-weight:=
 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-=
right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left:=
 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decorati=
on: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width=
: 0px; white-space: normal; word-spacing: 0px;"></font></span></div></div><=
div><span style=3D"text-align: left; color: rgb(34, 34, 34); text-transform=
: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-sty=
le: normal; font-variant: normal; font-weight: 400; text-decoration: none; =
word-spacing: 0px; display: inline !important; white-space: normal; orphans=
: 2; float: none; -webkit-text-stroke-width: 0px; background-color: transpa=
rent;"><font face=3D"courier new,monospace">}</font></span></div><div><span=
 style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; t=
ext-indent: 0px; letter-spacing: normal; font-size: 13px; font-style: norma=
l; font-variant: normal; font-weight: 400; text-decoration: none; word-spac=
ing: 0px; display: inline !important; white-space: normal; orphans: 2; floa=
t: none; -webkit-text-stroke-width: 0px; background-color: transparent;"><f=
ont face=3D"courier new"><br></font></span></div><div><span style=3D"text-a=
lign: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px;=
 letter-spacing: normal; font-size: 13px; font-style: normal; font-variant:=
 normal; font-weight: 400; text-decoration: none; word-spacing: 0px; displa=
y: inline !important; white-space: normal; orphans: 2; float: none; -webkit=
-text-stroke-width: 0px; background-color: transparent;"><font face=3D"aria=
l,sans-serif">OR also <span style=3D"display: inline !important; float: non=
e; background-color: transparent; color: rgb(34, 34, 34); font-family: aria=
l,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; fo=
nt-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-=
decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stro=
ke-width: 0px; white-space: normal; word-spacing: 0px;">equivalent=C2=A0 </=
span>to a switch statement - depending on how smart the compiler is and wha=
t type of code there is in the for block</font></span></div><div><br></div>=
<div><span style=3D"text-align: left; color: rgb(34, 34, 34); text-transfor=
m: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-va=
riant: normal; word-spacing: 0px; display: inline !important; white-space: =
normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background=
-color: transparent;"><font face=3D"courier new"><br></font></span></div><d=
iv><font face=3D"courier new,monospace"><b><br></b></font></div><div><b></b=
><i></i><u></u><sub></sub><sup></sup><strike></strike><br><br>On Saturday, =
January 20, 2018 at 1:20:55 PM UTC+2, f.zin...@gmx.de wrote:</div><blockquo=
te class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left:=
 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">C++17 offers fold expr=
essions for binary operators.<br><br>I want to make a proposal to add a rig=
ht fold expression for the ternary operator <span style=3D"font-family:cour=
ier new,monospace">?:<br></span><br><span style=3D"font-family:courier new,=
monospace">

</span><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-=
right:0px;text-indent:0px"><span style=3D"font-family:courier new,monospace=
">( C ? E : ... : I )</span></p><p style=3D"margin-top:0px;margin-bottom:0p=
x;margin-left:0px;margin-right:0px;text-indent:0px"><span style=3D"font-fam=
ily:arial,sans-serif">should expand to
</span><span style=3D"font-family:courier new,monospace">( C(1) ? E(1) : ( =
.... ( C(N-1) ? E(N-1) : ( C(N) ? E(N) : I ) ) ) )</span></p><p style=3D"mar=
gin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:=
0px"><span style=3D"font-family:arial,sans-serif"><br></span></p><p style=
=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-=
indent:0px"><span style=3D"font-family:arial,sans-serif">and</span></p><p s=
tyle=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;t=
ext-indent:0px"><span style=3D"font-family:arial,sans-serif"><br></span></p=
><span style=3D"font-family:courier new,monospace">( C ? E : ... )<br><span=
 style=3D"font-family:arial,sans-serif">should expand to</span></span><span=
 style=3D"font-family:arial,sans-serif"><br>
</span><span style=3D"font-family:arial,sans-serif">
</span><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-=
right:0px;text-indent:0px"><span style=3D"font-family:courier new,monospace=
">( C(1) ? E(1) : ( ... ( C(N-2) ? E(N-2) : ( C(N-1) ? E(N-1) : E(N) ) ) )<=
/span></p><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;marg=
in-right:0px;text-indent:0px"><br></p><p style=3D"margin-top:0px;margin-bot=
tom:0px;margin-left:0px;margin-right:0px;text-indent:0px">The full proposal=
 with motivating examples can be found on<br></p><span style=3D"font-family=
:courier new,monospace"></span><a onmousedown=3D"this.href=3D&#39;https://w=
ww.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fzingsheim%2FProposalTerna=
ryFold%2Fblob%2Fmaster%2FProposalTernaryFold.md\x26sa\x3dD\x26sntz\x3d1\x26=
usg\x3dAFQjCNGyobbvgE23oH8TCdBLttXzg9JqVQ&#39;;return true;" onclick=3D"thi=
s.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fzi=
ngsheim%2FProposalTernaryFold%2Fblob%2Fmaster%2FProposalTernaryFold.md\x26s=
a\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyobbvgE23oH8TCdBLttXzg9JqVQ&#39;;retur=
n true;" href=3D"https://github.com/zingsheim/ProposalTernaryFold/blob/mast=
er/ProposalTernaryFold.md" target=3D"_blank" rel=3D"nofollow">https://githu=
b.com/zingsheim/<wbr>ProposalTernaryFold/blob/<wbr>master/ProposalTernaryFo=
ld.md</a><br><br>Note: A initial idea of this proposal has already been pub=
lish on <a onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3d=
https%3A%2F%2Fwww.reddit.com%2Fr%2Fcpp%2Fcomments%2F7qcgne%2Frfc_proposal_t=
ernary_fold_expression%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFAwhlqn2n=
q06q8ziJ2rUUJ4jksuA&#39;;return true;" onclick=3D"this.href=3D&#39;https://=
www.google.com/url?q\x3dhttps%3A%2F%2Fwww.reddit.com%2Fr%2Fcpp%2Fcomments%2=
F7qcgne%2Frfc_proposal_ternary_fold_expression%2F\x26sa\x3dD\x26sntz\x3d1\x=
26usg\x3dAFQjCNFAwhlqn2nq06q8ziJ2rUUJ4jksuA&#39;;return true;" href=3D"http=
s://www.reddit.com/r/cpp/comments/7qcgne/rfc_proposal_ternary_fold_expressi=
on/" target=3D"_blank" rel=3D"nofollow">reddit</a>.<br><br>Comments on this=
 initial version of the proposal are welcome.<br><br></div></blockquote></d=
iv>

<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/f75cbe71-9f5c-43fe-898e-06318e301b6f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f75cbe71-9f5c-43fe-898e-06318e301b6f=
%40isocpp.org</a>.<br />

------=_Part_1826_91203788.1516460021844--

------=_Part_1825_1695302955.1516460021843--

.


Author: mihailnajdenov@gmail.com
Date: Sat, 20 Jan 2018 06:55:18 -0800 (PST)
Raw View
------=_Part_2221_948086372.1516460118197
Content-Type: multipart/alternative;
 boundary="----=_Part_2222_369685300.1516460118198"

------=_Part_2222_369685300.1516460118198
Content-Type: text/plain; charset="UTF-8"

Because we are speculating:

template <std::size_t... js>
auto test_impl(std::size_t j, std::index_sequence<js...>)
{
   switch(j)
   {
      case js: { return f<js>; break; } ... //< expand to switch blocks
      default: break;
   }
}

Or without the need of index_sequence

template <std::size_t n>
auto test(std::size_t j)
{
  constexpr for(auto i; i < n; ++i )  //< i and n are constexpr
  {
    if(i == j)
      return f<i>();
  }
}

The latter will be equivalent of:

template <std::size_t n>
auto test(std::size_t j)
{
  {
     constexpr int i = 0;

     if(i == j)
       return f<i>();
  }
   ......
  {
     constexpr int i = n-1;

     if(i == j)
       return f<i>();
  }
}

OR also equivalent  to a switch statement - depending on how smart the
compiler is and what type of code there is in the 'for' block


On Saturday, January 20, 2018 at 1:20:55 PM UTC+2, f.zin...@gmx.de wrote:

> C++17 offers fold expressions for binary operators.
>
> I want to make a proposal to add a right fold expression for the ternary
> operator ?:
>
> ( C ? E : ... : I )
>
> should expand to ( C(1) ? E(1) : ( ... ( C(N-1) ? E(N-1) : ( C(N) ? E(N)
> : I ) ) ) )
>
>
> and
>
>
> ( C ? E : ... )
> should expand to
>
> ( C(1) ? E(1) : ( ... ( C(N-2) ? E(N-2) : ( C(N-1) ? E(N-1) : E(N) ) ) )
>
>
> The full proposal with motivating examples can be found on
>
> https://github.com/zingsheim/ProposalTernaryFold/blob/master/ProposalTernaryFold.md
>
> Note: A initial idea of this proposal has already been publish on reddit
> <https://www.reddit.com/r/cpp/comments/7qcgne/rfc_proposal_ternary_fold_expression/>
> .
>
> Comments on this initial version of the proposal are welcome.
>
>

--
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/eff4cdc9-f673-4ad6-bc8c-d14859ca01ef%40isocpp.org.

------=_Part_2222_369685300.1516460118198
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Because we are speculating:</div><div><br></div><div>=
<font face=3D"courier new,monospace">template &lt;std::size_t... js&gt;<br>=
auto test_impl(std::size_t j, std::index_sequence&lt;js...&gt;)<br>{<br>=C2=
=A0=C2=A0 switch(j)<br>=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cas=
e js: { return f&lt;js&gt;; break; } ... //&lt; expand to switch blocks<br>=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 default: break;<br>=C2=A0=C2=A0 }<br>}</font=
></div><div><font face=3D"courier new,monospace"><br></font></div><div>Or w=
ithout the need of index_sequence</div><div><br></div><div><font face=3D"co=
urier new,monospace">template &lt;std::size_t n&gt;<br>auto test(std::size_=
t j)<br>{<br>=C2=A0 constexpr for(auto i; i &lt; n; ++i )=C2=A0 //&lt; i an=
d n are constexpr<br>=C2=A0 {<br>=C2=A0=C2=A0=C2=A0 if(i =3D=3D j)<br>=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 return f&lt;i&gt;(); <br>=C2=A0 }</font><br>}</=
div><div><br></div><div>The latter will be equivalent of: </div><div><br><f=
ont face=3D"courier new,monospace">template &lt;std::size_t n&gt;<br>auto t=
est(std::size_t j)<br>{<br>=C2=A0 {<br>=C2=A0=C2=A0=C2=A0=C2=A0 constexpr i=
nt i =3D 0; <br>=C2=A0=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0=C2=A0 if(i =
=3D=3D j)<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return f&lt;i&gt;();<br>=
=C2=A0 }</font></div><div><font face=3D"courier new,monospace">=C2=A0=C2=A0=
 ......</font></div><div><font face=3D"courier new,monospace">=C2=A0 {<br>=
=C2=A0=C2=A0=C2=A0=C2=A0 constexpr int i =3D n-1; <br>=C2=A0=C2=A0=C2=A0=C2=
=A0 <br>=C2=A0=C2=A0=C2=A0=C2=A0 if(i =3D=3D j)<br>=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 return f&lt;i&gt;();<br>=C2=A0 }<br>}</font></div><div><font f=
ace=3D"courier new,monospace"><br></font></div><div>OR also equivalent=C2=
=A0 to a switch statement - depending on how smart the compiler is and what=
 type of code there is in the &#39;for&#39; block</div><div><br><br>On Satu=
rday, January 20, 2018 at 1:20:55 PM UTC+2, f.zin...@gmx.de wrote:</div><bl=
ockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border=
-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">C++17 offers fol=
d expressions for binary operators.<br><br>I want to make a proposal to add=
 a right fold expression for the ternary operator <span style=3D"font-famil=
y:courier new,monospace">?:<br></span><br><span style=3D"font-family:courie=
r new,monospace">

</span><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-=
right:0px;text-indent:0px"><span style=3D"font-family:courier new,monospace=
">( C ? E : ... : I )</span></p><p style=3D"margin-top:0px;margin-bottom:0p=
x;margin-left:0px;margin-right:0px;text-indent:0px"><span style=3D"font-fam=
ily:arial,sans-serif">should expand to
</span><span style=3D"font-family:courier new,monospace">( C(1) ? E(1) : ( =
.... ( C(N-1) ? E(N-1) : ( C(N) ? E(N) : I ) ) ) )</span></p><p style=3D"mar=
gin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:=
0px"><span style=3D"font-family:arial,sans-serif"><br></span></p><p style=
=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-=
indent:0px"><span style=3D"font-family:arial,sans-serif">and</span></p><p s=
tyle=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;t=
ext-indent:0px"><span style=3D"font-family:arial,sans-serif"><br></span></p=
><span style=3D"font-family:courier new,monospace">( C ? E : ... )<br><span=
 style=3D"font-family:arial,sans-serif">should expand to</span></span><span=
 style=3D"font-family:arial,sans-serif"><br>
</span><span style=3D"font-family:arial,sans-serif">
</span><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-=
right:0px;text-indent:0px"><span style=3D"font-family:courier new,monospace=
">( C(1) ? E(1) : ( ... ( C(N-2) ? E(N-2) : ( C(N-1) ? E(N-1) : E(N) ) ) )<=
/span></p><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;marg=
in-right:0px;text-indent:0px"><br></p><p style=3D"margin-top:0px;margin-bot=
tom:0px;margin-left:0px;margin-right:0px;text-indent:0px">The full proposal=
 with motivating examples can be found on<br></p><span style=3D"font-family=
:courier new,monospace"></span><a onmousedown=3D"this.href=3D&#39;https://w=
ww.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fzingsheim%2FProposalTerna=
ryFold%2Fblob%2Fmaster%2FProposalTernaryFold.md\x26sa\x3dD\x26sntz\x3d1\x26=
usg\x3dAFQjCNGyobbvgE23oH8TCdBLttXzg9JqVQ&#39;;return true;" onclick=3D"thi=
s.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fzi=
ngsheim%2FProposalTernaryFold%2Fblob%2Fmaster%2FProposalTernaryFold.md\x26s=
a\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyobbvgE23oH8TCdBLttXzg9JqVQ&#39;;retur=
n true;" href=3D"https://github.com/zingsheim/ProposalTernaryFold/blob/mast=
er/ProposalTernaryFold.md" target=3D"_blank" rel=3D"nofollow">https://githu=
b.com/zingsheim/<wbr>ProposalTernaryFold/blob/<wbr>master/ProposalTernaryFo=
ld.md</a><br><br>Note: A initial idea of this proposal has already been pub=
lish on <a onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3d=
https%3A%2F%2Fwww.reddit.com%2Fr%2Fcpp%2Fcomments%2F7qcgne%2Frfc_proposal_t=
ernary_fold_expression%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFAwhlqn2n=
q06q8ziJ2rUUJ4jksuA&#39;;return true;" onclick=3D"this.href=3D&#39;https://=
www.google.com/url?q\x3dhttps%3A%2F%2Fwww.reddit.com%2Fr%2Fcpp%2Fcomments%2=
F7qcgne%2Frfc_proposal_ternary_fold_expression%2F\x26sa\x3dD\x26sntz\x3d1\x=
26usg\x3dAFQjCNFAwhlqn2nq06q8ziJ2rUUJ4jksuA&#39;;return true;" href=3D"http=
s://www.reddit.com/r/cpp/comments/7qcgne/rfc_proposal_ternary_fold_expressi=
on/" target=3D"_blank" rel=3D"nofollow">reddit</a>.<br><br>Comments on this=
 initial version of the proposal are welcome.<br><br></div></blockquote></d=
iv>

<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/eff4cdc9-f673-4ad6-bc8c-d14859ca01ef%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/eff4cdc9-f673-4ad6-bc8c-d14859ca01ef=
%40isocpp.org</a>.<br />

------=_Part_2222_369685300.1516460118198--

------=_Part_2221_948086372.1516460118197--

.


Author: f.zingsheim@gmx.de
Date: Sat, 20 Jan 2018 07:15:38 -0800 (PST)
Raw View
------=_Part_2402_1482138341.1516461338533
Content-Type: multipart/alternative;
 boundary="----=_Part_2403_1834708170.1516461338533"

------=_Part_2403_1834708170.1516461338533
Content-Type: text/plain; charset="UTF-8"



Am Samstag, 20. Januar 2018 13:52:29 UTC+1 schrieb mihailn...@gmail.com:
>
> Are there any uses besides search in a parameter pack?
>
> Because I believe there should be a cleaner way to represent that.
>
> I believe something like this was proposed
>
> for...(const auto i : js)
> {
>  if(i == j)
>    return f<i>();
> }
>
> You can test if j is out of bounds even today if(j >= sizeof...(js)) throw
>
>
> There is no established practice of ternary operator to do search among
> values, hence using it that way is no less confusing then recursion.
>
> I don't say I am against the proposal! Just that one example should be
> handled better.
>
>

   1. There are no usages beside the selection of one out of many
   alternatives. Since the ordinary ternary operator is a selection of one out
   of two.
   2. To your comparison with for... :
   With the folded ternary expression it is possible to make use of the
   result immediately, since you could write:

   int ret = ( (j == js) ? f<js>() : ... );

   3. To your remark: "There is no established practice of ternary operator
   to do search among values"
   See for example:

   https://www.reddit.com/r/cpp/comments/2y7a20/secrets_of_the_conditional_ternary_operator/cpb8cwe/
   and

   http://twistedoakstudios.com/blog/Post5273_how-to-read-nested-ternary-operators
   4. To your remark: "using it that way is no less confusing then
   recursion"
   I recently got the true remark that recursions are hard to debug. See
   https://www.reddit.com/r/cpp/comments/7pya5s/stdvisit_overhead/dsnrbt2/.
   (By the way this reddit entry was the reason to start thinking about
   fold ternary expressions.)


--
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/29fb5ea3-4975-4793-97e0-5e5d9b2df4f7%40isocpp.org.

------=_Part_2403_1834708170.1516461338533
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>Am Samstag, 20. Januar 2018 13:52:29 UTC+1 schrieb=
 mihailn...@gmail.com:<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>Are there any uses besides search in a parameter pack?</div><=
div><br></div><div> Because I believe there should be a cleaner way to repr=
esent that.=C2=A0</div><div><br></div><div>I believe something like this wa=
s proposed</div><div><br></div><div><font face=3D"courier new,monospace">fo=
r...(const auto i :  js) </font><font face=3D"courier new">=C2=A0</font></d=
iv><div><font face=3D"courier new">{</font></div><div><font face=3D"courier=
 new">=C2=A0if(i =3D=3D j)</font></div><div><font face=3D"courier new">=C2=
=A0=C2=A0 return f&lt;i&gt;();</font></div><div><font face=3D"courier new">=
}</font></div><div><font face=3D"courier new"><br></font></div><div><font f=
ace=3D"arial,sans-serif">You can test if <font face=3D"courier new,monospac=
e">j</font> is out of bounds even today </font><font face=3D"courier new,mo=
nospace">if(j &gt;=3D sizeof...(js)) throw</font></div><div><font face=3D"c=
ourier new"><br></font></div><div><font face=3D"courier new"><br></font></d=
iv><div><font face=3D"arial,sans-serif">There is no established practice of=
 ternary operator to do search among values, hence using it that way is no =
less confusing then recursion.=C2=A0</font></div><div><br></div><div><span =
style=3D"display:inline!important;float:none;background-color:transparent;c=
olor:rgb(34,34,34);font-family:&quot;Arial&quot;,&quot;Helvetica&quot;,sans=
-serif;font-size:13px;font-style:normal;font-variant:normal;font-weight:400=
;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px=
;text-transform:none;white-space:normal;word-spacing:0px">I don&#39;t say I=
 am against the proposal! Just that one example should be handled better.</=
span></div><div><font face=3D"arial,sans-serif"><b><br></b></font></div></d=
iv></blockquote><div><br></div><div><ol><li>There are no usages beside the =
selection of one out of many alternatives. Since the ordinary ternary opera=
tor is a selection of one out of two.<br></li><li>To your comparison with <=
span style=3D"font-family: courier new, monospace;">for...</span> : <br>Wit=
h the folded ternary expression it is possible to make use of the result im=
mediately, since you could write:<font face=3D"courier new,monospace"><br><=
br>int ret =3D ( (j =3D=3D js) ? f&lt;js&gt;() : ... );<br></font><br></li>=
<li>To your remark: &quot;<font face=3D"arial,sans-serif">There is no estab=
lished practice of ternary operator to do search among values&quot;<br>See =
for example: <br><a href=3D"https://www.reddit.com/r/cpp/comments/2y7a20/se=
crets_of_the_conditional_ternary_operator/cpb8cwe/">https://www.reddit.com/=
r/cpp/comments/2y7a20/secrets_of_the_conditional_ternary_operator/cpb8cwe/<=
/a><br>and<br><a href=3D"http://twistedoakstudios.com/blog/Post5273_how-to-=
read-nested-ternary-operators">http://twistedoakstudios.com/blog/Post5273_h=
ow-to-read-nested-ternary-operators</a></font></li><li><font face=3D"arial,=
sans-serif">To your remark: &quot;</font><font face=3D"arial,sans-serif"><f=
ont face=3D"arial,sans-serif">using it that way is no less confusing then r=
ecursion&quot;<br>I recently got the true remark that recursions are hard t=
o debug. See <a href=3D"https://www.reddit.com/r/cpp/comments/7pya5s/stdvis=
it_overhead/dsnrbt2/">https://www.reddit.com/r/cpp/comments/7pya5s/stdvisit=
_overhead/dsnrbt2/</a>.<br>(By the way this reddit entry was the reason to =
start thinking about fold ternary expressions.)<br></font></font></li></ol>=
</div><div><font face=3D"arial,sans-serif"><br></font></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/29fb5ea3-4975-4793-97e0-5e5d9b2df4f7%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/29fb5ea3-4975-4793-97e0-5e5d9b2df4f7=
%40isocpp.org</a>.<br />

------=_Part_2403_1834708170.1516461338533--

------=_Part_2402_1482138341.1516461338533--

.


Author: Barry Revzin <barry.revzin@gmail.com>
Date: Sun, 21 Jan 2018 18:23:24 -0800 (PST)
Raw View
------=_Part_3577_1914712302.1516587804809
Content-Type: multipart/alternative;
 boundary="----=_Part_3578_944213625.1516587804810"

------=_Part_3578_944213625.1516587804810
Content-Type: text/plain; charset="UTF-8"



On Saturday, January 20, 2018 at 5:20:55 AM UTC-6, Frank Zingsheim wrote:
>
> C++17 offers fold expressions for binary operators.
>
> I want to make a proposal to add a right fold expression for the ternary
> operator ?:
>
> ( C ? E : ... : I )
>
> should expand to ( C(1) ? E(1) : ( ... ( C(N-1) ? E(N-1) : ( C(N) ? E(N)
> : I ) ) ) )
>
>
> and
>
>
> ( C ? E : ... )
> should expand to
>
> ( C(1) ? E(1) : ( ... ( C(N-2) ? E(N-2) : ( C(N-1) ? E(N-1) : E(N) ) ) )
>
>
> The full proposal with motivating examples can be found on
>
> https://github.com/zingsheim/ProposalTernaryFold/blob/master/ProposalTernaryFold.md
>
> Note: A initial idea of this proposal has already been publish on reddit
> <https://www.google.com/url?q=https%3A%2F%2Fwww.reddit.com%2Fr%2Fcpp%2Fcomments%2F7qcgne%2Frfc_proposal_ternary_fold_expression%2F&sa=D&sntz=1&usg=AFQjCNFAwhlqn2nq06q8ziJ2rUUJ4jksuA>
> .
>
> Comments on this initial version of the proposal are welcome.
>
>
For your first example, is this really better than
https://www.reddit.com/r/cpp/comments/7qcgne/rfc_proposal_ternary_fold_expression/dso41rx/?st=jcpl1gmq&sh=9ee1b9c4
?

For your second example, is this really better than having a hashtable from
std::string to std::function<std::string(std::string const&)> and just
doing a lookup + call?

Also, it's called the conditional operator, it's not called the ternary
operator (it simply is a ternary operator).

--
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/643bc18d-3118-40cc-8a4a-7b7c563ae54a%40isocpp.org.

------=_Part_3578_944213625.1516587804810
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Saturday, January 20, 2018 at 5:20:55 AM UTC-6,=
 Frank Zingsheim wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr">C++17 offers fold expressions for binary operators.<br><br>I want=
 to make a proposal to add a right fold expression for the ternary operator=
 <span style=3D"font-family:courier new,monospace">?:<br></span><br><span s=
tyle=3D"font-family:courier new,monospace">

</span><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-=
right:0px;text-indent:0px"><span style=3D"font-family:courier new,monospace=
">( C ? E : ... : I )</span></p><p style=3D"margin-top:0px;margin-bottom:0p=
x;margin-left:0px;margin-right:0px;text-indent:0px"><span style=3D"font-fam=
ily:arial,sans-serif">should expand to
</span><span style=3D"font-family:courier new,monospace">( C(1) ? E(1) : ( =
.... ( C(N-1) ? E(N-1) : ( C(N) ? E(N) : I ) ) ) )</span></p><p style=3D"mar=
gin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:=
0px"><span style=3D"font-family:arial,sans-serif"><br></span></p><p style=
=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-=
indent:0px"><span style=3D"font-family:arial,sans-serif">and</span></p><p s=
tyle=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;t=
ext-indent:0px"><span style=3D"font-family:arial,sans-serif"><br></span></p=
><span style=3D"font-family:courier new,monospace">( C ? E : ... )<br><span=
 style=3D"font-family:arial,sans-serif">should expand to</span></span><span=
 style=3D"font-family:arial,sans-serif"><br>
</span><span style=3D"font-family:arial,sans-serif">
</span><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;margin-=
right:0px;text-indent:0px"><span style=3D"font-family:courier new,monospace=
">( C(1) ? E(1) : ( ... ( C(N-2) ? E(N-2) : ( C(N-1) ? E(N-1) : E(N) ) ) )<=
/span></p><p style=3D"margin-top:0px;margin-bottom:0px;margin-left:0px;marg=
in-right:0px;text-indent:0px"><br></p><p style=3D"margin-top:0px;margin-bot=
tom:0px;margin-left:0px;margin-right:0px;text-indent:0px">The full proposal=
 with motivating examples can be found on<br></p><span style=3D"font-family=
:courier new,monospace"></span><a href=3D"https://github.com/zingsheim/Prop=
osalTernaryFold/blob/master/ProposalTernaryFold.md" target=3D"_blank" rel=
=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\=
x3dhttps%3A%2F%2Fgithub.com%2Fzingsheim%2FProposalTernaryFold%2Fblob%2Fmast=
er%2FProposalTernaryFold.md\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyobbvg=
E23oH8TCdBLttXzg9JqVQ&#39;;return true;" onclick=3D"this.href=3D&#39;https:=
//www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fzingsheim%2FProposalTe=
rnaryFold%2Fblob%2Fmaster%2FProposalTernaryFold.md\x26sa\x3dD\x26sntz\x3d1\=
x26usg\x3dAFQjCNGyobbvgE23oH8TCdBLttXzg9JqVQ&#39;;return true;">https://git=
hub.com/zingsheim/<wbr>ProposalTernaryFold/blob/<wbr>master/ProposalTernary=
Fold.md</a><br><br>Note: A initial idea of this proposal has already been p=
ublish on <a href=3D"https://www.google.com/url?q=3Dhttps%3A%2F%2Fwww.reddi=
t.com%2Fr%2Fcpp%2Fcomments%2F7qcgne%2Frfc_proposal_ternary_fold_expression%=
2F&amp;sa=3DD&amp;sntz=3D1&amp;usg=3DAFQjCNFAwhlqn2nq06q8ziJ2rUUJ4jksuA" ta=
rget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://ww=
w.google.com/url?q\x3dhttps%3A%2F%2Fwww.reddit.com%2Fr%2Fcpp%2Fcomments%2F7=
qcgne%2Frfc_proposal_ternary_fold_expression%2F\x26sa\x3dD\x26sntz\x3d1\x26=
usg\x3dAFQjCNFAwhlqn2nq06q8ziJ2rUUJ4jksuA&#39;;return true;" onclick=3D"thi=
s.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.reddit.com%=
2Fr%2Fcpp%2Fcomments%2F7qcgne%2Frfc_proposal_ternary_fold_expression%2F\x26=
sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFAwhlqn2nq06q8ziJ2rUUJ4jksuA&#39;;retu=
rn true;">reddit</a>.<br><br>Comments on this initial version of the propos=
al are welcome.<br><br></div></blockquote><div><br></div><div>For your firs=
t example, is this really better than https://www.reddit.com/r/cpp/comments=
/7qcgne/rfc_proposal_ternary_fold_expression/dso41rx/?st=3Djcpl1gmq&amp;sh=
=3D9ee1b9c4 ?</div><div><br></div><div>For your second example, is this rea=
lly better than having a hashtable from std::string to std::function&lt;std=
::string(std::string const&amp;)&gt; and just doing a lookup + call?</div><=
div><br></div><div>Also, it&#39;s called the conditional operator, it&#39;s=
 not called the ternary operator (it simply is a ternary operator).=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/643bc18d-3118-40cc-8a4a-7b7c563ae54a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/643bc18d-3118-40cc-8a4a-7b7c563ae54a=
%40isocpp.org</a>.<br />

------=_Part_3578_944213625.1516587804810--

------=_Part_3577_1914712302.1516587804809--

.


Author: Frank Zingsheim <f.zingsheim@gmx.de>
Date: Mon, 22 Jan 2018 13:04:34 -0800 (PST)
Raw View
------=_Part_6581_1026607943.1516655074844
Content-Type: multipart/alternative;
 boundary="----=_Part_6582_17737259.1516655074845"

------=_Part_6582_17737259.1516655074845
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



Am Montag, 22. Januar 2018 03:23:24 UTC+1 schrieb Barry Revzin:
>
>
> For your first example, is this really better than=20
> https://www.reddit.com/r/cpp/comments/7qcgne/rfc_proposal_ternary_fold_ex=
pression/dso41rx/?st=3Djcpl1gmq&sh=3D9ee1b9c4=20
> ?
>
Clang can optimize the nested conditional operators at best.=20
Godbolt comparison conditional vs. function pointers (clang)=20
<https://gcc.godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAKxAEZSA=
bAQwDtRkBSAJgCFufSAZ1QBXYskwgA5NwDMeFsgYisAag6yAwskEF0WAGYbsHAAwBBM%2BYKYAt=
gAdmN9Vt3oQIQXgBemAPoEqnjGVm4eXr4BqgYQAJRWHADsfBaqaarEmARiLEEAVMGyKZaJACIJF=
mGePv6BNroQVRG1qlTxFknF6RlZOarULuWypaqmsS4AYtEamqbGcVbdSyD9VIMaI7TjGlNGWrTz=
26lL6SsDGxuqXNuyuzNch%2BrHJ6pnaxfDqrI3d1qyj4sXq9VutPgAWH7TLRggHPE5vUEjACskL=
2miRsPMQOB2LSaIAbIcNDx0gkylYpLFGNIkVJSCxpKY6ahpJp%2BPxVMIxBJ1FxZLQ6QRGZSqQB=
rEBcfEAOi4iTBpkS%2BMltFkSMlAE5EtSpGC6bY6KZTPThaQWVI6YIQEahVImVS4LAkGgHHgGJg=
yBQIM77K73ShmGwkYbSAZXTZiJaIAAjE1RhRMYgAT2kAtIztsmBYBAA8iwGMnbXSsLZWMA3Sb8J=
lkAQ8AA3TCWwukTAAD0wyBENhTdIUNgYJoIxDw%2BsLVID7HZvEYeCjlsgVNQ9hrqBYjYAtNnZG=
k12u3BtOLx%2BLRU1zxJIttracam2aWwAOfFr/Fg1RKUuqJFS0xf/q4QgkXl%2BVIVRNFQF03WI=
QCthAyceEFYVYjFCVpXVdU%2BVMWh5S4Wg71QlVtV1Uh9VoYMGRvaQLStUgbTtUgHUQFAMBwfAi=
A9SgaC4RhSxQWChFEM9pDkBQlBUTAXG0NxDBCDoLBsBwnDEmYmhqKJChMSo9HCFTAhidoSi6dJM=
myYhcjwApiTJcoZPMZTIjqBsCEaTTqjs1o9M6QE0hELw2GiJdIMuZoAggPJYgWIpPM5AgmBrZBX=
xXXRW3sSCDH81RoqjN0OCRPgkRGS5OjROZZGwYC0QOEqyvuYwqr%2BGqoU0GFKoajESqSIYDLSP=
ADFWEJhnxPSgSMvoCSJCK4WGkz0qYTLMGyngqGy0pwuKdqKTHGk6TIplTVZWDOX4nk5C4eDRypB=
BMCYLBiEoJC%2BSldUwT5ME71kXDaGw0xJQIraTTNSjrQQuiYAY71fTYr0wJ9CD/VLIMjVDBhw0=
jGMmzjFgEwLVN00zHM8wLHbi1Lcsm0rdsa3rRsdtbdtO0kKRU17TB%2BybQdhyB8ceMPKcGBnOc=
4lNJc8AS6QNy3Hc92GA8%2BF4Y8LUOyRrkvX7yKke9H2fV9xw/L8fwgP9WMAziQKh8GjfGNlubg=
6iEPOy7rtu0hxS4LgpUSdUPsSWRHq92R8T9n7rx2/6hComiRW1E6g%2BZCibbO0h6wjYWGTBIA%=
3D%3D>
It transforms them to assembler code equivalent to a switch statement and=
=20
can inline the called function f<i>().
In the code with the array of function pointers functions f<i>() are not=20
inlined.

However, the proposal is not about how compilers may optimize the code or=
=20
not (since this might change in the future). The proposal contains a=20
natural extension of the fold expression on the conditional ternary=20
operator and shows example to illustrate the usage.
Additional, to be natural extension, I think that the conditional ternary=
=20
fold is easier to write than creating function pointers. =20

>
> For your second example, is this really better than having a hashtable=20
> from std::string to std::function<std::string(std::string const&)> and ju=
st=20
> doing a lookup + call?
>
If you want to make use of hashes you could do this with the fold=20
expression, too.

template <typename String>
constexpr std::size_t simple_hash(String const & str)=20
{
   std::size_t ret =3D 0;
   for(auto const & c : str) {
       ret +=3D c;
   }
   return ret;
}


template<class... translators>
std::string translate_to_english_impl(
    std::string_view language,
    std::string_view text)
{
    auto lang_hash =3D hash(language);
    return ( (   lang_hash =3D=3D simple_hash(translators::language)
              && language =3D=3D translators::language)
             ? translators::translate_to_english(text)
             : ... : throw_unknown_language<std::string>(language) );
}

If you are sure to have no hash collisions you even could omit the=20
comparison of the language string, i.e.

template<class... translators>
std::string translate_to_english_impl(
    std::string_view language,
    std::string_view text)
{
    auto lang_hash =3D hash(language);
    return ( lang_hash =3D=3D simple_hash(translators::language)
             ? translators::translate_to_english(text)
             : ... : throw_unknown_language<std::string>(language) );
}



> Also, it's called the conditional operator, it's not called the ternary=
=20
> operator (it simply is a ternary operator).=20
>
Since the conditional operator is the only ternary operator which exists in=
=20
C++ it is often used as synonym.

However, the ternary fold applies to any ternary operator like the=20
conditional operator ? :
as the binary fold applies to many binary operators, i.e. +, *, etc.
However, I did not want to write the proposal with an anonymous ternary=20
operator op_left op_right since it makes the proposal harder to read.
For an anonymous ternary operator op_left op_right the proposal would read:
( E_left op_left E_middle op_right ... op_right E_right)=20
would expand to
( E_left_1 op_left E_middle _op_right ( ... ( E_left_n op_left E_middle_n=
=20
op_right E_right ) ) )
etc.
I tried to write conditional in the proposal at any place where it is=20
concrete to the conditional operator.


--=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/6bcbceb5-06d8-4da3-97e1-11951f55bc99%40isocpp.or=
g.

------=_Part_6582_17737259.1516655074845
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>Am Montag, 22. Januar 2018 03:23:24 UTC+1 schrieb =
Barry Revzin:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
<br><div>For your first example, is this really better than <a href=3D"http=
s://www.reddit.com/r/cpp/comments/7qcgne/rfc_proposal_ternary_fold_expressi=
on/dso41rx/?st=3Djcpl1gmq&amp;sh=3D9ee1b9c4" target=3D"_blank" rel=3D"nofol=
low" onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%=
3A%2F%2Fwww.reddit.com%2Fr%2Fcpp%2Fcomments%2F7qcgne%2Frfc_proposal_ternary=
_fold_expression%2Fdso41rx%2F%3Fst%3Djcpl1gmq%26sh%3D9ee1b9c4\x26sa\x3dD\x2=
6sntz\x3d1\x26usg\x3dAFQjCNEi9Q15_xT3l75gmBypKchNEk3i-w&#39;;return true;" =
onclick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fw=
ww.reddit.com%2Fr%2Fcpp%2Fcomments%2F7qcgne%2Frfc_proposal_ternary_fold_exp=
ression%2Fdso41rx%2F%3Fst%3Djcpl1gmq%26sh%3D9ee1b9c4\x26sa\x3dD\x26sntz\x3d=
1\x26usg\x3dAFQjCNEi9Q15_xT3l75gmBypKchNEk3i-w&#39;;return true;">https://w=
ww.reddit.com/r/cpp/<wbr>comments/7qcgne/rfc_proposal_<wbr>ternary_fold_exp=
ression/<wbr>dso41rx/?st=3Djcpl1gmq&amp;sh=3D<wbr>9ee1b9c4</a> ?</div></div=
></blockquote><div>Clang can optimize the nested conditional operators at b=
est. <br><a href=3D"https://gcc.godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBL=
AF1QCcAaPECAKxAEZSAbAQwDtRkBSAJgCFufSAZ1QBXYskwgA5NwDMeFsgYisAag6yAwskEF0WA=
GYbsHAAwBBM%2BYKYAtgAdmN9Vt3oQIQXgBemAPoEqnjGVm4eXr4BqgYQAJRWHADsfBaqaarEmA=
RiLEEAVMGyKZaJACIJFmGePv6BNroQVRG1qlTxFknF6RlZOarULuWypaqmsS4AYtEamqbGcVbdS=
yD9VIMaI7TjGlNGWrTz26lL6SsDGxuqXNuyuzNch%2BrHJ6pnaxfDqrI3d1qyj4sXq9VutPgAWH=
7TLRggHPE5vUEjACskL2miRsPMQOB2LSaIAbIcNDx0gkylYpLFGNIkVJSCxpKY6ahpJp%2BPxVM=
IxBJ1FxZLQ6QRGZSqQBrEBcfEAOi4iTBpkS%2BMltFkSMlAE5EtSpGC6bY6KZTPThaQWVI6YIQE=
ahVImVS4LAkGgHHgGJgyBQIM77K73ShmGwkYbSAZXTZiJaIAAjE1RhRMYgAT2kAtIztsmBYBAA8=
iwGMnbXSsLZWMA3Sb8JlkAQ8AA3TCWwukTAAD0wyBENhTdIUNgYJoIxDw%2BsLVID7HZvEYeCjl=
sgVNQ9hrqBYjYAtNnZGk12u3BtOLx%2BLRU1zxJIttracam2aWwAOfFr/Fg1RKUuqJFS0xf/q4Q=
gkXl%2BVIVRNFQF03WIQCthAyceEFYVYjFCVpXVdU%2BVMWh5S4Wg71QlVtV1Uh9VoYMGRvaQLS=
tUgbTtUgHUQFAMBwfAiA9SgaC4RhSxQWChFEM9pDkBQlBUTAXG0NxDBCDoLBsBwnDEmYmhqKJCh=
MSo9HCFTAhidoSi6dJMmyYhcjwApiTJcoZPMZTIjqBsCEaTTqjs1o9M6QE0hELw2GiJdIMuZoAg=
gPJYgWIpPM5AgmBrZBXxXXRW3sSCDH81RoqjN0OCRPgkRGS5OjROZZGwYC0QOEqyvuYwqr%2BGq=
oU0GFKoajESqSIYDLSPADFWEJhnxPSgSMvoCSJCK4WGkz0qYTLMGyngqGy0pwuKdqKTHGk6TIpl=
TVZWDOX4nk5C4eDRypBBMCYLBiEoJC%2BSldUwT5ME71kXDaGw0xJQIraTTNSjrQQuiYAY71fTY=
r0wJ9CD/VLIMjVDBhw0jGMmzjFgEwLVN00zHM8wLHbi1Lcsm0rdsa3rRsdtbdtO0kKRU17TB%2B=
ybQdhyB8ceMPKcGBnOc4lNJc8AS6QNy3Hc92GA8%2BF4Y8LUOyRrkvX7yKke9H2fV9xw/L8fwgP=
9WMAziQKh8GjfGNlubg6iEPOy7rtu0hxS4LgpUSdUPsSWRHq92R8T9n7rx2/6hComiRW1E6g%2B=
ZCibbO0h6wjYWGTBIA%3D%3D">Godbolt comparison conditional vs. function point=
ers (clang)</a><br>It transforms them to assembler code equivalent to a swi=
tch statement and can inline the called function f&lt;i&gt;().<br>In the co=
de with the array of function pointers functions f&lt;i&gt;() are not inlin=
ed.</div><div> </div><div><br>However, the proposal is not about how compil=
ers may optimize the code or not (since this might change in the future). T=
he proposal contains a natural extension of the fold expression on the cond=
itional ternary operator and shows example to illustrate the usage.<br>Addi=
tional, to be natural extension, I think that the conditional ternary fold =
is easier to write than creating function pointers.=C2=A0 <br></div><blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br></div><div>=
For your second example, is this really better than having a hashtable from=
 std::string to std::function&lt;std::string(std:<wbr>:string const&amp;)&g=
t; and just doing a lookup + call?</div></div></blockquote><div dir=3D"ltr"=
>If you want to make use of hashes you could do this with the fold expressi=
on, too.</div><div dir=3D"ltr"><br></div><div dir=3D"ltr"><span style=3D"fo=
nt-family: courier new, monospace;">template &lt;typename String&gt;<br>con=
stexpr std::size_t simple_hash(String const &amp; str) <br></span></div><di=
v dir=3D"ltr"><span style=3D"font-family: courier new, monospace;">{<br>=C2=
=A0=C2=A0 std::size_t ret =3D 0;<br>=C2=A0=C2=A0 for(auto const &amp; c : s=
tr) {<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ret +=3D c;<br>=C2=A0=C2=A0 }=
<br>=C2=A0=C2=A0 return ret;<br>}<br><br><br>template&lt;class... translato=
rs&gt;<br>std::string translate_to_english_impl(<br>=C2=A0=C2=A0=C2=A0 std:=
:string_view language,<br>=C2=A0=C2=A0=C2=A0 std::string_view text)<br>{<br=
>=C2=A0=C2=A0=C2=A0 auto lang_hash =3D hash(language);<br>=C2=A0=C2=A0=C2=
=A0 return ( (=C2=A0=C2=A0 lang_hash =3D=3D simple_hash(translators::langua=
ge)<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 &amp;&amp; language =3D=3D translators::language)<br>=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ? translato=
rs::translate_to_english(text)<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 : ... : throw_unknown_language&lt;std::st=
ring&gt;(language) );<br>}</span></div><div dir=3D"ltr"><br><span style=3D"=
font-family: courier new, monospace;"><font face=3D"arial,sans-serif">If yo=
u are sure to have no hash collisions you even could omit the comparison of=
 the language string, i.e.</font></span></div><div dir=3D"ltr"><br><span st=
yle=3D"font-family: courier new, monospace;"><font face=3D"arial,sans-serif=
"><span style=3D"font-family: courier new, monospace;">template&lt;class...=
 translators&gt;<br>std::string translate_to_english_impl(<br>=C2=A0=C2=A0=
=C2=A0 std::string_view language,<br>=C2=A0=C2=A0=C2=A0 std::string_view te=
xt)<br>{<br>=C2=A0=C2=A0=C2=A0 auto lang_hash =3D hash(language);<br>=C2=A0=
=C2=A0=C2=A0 return ( lang_hash =3D=3D simple_hash(translators::language)<b=
r>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =
? translators::translate_to_english(text)<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 : ... : throw_unknown_language&l=
t;std::string&gt;(language) );<br>}</span></font></span><div dir=3D"ltr"><b=
r></div></div><br><blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr"><br><div>Also, it&#39;s called the conditional operator, it&#39;s not =
called the ternary operator (it simply is a ternary operator).=C2=A0</div><=
/div></blockquote><div>Since the conditional operator is the only ternary o=
perator which exists in C++ it is often used as synonym.</div><div><br></di=
v><div>However, the ternary fold applies to any ternary operator like the c=
onditional operator ? :</div><div>as the binary fold applies to many binary=
 operators, i.e. +, *, etc.<br>However, I did not want to write the proposa=
l with an anonymous ternary operator <span style=3D"font-family: courier ne=
w, monospace;">op_left op_right</span> since it makes the proposal harder t=
o read.</div><div>For an anonymous ternary operator <span style=3D"font-fam=
ily: courier new, monospace;">op_left op_right</span> the proposal would re=
ad:</div><div><span style=3D"font-family: courier new, monospace;">( E_left=
 op_left E_middle op_right ... op_right E_right) <br></span></div><div><spa=
n style=3D"font-family: arial, sans-serif;">would expand to</span></div><di=
v><span style=3D"font-family: courier new, monospace;">( E_left_1 op_left E=
_middle _op_right ( ... ( E_left_n op_left E_middle_n op_right E_right ) ) =
)</span></div><div>etc.</div><div>I tried to write conditional in the propo=
sal at any place where it is concrete to the conditional operator.</div><di=
v><br></div><div><br></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/6bcbceb5-06d8-4da3-97e1-11951f55bc99%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6bcbceb5-06d8-4da3-97e1-11951f55bc99=
%40isocpp.org</a>.<br />

------=_Part_6582_17737259.1516655074845--

------=_Part_6581_1026607943.1516655074844--

.


Author: Frank Zingsheim <f.zingsheim@gmx.de>
Date: Mon, 2 Apr 2018 11:29:58 -0700 (PDT)
Raw View
------=_Part_17820_596843312.1522693798481
Content-Type: multipart/alternative;
 boundary="----=_Part_17821_69835472.1522693798481"

------=_Part_17821_69835472.1522693798481
Content-Type: text/plain; charset="UTF-8"

The proposal got the paper number P1012.

Comments are welcome even more, to make this proposal a success.

--
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/57a8bd53-3aa5-443d-b473-ff946b65e0af%40isocpp.org.

------=_Part_17821_69835472.1522693798481
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><font size=3D"2"><span style=3D"color: rgb(0, 0, 0);"><spa=
n style=3D"font-family: arial, sans-serif;">The proposal got the pa</span><=
span style=3D"font-family: arial, sans-serif;">per number </span></span><sp=
an style=3D"color: rgb(76, 76, 76); font-family: &quot;Ubuntu Mono&quot;; f=
ont-style: normal; font-variant: normal; font-weight: normal; letter-spacin=
g: normal; line-height: normal; text-align: start; text-indent: 0px; text-t=
ransform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke=
-width: 0px; background-color: rgb(255, 255, 255); display: inline !importa=
nt; float: none;"><span style=3D"font-family: arial, sans-serif;"><span sty=
le=3D"color: rgb(0, 0, 0);">P1012.<br><br>Comments are welcome even more, t=
o make this proposal a success.<br></span></span><br></span></font></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/57a8bd53-3aa5-443d-b473-ff946b65e0af%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/57a8bd53-3aa5-443d-b473-ff946b65e0af=
%40isocpp.org</a>.<br />

------=_Part_17821_69835472.1522693798481--

------=_Part_17820_596843312.1522693798481--

.


Author: mihailnajdenov@gmail.com
Date: Tue, 9 Oct 2018 09:46:50 -0700 (PDT)
Raw View
------=_Part_2247_878463000.1539103610573
Content-Type: multipart/alternative;
 boundary="----=_Part_2248_1366415803.1539103610573"

------=_Part_2248_1366415803.1539103610573
Content-Type: text/plain; charset="UTF-8"

Note that you can do 99% of this today


template<class... translators>
std::string translate_to_english_impl(
    std::string_view language,
    std::string_view text)
{
    std::string ret;
    if(! ((language == translators::language
             ? (ret = translators::translate_to_english(text), true)
             : false) || ...))
             throw std::runtime_error("Unknown language: " + language);

   return ret;
}

And you don't even need the extra throw_ function. Granted, the fact the
return must be declared upfront is a nasty downside especially if it some
auto return type.



On Monday, April 2, 2018 at 9:29:58 PM UTC+3, Frank Zingsheim wrote:
>
> The proposal got the paper number P1012.
>
> Comments are welcome even more, to make this proposal a success.
>
>

--
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/e90d1617-e237-4e2d-ac5f-c262b7374bd0%40isocpp.org.

------=_Part_2248_1366415803.1539103610573
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Note that you can do 99% of this today<div><br></div><div>=
<div><br></div><div><font face=3D"courier new, monospace">template&lt;class=
.... translators&gt;</font></div><div><font face=3D"courier new, monospace">=
std::string translate_to_english_impl(</font></div><div><font face=3D"couri=
er new, monospace">=C2=A0 =C2=A0 std::string_view language,</font></div><di=
v><font face=3D"courier new, monospace">=C2=A0 =C2=A0 std::string_view text=
)</font></div><div><font face=3D"courier new, monospace">{</font></div><div=
><font face=3D"courier new, monospace">=C2=A0 =C2=A0 std::string ret;</font=
></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 if(! ((lang=
uage =3D=3D translators::language</font></div><div><font face=3D"courier ne=
w, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0? (ret =3D tr=
anslators::translate_to_english(text), true)</font></div><div><font face=3D=
"courier new, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0: =
false) || ...))</font></div><div><font face=3D"courier new, monospace">=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0throw std::runtime_error(&quot=
;Unknown language: &quot; + language);</font></div><div><font face=3D"couri=
er new, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</font><=
/div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0return ret;</f=
ont></div><div><font face=3D"courier new, monospace">}</font></div><div><br=
></div><div>And you don&#39;t even need the extra throw_ function. Granted,=
 the fact the return must be declared upfront is a nasty downside especiall=
y if it some auto return type.=C2=A0</div><div><br></div><div><br></div><br=
>On Monday, April 2, 2018 at 9:29:58 PM UTC+3, Frank Zingsheim wrote:<block=
quote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-le=
ft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><font size=3D"2"><s=
pan style=3D"color:rgb(0,0,0)"><span style=3D"font-family:arial,sans-serif"=
>The proposal got the pa</span><span style=3D"font-family:arial,sans-serif"=
>per number </span></span><span style=3D"color:rgb(76,76,76);font-family:&q=
uot;Ubuntu Mono&quot;;font-style:normal;font-variant:normal;font-weight:nor=
mal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0=
px;text-transform:none;white-space:normal;word-spacing:0px;background-color=
:rgb(255,255,255);display:inline!important;float:none"><span style=3D"font-=
family:arial,sans-serif"><span style=3D"color:rgb(0,0,0)">P1012.<br><br>Com=
ments are welcome even more, to make this proposal a success.<br></span></s=
pan><br></span></font></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/e90d1617-e237-4e2d-ac5f-c262b7374bd0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e90d1617-e237-4e2d-ac5f-c262b7374bd0=
%40isocpp.org</a>.<br />

------=_Part_2248_1366415803.1539103610573--

------=_Part_2247_878463000.1539103610573--

.


Author: Frank Zingsheim <f.zingsheim@gmx.de>
Date: Wed, 10 Oct 2018 10:43:46 -0700 (PDT)
Raw View
------=_Part_2575_78350053.1539193426698
Content-Type: multipart/alternative;
 boundary="----=_Part_2576_1842510333.1539193426698"

------=_Part_2576_1842510333.1539193426698
Content-Type: text/plain; charset="UTF-8"

Thank you for the hint.

The run-time overhead of your solution in contrast to the solution in the
proposal is a default constructor + move assignment + destructor (in this
case of a std::string).
In case these three are available.
The solution from the proposal would result in a return value optimization
without any overhead and additional requirements.


Am Dienstag, 9. Oktober 2018 18:46:50 UTC+2 schrieb mihailn...@gmail.com:
>
> Note that you can do 99% of this today
>
>
> template<class... translators>
> std::string translate_to_english_impl(
>     std::string_view language,
>     std::string_view text)
> {
>     std::string ret;
>     if(! ((language == translators::language
>              ? (ret = translators::translate_to_english(text), true)
>              : false) || ...))
>              throw std::runtime_error("Unknown language: " + language);
>
>    return ret;
> }
>
> And you don't even need the extra throw_ function. Granted, the fact the
> return must be declared upfront is a nasty downside especially if it some
> auto return type.
>
>
>
> On Monday, April 2, 2018 at 9:29:58 PM UTC+3, Frank Zingsheim wrote:
>>
>> The proposal got the paper number P1012.
>>
>> Comments are welcome even more, to make this proposal a success.
>>
>>

--
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/23981304-bda2-4303-b5c6-c74481d5d2ba%40isocpp.org.

------=_Part_2576_1842510333.1539193426698
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Thank you for the hint.</div><div><br></div><div>The =
run-time overhead of your solution in contrast to the solution in the propo=
sal is a default constructor + move assignment + destructor (in this case o=
f a std::string).<br>In case these three are available.</div><div>The solut=
ion from the proposal would result in a return value optimization without a=
ny overhead and additional requirements.<br></div><div><br></div><br>Am Die=
nstag, 9. Oktober 2018 18:46:50 UTC+2 schrieb mihailn...@gmail.com:<blockqu=
ote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left=
: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Note that you can do =
99% of this today<div><br></div><div><div><br></div><div><font face=3D"cour=
ier new, monospace">template&lt;class... translators&gt;</font></div><div><=
font face=3D"courier new, monospace">std::string translate_to_english_impl(=
</font></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 std::=
string_view language,</font></div><div><font face=3D"courier new, monospace=
">=C2=A0 =C2=A0 std::string_view text)</font></div><div><font face=3D"couri=
er new, monospace">{</font></div><div><font face=3D"courier new, monospace"=
>=C2=A0 =C2=A0 std::string ret;</font></div><div><font face=3D"courier new,=
 monospace">=C2=A0 =C2=A0 if(! ((language =3D=3D translators::language</fon=
t></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0? (ret =3D translators::translate_to_<wbr>english(t=
ext), true)</font></div><div><font face=3D"courier new, monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0: false) || ...))</font></div><div=
><font face=3D"courier new, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0throw std::runtime_error(&quot;Unknown language: &quot; + lang=
uage);</font></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</font></div><div><font face=3D"courier =
new, monospace">=C2=A0 =C2=A0return ret;</font></div><div><font face=3D"cou=
rier new, monospace">}</font></div><div><br></div><div>And you don&#39;t ev=
en need the extra throw_ function. Granted, the fact the return must be dec=
lared upfront is a nasty downside especially if it some auto return type.=
=C2=A0</div><div><br></div><div><br></div><br>On Monday, April 2, 2018 at 9=
:29:58 PM UTC+3, Frank Zingsheim wrote:<blockquote class=3D"gmail_quote" st=
yle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1=
ex"><div dir=3D"ltr"><font size=3D"2"><span style=3D"color:rgb(0,0,0)"><spa=
n style=3D"font-family:arial,sans-serif">The proposal got the pa</span><spa=
n style=3D"font-family:arial,sans-serif">per number </span></span><span sty=
le=3D"color:rgb(76,76,76);font-family:&quot;Ubuntu Mono&quot;;font-style:no=
rmal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-heig=
ht:normal;text-align:start;text-indent:0px;text-transform:none;white-space:=
normal;word-spacing:0px;background-color:rgb(255,255,255);display:inline!im=
portant;float:none"><span style=3D"font-family:arial,sans-serif"><span styl=
e=3D"color:rgb(0,0,0)">P1012.<br><br>Comments are welcome even more, to mak=
e this proposal a success.<br></span></span><br></span></font></div></block=
quote></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/23981304-bda2-4303-b5c6-c74481d5d2ba%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/23981304-bda2-4303-b5c6-c74481d5d2ba=
%40isocpp.org</a>.<br />

------=_Part_2576_1842510333.1539193426698--

------=_Part_2575_78350053.1539193426698--

.


Author: =?UTF-8?B?R2HFoXBlciBBxb5tYW4=?= <gasper.azman@gmail.com>
Date: Wed, 10 Oct 2018 18:52:36 +0100
Raw View
--000000000000a700cf0577e38582
Content-Type: text/plain; charset="UTF-8"

With this proposal, and for..., it's possible to implement this in language:
https://gist.github.com/ricejasonf/84c11ac6bb093c1ea8c380a9a466d8cb

Come to think of it, for... Is probably enough.

On Wed, Oct 10, 2018, 18:43 Frank Zingsheim <f.zingsheim@gmx.de> wrote:

> Thank you for the hint.
>
> The run-time overhead of your solution in contrast to the solution in the
> proposal is a default constructor + move assignment + destructor (in this
> case of a std::string).
> In case these three are available.
> The solution from the proposal would result in a return value optimization
> without any overhead and additional requirements.
>
>
> Am Dienstag, 9. Oktober 2018 18:46:50 UTC+2 schrieb mihailn...@gmail.com:
>>
>> Note that you can do 99% of this today
>>
>>
>> template<class... translators>
>> std::string translate_to_english_impl(
>>     std::string_view language,
>>     std::string_view text)
>> {
>>     std::string ret;
>>     if(! ((language == translators::language
>>              ? (ret = translators::translate_to_english(text), true)
>>              : false) || ...))
>>              throw std::runtime_error("Unknown language: " + language);
>>
>>    return ret;
>> }
>>
>> And you don't even need the extra throw_ function. Granted, the fact the
>> return must be declared upfront is a nasty downside especially if it some
>> auto return type.
>>
>>
>>
>> On Monday, April 2, 2018 at 9:29:58 PM UTC+3, Frank Zingsheim wrote:
>>>
>>> The proposal got the paper number P1012.
>>>
>>> Comments are welcome even more, to make this proposal a success.
>>>
>>> --
> 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/23981304-bda2-4303-b5c6-c74481d5d2ba%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/23981304-bda2-4303-b5c6-c74481d5d2ba%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

--
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/CAANG%3DkWs3hG%3DiXhKEtSjBsZ2QR0vPC8Wn-PTryJnRU3XyFWQ7w%40mail.gmail.com.

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

<div dir=3D"auto">With this proposal, and for..., it&#39;s possible to impl=
ement this in language:<a href=3D"https://gist.github.com/ricejasonf/84c11a=
c6bb093c1ea8c380a9a466d8cb">https://gist.github.com/ricejasonf/84c11ac6bb09=
3c1ea8c380a9a466d8cb</a><div dir=3D"auto"><br></div><div dir=3D"auto">Come =
to think of it, for... Is probably enough.</div></div><br><div class=3D"gma=
il_quote"><div dir=3D"ltr">On Wed, Oct 10, 2018, 18:43 Frank Zingsheim &lt;=
<a href=3D"mailto:f.zingsheim@gmx.de">f.zingsheim@gmx.de</a>&gt; wrote:<br>=
</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Thank you for th=
e hint.</div><div><br></div><div>The run-time overhead of your solution in =
contrast to the solution in the proposal is a default constructor + move as=
signment + destructor (in this case of a std::string).<br>In case these thr=
ee are available.</div><div>The solution from the proposal would result in =
a return value optimization without any overhead and additional requirement=
s.<br></div><div><br></div><br>Am Dienstag, 9. Oktober 2018 18:46:50 UTC+2 =
schrieb <a href=3D"mailto:mihailn...@gmail.com" target=3D"_blank" rel=3D"no=
referrer">mihailn...@gmail.com</a>:<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">Note that you can do 99% of this today<div><br></div><div=
><div><br></div><div><font face=3D"courier new, monospace">template&lt;clas=
s... translators&gt;</font></div><div><font face=3D"courier new, monospace"=
>std::string translate_to_english_impl(</font></div><div><font face=3D"cour=
ier new, monospace">=C2=A0 =C2=A0 std::string_view language,</font></div><d=
iv><font face=3D"courier new, monospace">=C2=A0 =C2=A0 std::string_view tex=
t)</font></div><div><font face=3D"courier new, monospace">{</font></div><di=
v><font face=3D"courier new, monospace">=C2=A0 =C2=A0 std::string ret;</fon=
t></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 if(! ((lan=
guage =3D=3D translators::language</font></div><div><font face=3D"courier n=
ew, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0? (ret =3D t=
ranslators::translate_to_english(text), true)</font></div><div><font face=
=3D"courier new, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0: false) || ...))</font></div><div><font face=3D"courier new, monospace"=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0throw std::runtime_error(&=
quot;Unknown language: &quot; + language);</font></div><div><font face=3D"c=
ourier new, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</fo=
nt></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0return ret=
;</font></div><div><font face=3D"courier new, monospace">}</font></div><div=
><br></div><div>And you don&#39;t even need the extra throw_ function. Gran=
ted, the fact the return must be declared upfront is a nasty downside espec=
ially if it some auto return type.=C2=A0</div><div><br></div><div><br></div=
><br>On Monday, April 2, 2018 at 9:29:58 PM UTC+3, Frank Zingsheim wrote:<b=
lockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-=
left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><font size=3D"2"><sp=
an style=3D"color:rgb(0,0,0)"><span style=3D"font-family:arial,sans-serif">=
The proposal got the pa</span><span style=3D"font-family:arial,sans-serif">=
per number </span></span><span style=3D"color:rgb(76,76,76);font-family:&qu=
ot;Ubuntu Mono&quot;;font-style:normal;font-variant:normal;font-weight:norm=
al;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0p=
x;text-transform:none;white-space:normal;word-spacing:0px;background-color:=
rgb(255,255,255);display:inline!important;float:none"><span style=3D"font-f=
amily:arial,sans-serif"><span style=3D"color:rgb(0,0,0)">P1012.<br><br>Comm=
ents are welcome even more, to make this proposal a success.<br></span></sp=
an><br></span></font></div></blockquote></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" target=3D"_=
blank" rel=3D"noreferrer">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank" rel=3D"noreferrer">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/23981304-bda2-4303-b5c6-c74481d5d2ba%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"noreferrer">https://groups.google.com/a/isocpp.org/d/msgid/std-propo=
sals/23981304-bda2-4303-b5c6-c74481d5d2ba%40isocpp.org</a>.<br>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&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/CAANG%3DkWs3hG%3DiXhKEtSjBsZ2QR0vPC8W=
n-PTryJnRU3XyFWQ7w%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkWs3h=
G%3DiXhKEtSjBsZ2QR0vPC8Wn-PTryJnRU3XyFWQ7w%40mail.gmail.com</a>.<br />

--000000000000a700cf0577e38582--

.