Topic: Status of enabling std::tie with non-default ctor objects
Author: Robert Jakob <rj@robertjakob.de>
Date: Fri, 8 Jul 2016 10:07:52 +0200
Raw View
Could someone pinpoint me to the status of
enabling the use of std::tie with non-default ctor objects as in the
following example?
struct foo
{
foo(int a) : a_(a) {}
int a_;
};
std::pair<bool, foo> my_function()
{
return { false, foo(1) };
};
foo my_foo; // Compiler errror, as no default ctor available
bool state;
std::tie<state, my_foo> = my_function();
I remember there were several proposals to tackle this problem somehow,
but couldn't find them.
Thanks,
r.
--
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/20160708100752.4af38d78%40jakobro-VirtualBox.
.
Author: Sergey Vidyuk <sir.vestnik@gmail.com>
Date: Fri, 8 Jul 2016 05:23:53 -0700 (PDT)
Raw View
------=_Part_5411_245300158.1467980633142
Content-Type: multipart/alternative;
boundary="----=_Part_5412_1932415719.1467980633142"
------=_Part_5412_1932415719.1467980633142
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 8 =D0=B8=D1=8E=D0=BB=D1=8F 2016=
=D0=B3., 14:07:55 UTC+6 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=
=D1=82=D0=B5=D0=BB=D1=8C Robert Jakob =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=
=D0=BB:
>
> Could someone pinpoint me to the status of=20
> enabling the use of std::tie with non-default ctor objects as in the=20
> following example?=20
>
> struct foo=20
> {=20
> foo(int a) : a_(a) {}=20
> int a_;=20
> };=20
>
> std::pair<bool, foo> my_function()=20
> {=20
> return { false, foo(1) };=20
> };=20
>
> foo my_foo; // Compiler errror, as no default ctor available=20
> bool state;=20
> std::tie<state, my_foo> =3D my_function();=20
>
> I remember there were several proposals to tackle this problem somehow,=
=20
> but couldn't find them.=20
>
> Thanks,=20
> r.=20
>
Structured binding:
auto [state, my_foo] =3D my_function();
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0217r2.html=20
included into C++17 draft on july committee meeting
Sergey=20
--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/6caa738a-2e27-47ba-84ee-e6b7f73f66b3%40isocpp.or=
g.
------=_Part_5412_1932415719.1467980633142
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 8 =D0=B8=D1=8E=
=D0=BB=D1=8F 2016 =D0=B3., 14:07:55 UTC+6 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=
=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Robert Jakob =D0=BD=D0=B0=D0=BF=D0=
=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Could so=
meone pinpoint me to the status of
<br>enabling the use of std::tie with non-default ctor objects as in the
<br>following example?
<br>
<br>struct foo
<br>{
<br>=C2=A0 foo(int a) : a_(a) {}
<br>=C2=A0 int a_;
<br>};
<br>
<br>std::pair<bool, foo> my_function()
<br>{
<br>=C2=A0 return { false, foo(1) };
<br>};
<br>
<br>foo my_foo; // Compiler errror, as no default ctor available
<br>bool state;
<br>std::tie<state, my_foo> =3D my_function();
<br>
<br>I remember there were several proposals to tackle this problem somehow,
<br>but couldn't find them.
<br>
<br>Thanks,
<br>r.
<br></blockquote><div><br>Structured binding:<br><div class=3D"prettyprint"=
style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187,=
187); border-style: solid; border-width: 1px; word-wrap: break-word;"><cod=
e class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color:=
#008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">[</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">state</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> my_foo</span><span style=3D"color: #660;" class=3D"styled-by-prettify">]<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> my_function</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span></div></code></div><b=
r>http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0217r2.html incl=
uded into C++17 draft on july committee meeting<br><br>Sergey <br></div></d=
iv>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/6caa738a-2e27-47ba-84ee-e6b7f73f66b3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6caa738a-2e27-47ba-84ee-e6b7f73f66b3=
%40isocpp.org</a>.<br />
------=_Part_5412_1932415719.1467980633142--
------=_Part_5411_245300158.1467980633142--
.