Topic: out"-parameters in functions


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Fri, 7 Jun 2013 11:41:43 -0700 (PDT)
Raw View
------=_Part_917_13217414.1370630503706
Content-Type: text/plain; charset=ISO-8859-1

I just thought it can be beneficial to have "out" parameters in functions.
Instead of writing:


void Mult(*matrix<double>& c*, const matrix<double>& a, const
matrix<double>& b)
{
    std::size_t M = a.rows();
    std::size_t P = a.columns();
    std::size_t N = b.columns();

    *matrix<double> temp(M, N);*

    for (std::size_t i = 0; i < M; i++)
    {
        for (std::size_t j = 0; j < N; j++)
        {
            double sum = 0;
            for (std::size_t k = 0; k < P; k++)
            {
                sum += a(i,k)*b(k,j);
            }
            temp(i,j) = sum;
        }
    }
    *c = std::move(temp);*
}

We could write something like this:

void Mult(*matrix<double>? c*, const matrix<double>& a, const
matrix<double>& b)
{
    std::size_t M = a.rows();
    std::size_t P = a.columns();
    std::size_t N = b.columns();

    *c = matrix<double>(M, N);
*
    for (std::size_t i = 0; i < M; i++)
    {
        for (std::size_t j = 0; j < N; j++)
        {
            double sum = 0;
            for (std::size_t k = 0; k < P; k++)
            {
                sum += a(i,k)*b(k,j);
            }
            *c(i,j) = sum;
*        }
    }
}

and we could call it like this:
Mult(a,a,a);

With the usual features:
(1) ? parameters should be properly initialised (assigned a value) before
the return;
(2) a ? parameter in a header is treated the same as a reference parameter
(&).

Just a thought!





















--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_917_13217414.1370630503706
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>I just thought it can be beneficial to have "out" parameters in functi=
ons.</div><div>Instead of writing:</div><font color=3D"#0000ff" face=3D"Con=
solas" size=3D"2"><font color=3D"#0000ff" face=3D"Consolas" size=3D"2"><fon=
t color=3D"#0000ff" face=3D"Consolas" size=3D"2"><p>&nbsp;<div>void Mult(<s=
trong><font color=3D"#000000">matrix&lt;double&gt;&amp; c</font></strong>, =
const matrix&lt;double&gt;&amp; a, const matrix&lt;double&gt;&amp; b)<br>{<=
br>&nbsp;&nbsp;&nbsp; std::size_t M =3D a.rows();<br>&nbsp;&nbsp;&nbsp; std=
::size_t P =3D a.columns();<br>&nbsp;&nbsp;&nbsp; std::size_t N =3D b.colum=
ns();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; <strong><font color=3D"#=
000000">matrix&lt;double&gt; temp(M, N);</font></strong><br>&nbsp;&nbsp;&nb=
sp; <br>&nbsp;&nbsp;&nbsp; for (std::size_t i =3D 0; i &lt; M; i++)<br>&nbs=
p;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (std::si=
ze_t j =3D 0; j &lt; N; j++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dou=
ble sum =3D 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp; for (std::size_t k =3D 0; k &lt; P; k++)<br>&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum +=3D=
 a(i,k)*b(k,j);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; temp(i,j) =3D sum;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<=
br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <strong><font color=3D"#00000=
0">c =3D std::move(temp);</font></strong><br>}</div><div>&nbsp;</div><div><=
font color=3D"#000000" face=3D"arial,sans-serif">We could write something l=
ike this:</font></div><div><font color=3D"#000000"></font>&nbsp;</div><div>=
<div>void Mult(<strong><font color=3D"#cc0000">matrix&lt;double&gt;? c</fon=
t></strong>, const matrix&lt;double&gt;&amp; a, const matrix&lt;double&gt;&=
amp; b)<br>{<br>&nbsp;&nbsp;&nbsp; std::size_t M =3D a.rows();<br>&nbsp;&nb=
sp;&nbsp; std::size_t P =3D a.columns();<br>&nbsp;&nbsp;&nbsp; std::size_t =
N =3D b.columns();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; <strong><fo=
nt color=3D"#cc0000">c =3D matrix&lt;double&gt;(M, N);<br></font></strong>&=
nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; for (std::size_t i =3D 0; i &lt; M=
; i++)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; for (std::size_t j =3D 0; j &lt; N; j++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; double sum =3D 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; for (std::size_t k =3D 0; k &lt; P; k++)<br>&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp; sum +=3D a(i,k)*b(k,j);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; <strong><font color=3D"#cc0000">c(i,j) =3D sum;<br></=
font></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&=
nbsp; }&nbsp;&nbsp;&nbsp; <br>} </div><div>&nbsp;</div><div><font color=3D"=
#000000" face=3D"arial,sans-serif">and we could&nbsp;call it&nbsp;like this=
:</font></div><div><font color=3D"#0000ff">Mult(a,a,a);</font></div><div><f=
ont color=3D"#000000"></font>&nbsp;</div><div><font color=3D"#000000" face=
=3D"arial,sans-serif">With the usual features:</font></div><div><font color=
=3D"#000000" face=3D"arial,sans-serif">(1) ? parameters should be properly =
initialised (assigned&nbsp;a value)&nbsp;before the return;</font></div><di=
v><font color=3D"#000000" face=3D"arial,sans-serif">(2)&nbsp;a ? parameter =
in a header is treated the same as a reference parameter (&amp;).</font></d=
iv><div><font color=3D"#000000" face=3D"Arial"></font>&nbsp;</div><div><fon=
t color=3D"#000000" face=3D"arial,sans-serif">Just a thought!</font></div><=
div><font color=3D"#000000"></font>&nbsp;</div><div><font color=3D"#000000"=
></font>&nbsp;</div><div><font color=3D"#000000"></font>&nbsp;</div><div><f=
ont color=3D"#000000"></font>&nbsp;</div><div><font color=3D"#000000"></fon=
t>&nbsp;</div><div>&nbsp;</div></div><div><font color=3D"#000000"></font>&n=
bsp;</div><div>&nbsp;</div></font><div></div><p>&nbsp;</p></font><p>&nbsp;<=
/p></font><p>&nbsp;</p><font face=3D"Consolas" size=3D"2"><p>&nbsp;</p><fon=
t face=3D"Consolas" size=3D"2"><p>&nbsp;<p>&nbsp;</p></font></font>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_917_13217414.1370630503706--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Fri, 7 Jun 2013 13:48:43 -0500
Raw View
--047d7b33992db1a60904de94e3cc
Content-Type: text/plain; charset=ISO-8859-1

On 7 June 2013 13:41, Mikhail Semenov <mikhailsemenov1957@gmail.com> wrote:

> (1) ? parameters should be properly initialised (assigned a value) before
> the return;
>

They are still references; how can they not already be properly
initialized?  What if they don't have an assignment operator?  What about
other types of function exits (such as exceptions)?


> (2) a ? parameter in a header is treated the same as a reference parameter
> (&).
>

I don't see any difference between this and a reference, and certainly not
something that is going to require a major syntax change.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



--047d7b33992db1a60904de94e3cc
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 7 June 2013 13:41, Mikhail Semenov <span dir=3D"ltr">&lt;<a href=3D"mail=
to:mikhailsemenov1957@gmail.com" target=3D"_blank">mikhailsemenov1957@gmail=
..com</a>&gt;</span> wrote:<br><div class=3D"gmail_quote"><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">

<font color=3D"#0000ff" face=3D"Consolas"><font color=3D"#0000ff" face=3D"C=
onsolas"><font color=3D"#0000ff" face=3D"Consolas"><div><div><font color=3D=
"#000000" face=3D"arial,sans-serif">(1) ? parameters should be properly ini=
tialised (assigned=A0a value)=A0before the return;</font></div>

</div></font></font></font></blockquote><div><br>They are still references;=
 how can they not already be properly initialized?=A0 What if they don&#39;=
t have an assignment operator?=A0 What about other types of function exits =
(such as exceptions)?<br>

=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><font color=3D"#0000ff" face=3D"Con=
solas"><font color=3D"#0000ff" face=3D"Consolas"><font color=3D"#0000ff" fa=
ce=3D"Consolas"><div>

<div><font color=3D"#000000" face=3D"arial,sans-serif">(2)=A0a ? parameter =
in a header is treated the same as a reference parameter (&amp;).</font></d=
iv></div></font></font></font><span class=3D"HOEnZb"><font color=3D"#888888=
"></font></span></blockquote>

</div><br clear=3D"all">I don&#39;t see any difference between this and a r=
eference, and certainly not something that is going to require a major synt=
ax change.<br>-- <br>=A0Nevin &quot;:-)&quot; Liber=A0 &lt;mailto:<a href=
=3D"mailto:nevin@eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com=
</a>&gt;=A0 (847) 691-1404

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--047d7b33992db1a60904de94e3cc--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Fri, 7 Jun 2013 12:01:36 -0700 (PDT)
Raw View
------=_Part_535_26055184.1370631696520
Content-Type: text/plain; charset=ISO-8859-1


>They are still references; how can they not already be properly
initialized?  What if they don't have an assignment operator?  What about
>other types of function exits (such as exceptions)?

I meant: they should be initialised before used inside the function:
details can be discussed

>I don't see any difference between this and a reference, and certainly not
something that is going to require a major syntax change.
You mean: there is no point proposing such a small change. The point is
that we don't have to make an effort to write a function so that the call Mult(a,
a, a)  won't cause unexpected side effects. That's the main point.


--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_535_26055184.1370631696520
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div><br><font color=3D"#9900ff">&gt;They are still references; how can the=
y not already be properly initialized?&nbsp; What if they don't have an ass=
ignment operator?&nbsp; What about &gt;other types of function exits (such =
as exceptions)?</font></div><div>&nbsp;</div><font color=3D"#9900ff"><font =
color=3D"#000000">I meant: they should be initialised before used inside th=
e function: details can be discussed</font></font><font color=3D"#0000ff" f=
ace=3D"Consolas"><font color=3D"#0000ff" face=3D"Consolas"><div>&nbsp;</div=
><div><font color=3D"#9900ff" face=3D"arial,sans-serif">&gt;I don't see any=
 difference between this and a reference, and certainly not something that =
is going to require a major syntax change.<br></font></div></font><div><fon=
t color=3D"#000000" face=3D"arial,sans-serif">You mean: there is no point p=
roposing such a small change. The point is that we don't have to make an ef=
fort to write a function so that the call <font color=3D"#0000ff">Mult(a, a=
, a)</font>&nbsp; won't cause unexpected side effects. That's the main poin=
t.</font></div></font><div>&nbsp;</div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_535_26055184.1370631696520--

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Fri, 07 Jun 2013 21:13:04 +0200
Raw View
This is a multi-part message in MIME format.
--------------010109020600010109040703
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 07/06/13 20:41, Mikhail Semenov a =E9crit :
> I just thought it can be beneficial to have "out" parameters in functions=
..
> Instead of writing:
>
> void Mult(*matrix<double>& c*, const matrix<double>& a, const=20
> matrix<double>& b)
> {
>     std::size_t M =3D a.rows();
>     std::size_t P =3D a.columns();
>     std::size_t N =3D b.columns();
>
> *matrix<double> temp(M, N);*
>
>     for (std::size_t i =3D 0; i < M; i++)
>     {
>         for (std::size_t j =3D 0; j < N; j++)
>         {
>             double sum =3D 0;
>             for (std::size_t k =3D 0; k < P; k++)
>             {
>                 sum +=3D a(i,k)*b(k,j);
>             }
>             temp(i,j) =3D sum;
>         }
>     }
> *c =3D std::move(temp);*
> }
> We could write something like this:
> void Mult(*matrix<double>? c*, const matrix<double>& a, const=20
> matrix<double>& b)
We can already write
*matrix<double>& c* Mult(const matrix<double>& a, const matrix<double>& b);
>
> and we could call it like this:
> Mult(a,a,a);
and we can write
a =3D Mult(a,a);

> With the usual features:
> (1) ? parameters should be properly initialised (assigned a=20
> value) before the return;
The return forces its initialization, naturally.

Best,
Vicente

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/?hl=3Den.



--------------010109020600010109040703
Content-Type: text/html; charset=ISO-8859-1

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Le 07/06/13 20:41, Mikhail Semenov a
      &eacute;crit&nbsp;:<br>
    </div>
    <blockquote
      cite="mid:b3bc0bf4-f31c-4c40-b12d-e1cca24bff4e@isocpp.org"
      type="cite">
      <div>I just thought it can be beneficial to have "out" parameters
        in functions.</div>
      <div>Instead of writing:</div>
      <font color="#0000ff" face="Consolas" size="2"><font
          color="#0000ff" face="Consolas" size="2"><font color="#0000ff"
            face="Consolas" size="2">
            <p>&nbsp;</p>
            <div>void Mult(<strong><font color="#000000">matrix&lt;double&gt;&amp;
                  c</font></strong>, const matrix&lt;double&gt;&amp; a,
              const matrix&lt;double&gt;&amp; b)<br>
              {<br>
              &nbsp;&nbsp;&nbsp; std::size_t M = a.rows();<br>
              &nbsp;&nbsp;&nbsp; std::size_t P = a.columns();<br>
              &nbsp;&nbsp;&nbsp; std::size_t N = b.columns();<br>
              &nbsp;&nbsp;&nbsp; <br>
              &nbsp;&nbsp;&nbsp; <strong><font color="#000000">matrix&lt;double&gt;
                  temp(M, N);</font></strong><br>
              &nbsp;&nbsp;&nbsp; <br>
              &nbsp;&nbsp;&nbsp; for (std::size_t i = 0; i &lt; M; i++)<br>
              &nbsp;&nbsp;&nbsp; {<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (std::size_t j = 0; j &lt; N; j++)<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double sum = 0;<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (std::size_t k = 0; k &lt; P; k++)<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum += a(i,k)*b(k,j);<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp(i,j) = sum;<br>
              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
              &nbsp;&nbsp;&nbsp; }<br>
              &nbsp;&nbsp;&nbsp; <strong><font color="#000000">c = std::move(temp);</font></strong><br>
              }</div>
            <div>&nbsp;</div>
            <div><font color="#000000" face="arial,sans-serif">We could
                write something like this:</font></div>
            <div>&nbsp;</div>
            <div>
              <div>void Mult(<strong><font color="#cc0000">matrix&lt;double&gt;?
                    c</font></strong>, const matrix&lt;double&gt;&amp;
                a, const matrix&lt;double&gt;&amp; b)<br>
              </div>
            </div>
          </font></font></font></blockquote>
    <font color="#0000ff"><font size="2"><font face="Consolas">We can
          already write </font></font></font><br>
    <font color="#0000ff" face="Consolas" size="2"><font color="#0000ff"
        face="Consolas" size="2"><font color="#0000ff" face="Consolas"
          size="2"><font color="#0000ff" face="Consolas" size="2"><font
              color="#0000ff" face="Consolas" size="2"><font
                color="#0000ff" face="Consolas" size="2"><strong><font
                    color="#000000">matrix&lt;double&gt;&amp; c</font></strong>&nbsp;</font></font></font>
          Mult(const matrix&lt;double&gt;&amp; a, const
          matrix&lt;double&gt;&amp; b)</font></font></font>;
    <blockquote
      cite="mid:b3bc0bf4-f31c-4c40-b12d-e1cca24bff4e@isocpp.org"
      type="cite"><font color="#0000ff" face="Consolas" size="2"><font
          color="#0000ff" face="Consolas" size="2"><font color="#0000ff"
            face="Consolas" size="2">
            <div><br>
              <div>&nbsp;</div>
              <div><font color="#000000" face="arial,sans-serif">and we
                  could&nbsp;call it&nbsp;like this:</font></div>
              <div><font color="#0000ff">Mult(a,a,a);</font></div>
            </div>
          </font></font></font></blockquote>
    <font color="#0000ff"><font size="2"><font face="Consolas">and we
          can write </font></font></font><br>
    <font color="#0000ff" face="Consolas" size="2"><font color="#0000ff"
        face="Consolas" size="2"><font color="#0000ff" face="Consolas"
          size="2">
          <div>
            <div><font color="#0000ff">a = Mult(a,a);</font></div>
          </div>
        </font></font></font>
    <br>
    <blockquote
      cite="mid:b3bc0bf4-f31c-4c40-b12d-e1cca24bff4e@isocpp.org"
      type="cite"><font color="#0000ff" face="Consolas" size="2"><font
          color="#0000ff" face="Consolas" size="2"><font color="#0000ff"
            face="Consolas" size="2">
            <div>
              <div>&nbsp;</div>
              <div><font color="#000000" face="arial,sans-serif">With
                  the usual features:</font></div>
              <div><font color="#000000" face="arial,sans-serif">(1) ?
                  parameters should be properly initialised (assigned&nbsp;a
                  value)&nbsp;before the return;</font></div>
            </div>
          </font></font></font></blockquote>
    <font size="2"><font face="arial,sans-serif">The return forces its
        initialization, naturally.</font></font><br>
    <br>
    Best,<br>
    Vicente<br>
  </body>
</html>

<p></p>

-- <br />
&nbsp;<br />
--- <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 email to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en">http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en</a>.<br />
&nbsp;<br />
&nbsp;<br />

--------------010109020600010109040703--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Fri, 7 Jun 2013 14:16:29 -0500
Raw View
--001a11c1f4a20e0c5c04de954738
Content-Type: text/plain; charset=ISO-8859-1

On 7 June 2013 14:01, Mikhail Semenov <mikhailsemenov1957@gmail.com> wrote:

>
> >They are still references; how can they not already be properly
> initialized?  What if they don't have an assignment operator?  What about
> >other types of function exits (such as exceptions)?
>
> I meant: they should be initialised before used


References *by definition* are initialized to refer to a valid object
before they are used; it's one of their two fundamental properties (the
other being that they cannot be reseated).

inside the function:


So you can't even do:

void foo(A a, B? b)
{
    // if a isn't set, then just return
    if (!a)
        return;
}

Because b (or another reference to b inside foo) is not accessed by a non
const member function or as a non-const reference to a free function?


 >I don't see any difference between this and a reference, and certainly
> not something that is going to require a major syntax change.
> You mean: there is no point proposing such a small change.
>

You believe syntax changes are small??


> The point is that we don't have to make an effort to write a function so
> that the call Mult(a, a, a)  won't cause unexpected side effects. That's
> the main point.
>

Huh?  You still have aliasing, so if the callee modifies the contents of
*any* of its parameters, the side effect still happens.

Just return by value if you are that worried; it's a lot easier to reason
about.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



--001a11c1f4a20e0c5c04de954738
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 7 June 2013 14:01, Mikhail Semenov <span dir=3D"ltr">&lt;<a href=3D"mail=
to:mikhailsemenov1957@gmail.com" target=3D"_blank">mikhailsemenov1957@gmail=
..com</a>&gt;</span> wrote:<br><div class=3D"gmail_quote"><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">

<div class=3D"im"><div><br><font color=3D"#9900ff">&gt;They are still refer=
ences; how can they not already be properly initialized?=A0 What if they do=
n&#39;t have an assignment operator?=A0 What about &gt;other types of funct=
ion exits (such as exceptions)?</font></div>

<div>=A0</div></div><font color=3D"#9900ff"><font color=3D"#000000">I meant=
: they should be initialised before used</font></font></blockquote><div><br=
>References *by definition* are initialized to refer to a valid object befo=
re they are used; it&#39;s one of their two fundamental properties (the oth=
er being that they cannot be reseated).<br>

<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><font color=3D"#9900ff"><font colo=
r=3D"#000000"> inside the function:</font></font></blockquote><div><br>So y=
ou can&#39;t even do:<br>

<br>void foo(A a, B? b)<br>{<br>=A0=A0=A0 // if a isn&#39;t set, then just =
return<br>=A0=A0=A0 if (!a)<br>=A0=A0=A0=A0=A0=A0=A0 return;<br>}<br><br>Be=
cause b (or another reference to b inside foo) is not accessed by a non con=
st member function or as a non-const reference to a free function?<br>

=A0</div><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><font color=3D"#0000ff" face=3D=
"Consolas"><div class=3D"im"><font color=3D"#0000ff" face=3D"Consolas"><div=
>=A0<font color=3D"#9900ff" face=3D"arial,sans-serif">&gt;I don&#39;t see a=
ny difference between this and a reference, and certainly not something tha=
t is going to require a major syntax change.<br>

</font></div></font></div><div><font color=3D"#000000" face=3D"arial,sans-s=
erif">You mean: there is no point proposing such a small change. </font></d=
iv></font></blockquote><div><br>You believe syntax changes are small??<br>
=A0</div>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><font color=3D"#0000ff" face=3D"Consolas"><d=
iv><font color=3D"#000000" face=3D"arial,sans-serif">The point is that we d=
on&#39;t have to make an effort to write a function so that the call <font =
color=3D"#0000ff">Mult(a, a, a)</font>=A0 won&#39;t cause unexpected side e=
ffects. That&#39;s the main point.</font></div>

</font></blockquote><div><br>Huh?=A0 You still have aliasing, so if the cal=
lee modifies the contents of *any* of its parameters, the side effect still=
 happens.<br></div><div><br>Just return by value if you are that worried; i=
t&#39;s a lot easier to reason about.<br clear=3D"all">

</div></div>-- <br>=A0Nevin &quot;:-)&quot; Liber=A0 &lt;mailto:<a href=3D"=
mailto:nevin@eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com</a>=
&gt;=A0 (847) 691-1404

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--001a11c1f4a20e0c5c04de954738--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Fri, 7 Jun 2013 12:24:40 -0700 (PDT)
Raw View
------=_Part_562_3285506.1370633080195
Content-Type: text/plain; charset=ISO-8859-1

Vincente,

What if I've got several "?" parameters?

Mikhail.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_562_3285506.1370633080195
Content-Type: text/html; charset=ISO-8859-1

<div>Vincente, </div><div>&nbsp;</div><div>What if I've got several "?" parameters?</div><div>&nbsp;</div><div>Mikhail.<br>

</div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 email to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en">http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_562_3285506.1370633080195--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Fri, 7 Jun 2013 12:29:33 -0700 (PDT)
Raw View
------=_Part_513_24108004.1370633373453
Content-Type: text/plain; charset=ISO-8859-1

Nevin,


In your example:

void foo(A a, B? b)
{
    // if a isn't set, then just return
    if (!a)
        return;
}
the b value on exit will be the same as it was before (I didn't think
thoroughly about the details).
But if you start changing values, you must initialise it first.

Mikhail.





--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_513_24108004.1370633373453
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Nevin,</div><div>&nbsp;</div><div>&nbsp;</div><div>In your example:</d=
iv><div>&nbsp;</div><div><font color=3D"#9900ff" style=3D"background-color:=
 rgb(255, 255, 255);">void foo(A a, B? b)<br>{<br>&nbsp;&nbsp;&nbsp; // if =
a isn't set, then just return<br>&nbsp;&nbsp;&nbsp; if (!a)<br>&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>}<br></font></div><div>the b valu=
e on exit will be the same as it was before (I didn't think thoroughly abou=
t the details).</div><div>But if you start changing values, you must initia=
lise it first.</div><div>&nbsp;</div><div>Mikhail.</div><div>&nbsp;</div><d=
iv>&nbsp;</div><div><br>&nbsp;</div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_513_24108004.1370633373453--

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Fri, 07 Jun 2013 21:41:25 +0200
Raw View
Le 07/06/13 21:24, Mikhail Semenov a =E9crit :
> Vincente,
> What if I've got several "?" parameters?
You could return a tuple.

Vicente

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/?hl=3Den.



.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Fri, 7 Jun 2013 14:44:00 -0500
Raw View
--001a11c1f4a26c543804de95a968
Content-Type: text/plain; charset=ISO-8859-1

On 7 June 2013 14:29, Mikhail Semenov <mikhailsemenov1957@gmail.com> wrote:

> Nevin,
>
>
> In your example:
>
> void foo(A a, B? b)
> {
>     // if a isn't set, then just return
>     if (!a)
>         return;
> }
> the b value on exit will be the same as it was before (I didn't think
> thoroughly about the details).
> But if you start changing values, you must initialise it first.
>

*What* do you mean by "initialise"?  As I've said already, references must
already be initialized, and they must refer to (fundamental types
notwithstanding) an already initialized object.


Let's try a more concrete example:

void foo(std::string& a, std::string? b)
{
    if (a.empty())
        return;
}

Is that a legal function?
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



--001a11c1f4a26c543804de95a968
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 7 June 2013 14:29, Mikhail Semenov <span dir=3D"ltr">&lt;<a href=3D"mail=
to:mikhailsemenov1957@gmail.com" target=3D"_blank">mikhailsemenov1957@gmail=
..com</a>&gt;</span> wrote:<br><div class=3D"gmail_quote"><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">

<div>Nevin,</div><div>=A0</div><div>=A0</div><div>In your example:</div><di=
v class=3D"im"><div>=A0</div><div><font style color=3D"#9900ff">void foo(A =
a, B? b)<br>{<br>=A0=A0=A0 // if a isn&#39;t set, then just return<br>=A0=
=A0=A0 if (!a)<br>=A0=A0=A0=A0=A0=A0=A0 return;<br>

}<br></font></div></div><div>the b value on exit will be the same as it was=
 before (I didn&#39;t think thoroughly about the details).</div><div>But if=
 you start changing values, you must initialise it first.<br></div></blockq=
uote>

<div><br>*What* do you mean by &quot;initialise&quot;?=A0 As I&#39;ve said =
already, references must already be initialized, and they must refer to (fu=
ndamental types notwithstanding) an already initialized object.<br><br><br>

Let&#39;s try a more concrete example:<br><br>void foo(std::string&amp; a, =
std::string? b)<br>{<br>=A0=A0=A0 if (a.empty())<br>=A0=A0=A0=A0=A0=A0=A0 r=
eturn;<br>} <br><br>Is that a legal function?<br></div></div>-- <br>=A0Nevi=
n &quot;:-)&quot; Liber=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.=
com" target=3D"_blank">nevin@eviloverlord.com</a>&gt;=A0 (847) 691-1404

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--001a11c1f4a26c543804de95a968--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Fri, 7 Jun 2013 13:10:43 -0700 (PDT)
Raw View
------=_Part_728_6251877.1370635843694
Content-Type: text/plain; charset=ISO-8859-1

Nevin,

Yes, it is. I should you the equivalence between the two pieces of code.
OK, the issue is that if you start using b inside foo you *must *assign a
value (first idea)
to it first.
The point is that  inside the body of foo *b *refers to a different object
although with the same type.

There can two approaches here

(1) b is not changed inside foo (first idea);
(2) it is always set to an empty value (as if an empty constructor is used
and then at the end of the function
assigned to the actual parameter).

void foo(std::string& a, std::string? b)
{
    if (a.empty())
        return;
    b = a;
}

(1)  According the first approach this code is equivalent to

*void foo(std::string& a, std::string? b)
{
    if (a.empty())
        return;*
*    std::string b0 = a;*
*    b = std::move(b0);
}*

(2)  According the second approach this code is equivalent to

*void foo(std::string& a, std::string? b)
{*
*    std::string b0;*

*    if (a.empty())*
*    {*
*        b = std::move(b0); *
*        return;*
*    }*
**
*    b0 = a;*
*    b = std::move(b0);
}*

I prefer the first approach, where the first assignment actually means
using a constructor.








--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_728_6251877.1370635843694
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Nevin,</div><div>&nbsp;</div><div>Yes, it is. I should you the equival=
ence between the two pieces of code.</div><div>OK, the issue is that if you=
 start using b inside foo you <strong><em>must </em></strong>assign&nbsp;a =
value (first idea)</div><div>to it first. </div><div>The point is that&nbsp=
; inside the body of foo <strong>b </strong>refers to a different object al=
though with the same type.</div><div>&nbsp;</div><div>There can two approac=
hes here</div><div>&nbsp;</div><div>(1) b is not changed inside foo (first =
idea);</div><div>(2) it is always set to an empty value (as if an empty con=
structor is used and then at the end of the function</div><div>assigned to =
the actual parameter).</div><div>&nbsp;</div><div>void foo(std::string&amp;=
 a, std::string? b)<br>{<br>&nbsp;&nbsp;&nbsp; if (a.empty())<br>&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</div><div>&nbsp;&nbsp;&nbsp; b =3D=
 a;<br>} </div><div>&nbsp;</div><div>(1)&nbsp; According the first approach=
 this code is equivalent to</div><div>&nbsp;</div><div><div><font color=3D"=
#0000ff" face=3D"courier new,monospace" style=3D"background-color: rgb(255,=
 255, 255);"><strong><font color=3D"#0000ff">void foo(std::string&amp; a, s=
td::string? b)<br>{<br></font>&nbsp;&nbsp;&nbsp; <font color=3D"#0000ff">if=
 (a.empty())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</font></=
strong></font></div><div><font color=3D"#0000ff" face=3D"courier new,monosp=
ace" style=3D"background-color: rgb(255, 255, 255);"><strong>&nbsp;&nbsp;&n=
bsp; std::string b0 =3D a;</strong></font></div><div><font color=3D"#0000ff=
"><font face=3D"courier new,monospace"><strong><font color=3D"#0000ff" styl=
e=3D"background-color: rgb(255, 255, 255);">&nbsp;&nbsp;&nbsp; b =3D std::m=
ove(b0);<br>}</font></strong> </font></font></div><div>&nbsp;</div><div><di=
v>(2)&nbsp; According the&nbsp;second approach this code is equivalent to</=
div><div>&nbsp;</div><div><div><font color=3D"#000000" face=3D"courier new,=
monospace"><strong>void foo(std::string&amp; a, std::string? b)<br>{</stron=
g></font></div><div><font color=3D"#000000" face=3D"courier new,monospace">=
<strong>&nbsp;&nbsp;&nbsp;&nbsp;std::string b0;</strong></font></div><div><=
br><font color=3D"#000000" face=3D"courier new,monospace"><strong>&nbsp;&nb=
sp;&nbsp; if (a.empty())</strong></font></div><div><font color=3D"#000000" =
face=3D"courier new,monospace"><strong>&nbsp;&nbsp;&nbsp; {</strong></font>=
</div><div><font color=3D"#000000" face=3D"courier new,monospace"><strong>&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b =3D std::move(b0);&nbsp;</stron=
g></font></div><div><font color=3D"#000000" face=3D"courier new,monospace">=
<strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;</strong></font><=
/div><div><font color=3D"#000000" face=3D"courier new,monospace"><strong>&n=
bsp;&nbsp;&nbsp;&nbsp;}</strong></font></div><div><font color=3D"#000000" f=
ace=3D"courier new,monospace"><strong></strong></font>&nbsp;</div><div><fon=
t color=3D"#000000" face=3D"courier new,monospace"><strong>&nbsp;&nbsp;&nbs=
p; b0 =3D a;</strong></font></div><div><font color=3D"#0000ff" face=3D"cour=
ier new,monospace"><strong><font color=3D"#000000">&nbsp;&nbsp;&nbsp; b =3D=
 std::move(b0);<br>}</font></strong> </font></div><div>&nbsp;</div><div><fo=
nt face=3D"arial,sans-serif">I prefer the first approach, where the first a=
ssignment actually means using a constructor.</font></div><div>&nbsp;</div>=
</div></div><div>&nbsp;</div></div><div><br>&nbsp;</div><div>&nbsp;</div><d=
iv>&nbsp;</div><div>&nbsp;</div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_728_6251877.1370635843694--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Fri, 7 Jun 2013 15:42:39 -0500
Raw View
--001a11c2d3aa23b06904de967b2e
Content-Type: text/plain; charset=ISO-8859-1

On 7 June 2013 15:10, Mikhail Semenov <mikhailsemenov1957@gmail.com> wrote:

>
>

> OK, the issue is that if you start using b inside foo you *must *assign a
> value (first idea)
> to it first.
>

So now you are adding the requirement that the object be assignable.

(2) it is always set to an empty value (as if an empty constructor is used
> and then at the end of the function
> assigned to the actual parameter).
>

a)  You are now adding yet another requirement that this syntactic feature
is only useable with default constructible types.



>  void foo(std::string& a, std::string? b)
> {
>     if (a.empty())
>         return;
>     b = a;
> }
>
> (1)  According the first approach this code is equivalent to
>
> *void foo(std::string& a, std::string? b)
> {
>     if (a.empty())
>         return;*
> *    std::string b0 = a;*
> *    b = std::move(b0);
> }*
>

Not only must the object be assignable, it has to be MoveAssignable.  If
you really want that behavior, why not just return by value?  It is not
only easier to reason about, but it is likely to be more efficient, since
this has all of the disadvantages and none of the advantages of passing b
in by reference.


>
> (2)  According the second approach this code is equivalent to
>
> *void foo(std::string& a, std::string? b)
> {*
> *    std::string b0;*
>
> *    if (a.empty())*
> *    {*
> *        b = std::move(b0); *
> *        return;*
> *    }*
> **
> *    b0 = a;*
> *    b = std::move(b0);
> }*
>

What if the move constructor throws (which can happen in general, even if
it cannot for std::string)?

Construction creates an object; assignment mutates an already existing
object.  Combining these separate concerns into one syntactical feature is
a bad idea.  People already get confused between:

S s(t);
S s{t};
S s = t;

We do not need more of this.


This sounds very, very complicated for a language feature, for little to no
benefit.  -1.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



--001a11c2d3aa23b06904de967b2e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 7 June 2013 15:10, Mikhail Semenov <span dir=3D"ltr">&lt;<a href=3D"mail=
to:mikhailsemenov1957@gmail.com" target=3D"_blank">mikhailsemenov1957@gmail=
..com</a>&gt;</span> wrote:<br><div class=3D"gmail_quote"><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">

<br></blockquote><div>=A0</div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>OK, the =
issue is that if you start using b inside foo you <b><i>must </i></b>assign=
=A0a value (first idea)</div>

<div>to it first. </div></blockquote><div><br>So now you are adding the req=
uirement that the object be assignable.<br></div><br><blockquote class=3D"g=
mail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-l=
eft:1ex">

<div>(2) it is always set to an empty value (as if an empty constructor is =
used and then at the end of the function</div><div>assigned to the actual p=
arameter).</div></blockquote><div><br>a)=A0 You are now adding yet another =
requirement that this syntactic feature is only useable with default constr=
uctible types.<br>

<br>=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div class=3D"im"><div>=A0void =
foo(std::string&amp; a, std::string? b)<br>{<br>=A0=A0=A0 if (a.empty())<br=
>=A0=A0=A0=A0=A0=A0=A0 return;</div>

</div><div>=A0=A0=A0 b =3D a;<br>} </div><div>=A0</div><div>(1)=A0 Accordin=
g the first approach this code is equivalent to</div><div>=A0</div><div><di=
v class=3D"im"><div><font style color=3D"#0000ff" face=3D"courier new,monos=
pace"><b><font color=3D"#0000ff">void foo(std::string&amp; a, std::string? =
b)<br>

{<br></font>=A0=A0=A0 <font color=3D"#0000ff">if (a.empty())<br>=A0=A0=A0=
=A0=A0=A0=A0 return;</font></b></font></div></div><div><font style color=3D=
"#0000ff" face=3D"courier new,monospace"><b>=A0=A0=A0 std::string b0 =3D a;=
</b></font></div><div><font color=3D"#0000ff"><font face=3D"courier new,mon=
ospace"><b><font style color=3D"#0000ff">=A0=A0=A0 b =3D std::move(b0);<br>

}</font></b></font></font></div></div></blockquote><div><br>Not only must t=
he object be assignable, it has to be MoveAssignable.=A0 If you really want=
 that behavior, why not just return by value?=A0 It is not only easier to r=
eason about, but it is likely to be more efficient, since this has all of t=
he disadvantages and none of the advantages of passing b in by reference.<b=
r>

=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div><div><font color=3D"#0000ff"><=
font face=3D"courier new,monospace"> </font></font></div><div>=A0</div><div=
><div>(2)=A0 According the=A0second approach this code is equivalent to</di=
v>

<div>=A0</div><div><div class=3D"im"><div><font color=3D"#000000" face=3D"c=
ourier new,monospace"><b>void foo(std::string&amp; a, std::string? b)<br>{<=
/b></font></div></div><div><font color=3D"#000000" face=3D"courier new,mono=
space"><b>=A0=A0=A0=A0std::string b0;</b></font></div>

<div><br><font color=3D"#000000" face=3D"courier new,monospace"><b>=A0=A0=
=A0 if (a.empty())</b></font></div><div><font color=3D"#000000" face=3D"cou=
rier new,monospace"><b>=A0=A0=A0 {</b></font></div><div><font color=3D"#000=
000" face=3D"courier new,monospace"><b>=A0=A0=A0=A0=A0=A0=A0 b =3D std::mov=
e(b0);=A0</b></font></div>

<div><font color=3D"#000000" face=3D"courier new,monospace"><b>=A0=A0=A0=A0=
=A0=A0=A0 return;</b></font></div><div><font color=3D"#000000" face=3D"cour=
ier new,monospace"><b>=A0=A0=A0=A0}</b></font></div><div><font color=3D"#00=
0000" face=3D"courier new,monospace"><b></b></font>=A0</div>

<div><font color=3D"#000000" face=3D"courier new,monospace"><b>=A0=A0=A0 b0=
 =3D a;</b></font></div><div><font color=3D"#0000ff" face=3D"courier new,mo=
nospace"><b><font color=3D"#000000">=A0=A0=A0 b =3D std::move(b0);<br>}</fo=
nt></b></font></div></div>

</div></div></blockquote><div><br>What if the move constructor throws (whic=
h can happen in general, even if it cannot for std::string)?<br><br>Constru=
ction creates an object; assignment mutates an already existing object.=A0 =
Combining these separate concerns into one syntactical feature is a bad ide=
a.=A0 People already get confused between:<br>

<br>S s(t);<br>S s{t};<br>S s =3D t;<br><br>We do not need more of this.<br=
><br><br>This sounds very, very complicated for a language feature, for lit=
tle to no benefit.=A0 -1.<br></div></div>-- <br>=A0Nevin &quot;:-)&quot; Li=
ber=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=3D"_blan=
k">nevin@eviloverlord.com</a>&gt;=A0 (847) 691-1404

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--001a11c2d3aa23b06904de967b2e--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Fri, 7 Jun 2013 14:34:37 -0700 (PDT)
Raw View
------=_Part_599_27267020.1370640877702
Content-Type: text/plain; charset=ISO-8859-1

I've issued your verdict.

My point is: why write more code? Other languages have "out " parameters.

>What if the move constructor throws (which can happen in general, even if
it cannot for std::string)?

Move is based on swap and should not throw, unless written ugly, but if it
does there is always an explanation.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_599_27267020.1370640877702
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>I've issued your verdict. </div><div>&nbsp;</div><div>My point is: why=
 write more code? Other languages have "out " parameters.</div><div>&nbsp;<=
/div><div>&gt;<font color=3D"#9900ff">What if the move constructor throws (=
which can happen in general, even if it cannot for std::string)?</font></di=
v><div><font color=3D"#000000"></font>&nbsp;</div><div><font color=3D"#0000=
00">Move is based on swap and should not throw, unless written ugly, but if=
 it does there is always an explanation.</font></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_599_27267020.1370640877702--

.


Author: DeadMG <wolfeinstein@gmail.com>
Date: Sat, 8 Jun 2013 05:41:42 -0700 (PDT)
Raw View
------=_Part_2100_6063836.1370695302535
Content-Type: text/plain; charset=ISO-8859-1

Other languages have out parameters because they are bad. Out parameters
are something you should design your language to never need, not something
you should design your language to explicitly support.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_2100_6063836.1370695302535
Content-Type: text/html; charset=ISO-8859-1

Other languages have out parameters because they are bad. Out parameters are something you should design your language to never need, not something you should design your language to explicitly support.

<p></p>

-- <br />
&nbsp;<br />
--- <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 email to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en">http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_2100_6063836.1370695302535--

.


Author: Jonathan Wakely <cxx@kayari.org>
Date: Tue, 11 Jun 2013 08:26:35 -0700 (PDT)
Raw View
------=_Part_188_14379007.1370964395767
Content-Type: text/plain; charset=ISO-8859-1



On Friday, June 7, 2013 8:29:33 PM UTC+1, Mikhail Semenov wrote:
>
>  (I didn't think thoroughly about the details).
>

Great, another whacky idea.

How would your new type interact with the existing type system? How will it
interact with reference collapsing? Can it be deduced? Will a T&& parameter
deduce U? as a type?

C++ is a very complicated language, the way to improve it is not via
throwaway ideas like 'I just thought it can be beneficial to have "out"
parameters in functions.'


--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



------=_Part_188_14379007.1370964395767
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br>On Friday, June 7, 2013 8:29:33 PM UTC+1, Mikhail Semenov wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border=
-left: 1px #ccc solid;padding-left: 1ex;"><div>&nbsp;(I didn't think thorou=
ghly about the details).</div></blockquote><div><br>Great, another whacky i=
dea.<br><br>How would your new type interact with the existing type system?=
 How will it interact with reference collapsing? Can it be deduced? Will a =
T&amp;&amp; parameter deduce U? as a type?<br><br>C++ is a very complicated=
 language, the way to improve it is not via throwaway ideas like 'I just th=
ought it can be beneficial to have "out" parameters in functions.'</div><br=
><br>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_188_14379007.1370964395767--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Tue, 11 Jun 2013 17:26:17 +0100
Raw View
--047d7b3a983252fb4f04dee35bb9
Content-Type: text/plain; charset=ISO-8859-1

*>>How would your new type interact with the existing type system? How will
it interact with reference >>collapsing? Can it be deduced? Will a T&&
parameter deduce U? as a type?*

You might have listened to what I said: the T& and T? are equaivalent in
the headers,
it the same principle as with *const int*  and *int. *You cannot have two
overloaded functions, which are only different
in T? and T& in the headers.

As a result, for example, the headers f(T& x); and f(T? x); would be
treated the same in the include file.

The same as it is ow with f(const int i); and f(int i);

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



--047d7b3a983252fb4f04dee35bb9
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div><strong><font color=3D"#3333ff">&gt;&gt;How would your new type intera=
ct with the existing type system? How will it interact with reference &gt;&=
gt;collapsing? Can it be deduced? Will a T&amp;&amp; parameter deduce U? as=
 a type?</font></strong></div>

<div>=A0</div>
<div>You might have listened to what I said: the T&amp; and T? are equaival=
ent in the headers,</div>
<div>it the same principle as with <strong>const int</strong>=A0 and <stron=
g>int. </strong>You cannot have two overloaded functions, which are only di=
fferent</div>
<div>in=A0T? and T&amp; in the headers.</div>
<div>=A0</div>
<div>As a result, for example, the headers f(T&amp; x); and f(T? x); would =
be treated the same in the include file.</div>
<div>=A0</div>
<div>The same as it is ow with f(const int i); and f(int i);</div>
<div>=A0</div>
<div>=A0</div>
<div>=A0</div>
<div>=A0</div>
<div>=A0</div>
<div>=A0</div>
<div><br><br>=A0</div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--047d7b3a983252fb4f04dee35bb9--

.


Author: =?UTF-8?Q?R=C3=B3bert_D=C3=A1vid?= <lrdxgm@gmail.com>
Date: Sun, 9 Jun 2013 08:13:26 -0700 (PDT)
Raw View
------=_Part_108_22794973.1370790806982
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable

2013. j=FAnius 7., p=E9ntek 23:34:37 UTC+2 id=F5pontban Mikhail Semenov a=
=20
k=F6vetkez=F5t =EDrta:

> Other languages have "out " parameters.
>
Those "other languages" have 'out' parameters, because they have reference=
=20
semantics. You don't pass a value in those languages, rather you pass a=20
reference (just like you do in C++ with &), and you can change the state of=
=20
those objects through the reference. The notation of out parameters is to=
=20
maintain some sanity about what is "moral" to be done with the parameters.

Basically if you make your function signature as foo(stuff&), you know=20
stuff is an out parameter - the language also helps, as (with a conforming=
=20
compiler) you can't even bind a temporary to it.

But I also think this is poor style, if the result object is (conceptually)=
=20
temporary at the caller side, you will have a bad time optimizing stuff=20
around what the compiler would give you free, had you returned it.. There=
=20
is nothing wrong with returning objects (tuples, named structs), it's not=
=20
C++03 any more, returns of even big objects by value is practically free=20
(if they are movable, what is almost always true).

Move is based on swap.

??? Maybe in C++03.. You should not swap anything with (conceptual or=20
actual) temporaries, that will delay freeing up the otherwise unused memory=
..

Regards, Robert

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/?hl=3Den.



------=_Part_108_22794973.1370790806982
Content-Type: text/html; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable

2013. j=FAnius 7., p=E9ntek 23:34:37 UTC+2 id=F5pontban Mikhail Semenov a k=
=F6vetkez=F5t =EDrta:<br><div></div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;"><div> Other languages have "out " parameters.</div></blockquote><div>=
Those
 "other languages" have 'out' parameters, because they have=20
reference semantics. You don't pass a value in those languages, rather=20
you pass a reference (just like you do in C++ with &amp;), and you can=20
change the state of those objects through the reference. The notation of
 out parameters is to maintain some sanity about what is "moral" to be=20
done with the parameters.<br><div><br>Basically if you make your function=
=20
signature as foo(stuff&amp;), you know stuff is an out parameter - the=20
language also helps, as (with a conforming compiler) you can't even bind
 a temporary to it.<br><br>But I also think this is poor style, if the=20
result object is (conceptually) temporary at the caller side, you will=20
have a bad time optimizing stuff around what the compiler would give you
 free, had you returned it.. There is nothing wrong with returning=20
objects (tuples, named structs), it's not C++03 any more, returns of=20
even big objects by value is practically free (if they are movable, what
 is almost always true).<br><br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left=
: 1ex;"><font color=3D"#000000">Move is based on swap.</font></blockquote><=
div>??? Maybe in C++03.. You should not swap anything with (conceptual or a=
ctual) temporaries, that will delay freeing up the otherwise unused memory.=
<br><br>Regards, Robert<br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_108_22794973.1370790806982--

.


Author: Mikhail Semenov <mikhailsemenov1957@gmail.com>
Date: Wed, 12 Jun 2013 08:55:08 +0100
Raw View
--001a11c330ec23ad6604def055c6
Content-Type: text/plain; charset=ISO-8859-1

> There is nothing wrong with returning objects (tuples, named structs),
it's not C++03 any more, returns of even big
> objects by value is practically free (if they are movable, what is almost
always true).

I have to put them into a tuple and then take them out of the tuple: how
long will it take!?

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/?hl=en.



--001a11c330ec23ad6604def055c6
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div><font color=3D"#339999">&gt;=A0There is nothing wrong with returning o=
bjects (tuples, named structs), it&#39;s not C++03 any more, returns of eve=
n big </font></div>
<div><font color=3D"#339999">&gt; objects by value is practically free (if =
they are movable, what is almost always true).<br></font><br>I have to put =
them into a tuple and then take them out of the tuple: how long will it tak=
e!?</div>

<div>=A0</div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

--001a11c330ec23ad6604def055c6--

.


Author: =?UTF-8?Q?R=C3=B3bert_D=C3=A1vid?= <lrdxgm@gmail.com>
Date: Wed, 12 Jun 2013 02:47:58 -0700 (PDT)
Raw View
------=_Part_4708_10056124.1371030478574
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable



2013. j=FAnius 12., szerda 9:55:08 UTC+2 id=F5pontban Mikhail Semenov a=20
k=F6vetkez=F5t =EDrta:
>
> > There is nothing wrong with returning objects (tuples, named structs),=
=20
> it's not C++03 any more, returns of even big=20
> > objects by value is practically free (if they are movable, what is=20
> almost always true).
>
> I have to put them into a tuple and then take them out of the tuple: how=
=20
> long will it take!?
> =20
>

Putting them in: exactly the same as creating the two objects. (Or=20
assigning if you use std::tie)
Taking them out: Why? Just use them from the tuple (bind a reference to the=
=20
parts if you want to refer them with a name - or if you used std::tie then=
=20
you have them already).
This is even true in C++03 as well when RVO and copy elision works, only=20
tuple didn't exist in the standard library (but pair did).

Regards, Robert

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/?hl=3Den.



------=_Part_4708_10056124.1371030478574
Content-Type: text/html; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable

<br><br>2013. j=FAnius 12., szerda 9:55:08 UTC+2 id=F5pontban Mikhail Semen=
ov a k=F6vetkez=F5t =EDrta:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v><font color=3D"#339999">&gt;&nbsp;There is nothing wrong with returning o=
bjects (tuples, named structs), it's not C++03 any more, returns of even bi=
g </font></div>
<div><font color=3D"#339999">&gt; objects by value is practically free (if =
they are movable, what is almost always true).<br></font><br>I have to put =
them into a tuple and then take them out of the tuple: how long will it tak=
e!?</div>

<div>&nbsp;</div></blockquote><div><br>Putting them in: exactly the same as=
 creating the two objects. (Or assigning if you use std::tie)<br>Taking the=
m out: Why? Just use them from the tuple (bind a reference to the parts if =
you want to refer them with a name - or if you used std::tie then you have =
them already).<br>This is even true in C++03 as well when RVO and copy elis=
ion works, only tuple didn't exist in the standard library (but pair did).<=
br><br>Regards, Robert<br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/?hl=3Den">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/?hl=3Den</a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_4708_10056124.1371030478574--

.


Author: Sean Middleditch <sean.middleditch@gmail.com>
Date: Sat, 22 Jun 2013 13:21:37 -0700 (PDT)
Raw View
------=_Part_1283_22871499.1371932497317
Content-Type: text/plain; charset=ISO-8859-1

Not supporting the idea explicitly as I agree with "DeadMG" on this to a
degree (especially for any function taking more than a single parameter).
In response to some of the concerns raised, I'd say that if this feature
goes any further to first look at C#'s version.

Namely, there are two important points.  First, the use of an out
parameters only requires (weakly) assignment by regular (non-exceptional)
function exit.  The key point being that for types with trivial default
constructors, a new value is assigned to the out parameter before regular
return.  Types with non-trivial default constructors will be of course be
valid before the function is even called, but trivial types might be
garbage before the function (say, an int or raw pointer).  Enforcing this
at a language level is non-feasible I think but it's something that
compilers can optionally implement as a warning as they already do with
uninitialized values or returning a reference to a local value.  This is a
minor point; foregoing this feature entirely makes sense; the second point
is far more important.

The second point which is of significantly more importance is the
self-documenting nature of C#'s approach.  Not only must the function be
declared as taking an out parameter but the caller must explicitly
acknowledge this fact!

  // interface declaration
  void foo(out void* ptr);

  // client code
  void* p;
  foo(out p);

This is super handy for reviewing and maintaining client code using
interfaces with out parameters.  There is a rather significant base of
users who explicitly use pointers for out parameters rather than references
just so that the client code has the & in it giving at least some small
indication that the parameter might be an out/inout parameter.  Using new
keywords/syntax to explicitly mark that a parameter is an out parameter is
a significant improvement for readability than what we have now.  When
reading code using unfamiliar or excessively large interfaces, this is
really useful.

I've experimented with (though I've yet to make a real conclusion on the
merit of) using a special reference wrapper type called "out" to handle
this.  Syntax mostly similar to the following is possible with a pure
library approach, which is probably better than any new language syntax:

  using std::out;

  void foo(out<void*> ptr);

  void* p;
  foo(out(p));

That exact syntax is currently impossible of course; out(p) would need to
be out<decltype(p)>(p), but I can't bring myself to suggest a make_out
function wrapper (I can already hear the classroom giggles) or to make the
out type name something long and C++-stdlib-like such as
out_reference_wrapper or something else so obtuse as to guarantee it's
never actually used in the wild when it should be.  I vaguely recall a
proposal that would allow template type deduction from constructor
parameters which would maybe fix this; unsure what the specifics or status
of that are.

On Friday, June 7, 2013 11:41:43 AM UTC-7, Mikhail Semenov wrote:
>
> I just thought it can be beneficial to have "out" parameters in functions.
> Instead of writing:
>
>
> void Mult(*matrix<double>& c*, const matrix<double>& a, const
> matrix<double>& b)
> {
>     std::size_t M = a.rows();
>     std::size_t P = a.columns();
>     std::size_t N = b.columns();
>
>     *matrix<double> temp(M, N);*
>
>     for (std::size_t i = 0; i < M; i++)
>     {
>         for (std::size_t j = 0; j < N; j++)
>         {
>             double sum = 0;
>             for (std::size_t k = 0; k < P; k++)
>             {
>                 sum += a(i,k)*b(k,j);
>             }
>             temp(i,j) = sum;
>         }
>     }
>     *c = std::move(temp);*
> }
>
> We could write something like this:
>
> void Mult(*matrix<double>? c*, const matrix<double>& a, const
> matrix<double>& b)
> {
>     std::size_t M = a.rows();
>     std::size_t P = a.columns();
>     std::size_t N = b.columns();
>
>     *c = matrix<double>(M, N);
> *
>     for (std::size_t i = 0; i < M; i++)
>     {
>         for (std::size_t j = 0; j < N; j++)
>         {
>             double sum = 0;
>             for (std::size_t k = 0; k < P; k++)
>             {
>                 sum += a(i,k)*b(k,j);
>             }
>             *c(i,j) = sum;
> *        }
>     }
> }
>
> and we could call it like this:
> Mult(a,a,a);
>
> With the usual features:
> (1) ? parameters should be properly initialised (assigned a value) before
> the return;
> (2) a ? parameter in a header is treated the same as a reference parameter
> (&).
>
> Just a thought!
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.



------=_Part_1283_22871499.1371932497317
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Not supporting the idea explicitly as I agree with "DeadMG" on this to a de=
gree (especially for any function taking more than a single parameter). In =
response to some of the concerns raised, I'd say that if this feature goes =
any further to first look at C#'s version.<div><br></div><div>Namely, there=
 are two important points. &nbsp;First, the use of an out parameters only r=
equires (weakly) assignment by regular (non-exceptional) function exit. &nb=
sp;The key point being that for types with trivial default constructors, a =
new value is assigned to the out parameter before regular return. &nbsp;Typ=
es with non-trivial default constructors will be of course be valid before =
the function is even called, but trivial types might be garbage before the =
function (say, an int or raw pointer). &nbsp;Enforcing this at a language l=
evel is non-feasible I think but it's something that compilers can optional=
ly implement as a warning as they already do with uninitialized values or r=
eturning a reference to a local value. &nbsp;This is a minor point; foregoi=
ng this feature entirely makes sense; the second point is far more importan=
t.</div><div><br></div><div>The second point which is of significantly more=
 importance is the self-documenting nature of C#'s approach. &nbsp;Not only=
 must the function be declared as taking an out parameter but the caller mu=
st explicitly acknowledge this fact!</div><div><br></div><div>&nbsp; // int=
erface declaration</div><div>&nbsp; void foo(out void* ptr);</div><div><br>=
</div><div>&nbsp; // client code</div><div>&nbsp; void* p;</div><div>&nbsp;=
 foo(out p);</div><div><br></div><div>This is super handy for reviewing and=
 maintaining client code using interfaces with out parameters. &nbsp;There =
is a rather significant base of users who explicitly use pointers for out p=
arameters rather than references just so that the client code has the &amp;=
 in it giving at least some small indication that the parameter might be an=
 out/inout parameter. &nbsp;Using new keywords/syntax to explicitly mark th=
at a parameter is an out parameter is a significant improvement for readabi=
lity than what we have now. &nbsp;When reading code using unfamiliar or exc=
essively large interfaces, this is really useful.</div><div><br></div><div>=
I've experimented with (though I've yet to make a real conclusion on the me=
rit of) using a special reference wrapper type called "out" to handle this.=
 &nbsp;Syntax mostly similar to the following is possible with a pure libra=
ry approach, which is probably better than any new language syntax:</div><d=
iv><br></div><div>&nbsp; using std::out;</div><div><br></div><div>&nbsp; vo=
id foo(out&lt;void*&gt; ptr);<br></div><div><br></div><div>&nbsp; void* p;<=
/div><div>&nbsp; foo(out(p));</div><div><br></div><div>That exact syntax is=
 currently impossible of course; out(p) would need to be out&lt;decltype(p)=
&gt;(p), but I can't bring myself to suggest a make_out function wrapper (I=
 can already hear the classroom giggles) or to make the out type name somet=
hing long and C++-stdlib-like such as out_reference_wrapper or something el=
se so obtuse as to guarantee it's never actually used in the wild when it s=
hould be. &nbsp;I vaguely recall a proposal that would allow template type =
deduction from constructor parameters which would maybe fix this; unsure wh=
at the specifics or status of that are.</div><div><br></div><div>On Friday,=
 June 7, 2013 11:41:43 AM UTC-7, Mikhail Semenov wrote:<blockquote class=3D=
"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc s=
olid;padding-left: 1ex;"><div>I just thought it can be beneficial to have "=
out" parameters in functions.</div><div>Instead of writing:</div><font colo=
r=3D"#0000ff" face=3D"Consolas" size=3D"2"><font color=3D"#0000ff" face=3D"=
Consolas" size=3D"2"><font color=3D"#0000ff" face=3D"Consolas" size=3D"2"><=
p>&nbsp;</p><div>void Mult(<strong><font color=3D"#000000">matrix&lt;double=
&gt;&amp; c</font></strong>, const matrix&lt;double&gt;&amp; a, const matri=
x&lt;double&gt;&amp; b)<br>{<br>&nbsp;&nbsp;&nbsp; std::size_t M =3D a.rows=
();<br>&nbsp;&nbsp;&nbsp; std::size_t P =3D a.columns();<br>&nbsp;&nbsp;&nb=
sp; std::size_t N =3D b.columns();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&n=
bsp; <strong><font color=3D"#000000">matrix&lt;double&gt; temp(M, N);</font=
></strong><br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; for (std::size_t i =
=3D 0; i &lt; M; i++)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp; for (std::size_t j =3D 0; j &lt; N; j++)<br>&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp; double sum =3D 0;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (std::size_t k =3D 0; k &lt; P; =
k++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp; sum +=3D a(i,k)*b(k,j);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; temp(i,j) =3D sum;<br>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; =
<strong><font color=3D"#000000">c =3D std::move(temp);</font></strong><br>}=
</div><div>&nbsp;</div><div><font color=3D"#000000" face=3D"arial,sans-seri=
f">We could write something like this:</font></div><div><font color=3D"#000=
000"></font>&nbsp;</div><div><div>void Mult(<strong><font color=3D"#cc0000"=
>matrix&lt;double&gt;? c</font></strong>, const matrix&lt;double&gt;&amp; a=
, const matrix&lt;double&gt;&amp; b)<br>{<br>&nbsp;&nbsp;&nbsp; std::size_t=
 M =3D a.rows();<br>&nbsp;&nbsp;&nbsp; std::size_t P =3D a.columns();<br>&n=
bsp;&nbsp;&nbsp; std::size_t N =3D b.columns();<br>&nbsp;&nbsp;&nbsp; <br>&=
nbsp;&nbsp;&nbsp; <strong><font color=3D"#cc0000">c =3D matrix&lt;double&gt=
;(M, N);<br></font></strong>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; for (=
std::size_t i =3D 0; i &lt; M; i++)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (std::size_t j =3D 0; j &lt; N; j++)<br>=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; double sum =3D 0;<br>&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (std::size_t k =3D=
 0; k &lt; P; k++)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sum +=3D a(i,k)*b(k,j);<br>&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><font color=3D"#=
cc0000">c(i,j) =3D sum;<br></font></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp; <br>} </div><div>&nb=
sp;</div><div><font color=3D"#000000" face=3D"arial,sans-serif">and we coul=
d&nbsp;call it&nbsp;like this:</font></div><div><font color=3D"#0000ff">Mul=
t(a,a,a);</font></div><div><font color=3D"#000000"></font>&nbsp;</div><div>=
<font color=3D"#000000" face=3D"arial,sans-serif">With the usual features:<=
/font></div><div><font color=3D"#000000" face=3D"arial,sans-serif">(1) ? pa=
rameters should be properly initialised (assigned&nbsp;a value)&nbsp;before=
 the return;</font></div><div><font color=3D"#000000" face=3D"arial,sans-se=
rif">(2)&nbsp;a ? parameter in a header is treated the same as a reference =
parameter (&amp;).</font></div><div><font color=3D"#000000" face=3D"Arial">=
</font>&nbsp;</div><div><font color=3D"#000000" face=3D"arial,sans-serif">J=
ust a thought!</font></div><div><font color=3D"#000000"></font>&nbsp;</div>=
<div><font color=3D"#000000"></font>&nbsp;</div><div><font color=3D"#000000=
"></font>&nbsp;</div><div><font color=3D"#000000"></font>&nbsp;</div><div><=
font color=3D"#000000"></font>&nbsp;</div><div>&nbsp;</div></div><div><font=
 color=3D"#000000"></font>&nbsp;</div><div>&nbsp;</div><p></p></font><div><=
/div><p>&nbsp;</p></font><p>&nbsp;</p></font><p>&nbsp;</p><font face=3D"Con=
solas" size=3D"2"><p>&nbsp;</p><font face=3D"Consolas" size=3D"2"><p>&nbsp;=
</p><p>&nbsp;</p><p></p></font></font></blockquote></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_1283_22871499.1371932497317--

.


Author: Jonathan Wakely <cxx@kayari.org>
Date: Mon, 24 Jun 2013 03:32:39 -0700 (PDT)
Raw View
------=_Part_2721_28643956.1372069959703
Content-Type: text/plain; charset=ISO-8859-1

On Saturday, June 22, 2013 9:21:37 PM UTC+1, Sean Middleditch wrote:
>
> I vaguely recall a proposal that would allow template type deduction from
> constructor parameters which would maybe fix this; unsure what the
> specifics or status of that are.


That's N3601,
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3601.html

It won't be in C++14, but might be considered again for C++17.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.



------=_Part_2721_28643956.1372069959703
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Saturday, June 22, 2013 9:21:37 PM UTC+1, Sean Middleditch wrote:<blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;">I vaguely recall a proposal that woul=
d allow template type deduction from constructor parameters which would may=
be fix this; unsure what the specifics or status of that are.</blockquote><=
div><br>That's N3601, http://www.open-std.org/jtc1/sc22/wg21/docs/papers/20=
13/n3601.html<br><br>It won't be in C++14, but might be considered again fo=
r C++17.<div><br><blockquote class=3D"gmail_quote" style=3D"margin:0;margin=
-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div=
></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
&nbsp;<br />
&nbsp;<br />

------=_Part_2721_28643956.1372069959703--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 24 Jun 2013 13:52:26 +0300
Raw View
--001a11c348c24e56ae04dfe435c2
Content-Type: text/plain; charset=ISO-8859-1

On 24 June 2013 13:32, Jonathan Wakely <cxx@kayari.org> wrote:

> On Saturday, June 22, 2013 9:21:37 PM UTC+1, Sean Middleditch wrote:
>>
>> I vaguely recall a proposal that would allow template type deduction from
>> constructor parameters which would maybe fix this; unsure what the
>> specifics or status of that are.
>
>
> That's N3601,
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3601.html
>
> It won't be in C++14, but might be considered again for C++17.
>

I think it's N3602 (Template parameter deduction for constructors) instead,
http://open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3602.html

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.



--001a11c348c24e56ae04dfe435c2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 24 June 2013 13:32, Jonathan Wakely <span dir=3D"ltr">&lt;<a hre=
f=3D"mailto:cxx@kayari.org" target=3D"_blank">cxx@kayari.org</a>&gt;</span>=
 wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div class=3D"im">On Satu=
rday, June 22, 2013 9:21:37 PM UTC+1, Sean Middleditch wrote:<blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid=
 rgb(204,204,204);padding-left:1ex">
I vaguely recall a proposal that would allow template type deduction from c=
onstructor parameters which would maybe fix this; unsure what the specifics=
 or status of that are.</blockquote></div><div><br>That&#39;s N3601, <a hre=
f=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3601.html" ta=
rget=3D"_blank">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n36=
01.html</a><br>
<br>It won&#39;t be in C++14, but might be considered again for C++17.</div=
></blockquote><div><br></div><div>I think it&#39;s N3602 (Template paramete=
r deduction for constructors) instead, <br><a href=3D"http://open-std.org/J=
TC1/SC22/WG21/docs/papers/2013/n3602.html">http://open-std.org/JTC1/SC22/WG=
21/docs/papers/2013/n3602.html</a> <br>
<br><br></div></div><br></div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
&nbsp;<br />
&nbsp;<br />

--001a11c348c24e56ae04dfe435c2--

.