Topic: RFC: C++ generic factory
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Sat, 24 Jan 2015 10:47:40 +0100
Raw View
This is a multi-part message in MIME format.
--------------070606060703020401000902
Content-Type: text/plain; charset=UTF-8; format=flowed
Hi,
I have written a draft proposal for a generic factory make function [1].
Any comments or contributions are welcome.
Vicente
[1]
https://github.com/viboes/std-make/blob/master/doc/proposal/factories/DXXXX_factories.md
--
---
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/.
--------------070606060703020401000902
Content-Type: text/html; charset=UTF-8
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font size="+1">Hi,<br>
<br>
I have written a draft proposal for a generic factory make
function </font><font size="+1">[1].<br>
<br>
Any comments or contributions are welcome.<br>
<br>
</font><font size="+1">Vicente<br>
</font><br>
[1]
<a class="moz-txt-link-freetext" href="https://github.com/viboes/std-make/blob/master/doc/proposal/factories/DXXXX_factories.md">https://github.com/viboes/std-make/blob/master/doc/proposal/factories/DXXXX_factories.md</a><br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href="mailto:std-proposals@isocpp.org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href="http://groups.google.com/a/isocpp.org/group/std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/</a>.<br />
--------------070606060703020401000902--
.
Author: german.gomez@personifyinc.com
Date: Tue, 27 Jan 2015 23:32:08 -0800 (PST)
Raw View
------=_Part_4955_1889463386.1422430328662
Content-Type: multipart/alternative;
boundary="----=_Part_4956_1370440313.1422430328663"
------=_Part_4956_1370440313.1422430328663
Content-Type: text/plain; charset=UTF-8
On Saturday, January 24, 2015 at 4:47:42 PM UTC+7, Vicente J. Botet Escriba
wrote:
>
> Hi,
>
> I have written a draft proposal for a generic factory make function [1].
>
> Any comments or contributions are welcome.
>
> Vicente
>
> [1]
> https://github.com/viboes/std-make/blob/master/doc/proposal/factories/DXXXX_factories.md
>
I took a look to your idea. I thought, before opening the link, that it
would be some kind of fancy thing,
but actually I like the idea quite a bit. Especially that you can
make<optional> or something else without
and with a template parameter, and in each case it will forward arguments
or will construct directly and
deduce.
Was just a quick look, but I think that something like that would be good
to have into the standard,
since now you cannot parametrize make_shared, make_unique, make_optional,
but you could with
make<shared_ptr>, make<unique_ptr>, etc, which leaves things more
extendable for the users.
Regards
--
---
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_4956_1370440313.1422430328663
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Saturday, January 24, 2015 at 4:47:42 PM UTC+7,=
Vicente J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"=
margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;=
">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<font size=3D"+1">Hi,<br>
<br>
I have written a draft proposal for a generic factory make
function </font><font size=3D"+1">[1].<br>
<br>
Any comments or contributions are welcome.<br>
<br>
</font><font size=3D"+1">Vicente<br>
</font><br>
[1]
<a href=3D"https://github.com/viboes/std-make/blob/master/doc/proposal/fact=
ories/DXXXX_factories.md" target=3D"_blank" rel=3D"nofollow" onmousedown=3D=
"this.href=3D'https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fvib=
oes%2Fstd-make%2Fblob%2Fmaster%2Fdoc%2Fproposal%2Ffactories%2FDXXXX_factori=
es.md\46sa\75D\46sntz\0751\46usg\75AFQjCNH1R-l-hliQjP6hQYN0Ztb-4xP6MA';retu=
rn true;" onclick=3D"this.href=3D'https://www.google.com/url?q\75https%3A%2=
F%2Fgithub.com%2Fviboes%2Fstd-make%2Fblob%2Fmaster%2Fdoc%2Fproposal%2Ffacto=
ries%2FDXXXX_factories.md\46sa\75D\46sntz\0751\46usg\75AFQjCNH1R-l-hliQjP6h=
QYN0Ztb-4xP6MA';return true;">https://github.com/viboes/std-<wbr>make/blob/=
master/doc/proposal/<wbr>factories/DXXXX_factories.md</a></div></blockquote=
><div><br></div><div>I took a look to your idea. I thought, before opening =
the link, that it would be some kind of fancy thing,</div><div>but actually=
I like the idea quite a bit. Especially that you can make<optional> =
or something else without</div><div>and with a template parameter, and in e=
ach case it will forward arguments or will construct directly and</div><div=
>deduce.</div><div><br></div><div>Was just a quick look, but I think that s=
omething like that would be good to have into the standard,</div><div>since=
now you cannot parametrize make_shared, make_unique, make_optional, but yo=
u could with</div><div>make<shared_ptr>, make<unique_ptr>, etc,=
which leaves things more extendable for the users.</div><div><br></div><di=
v>Regards </div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
------=_Part_4956_1370440313.1422430328663--
------=_Part_4955_1889463386.1422430328662--
.
Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Wed, 28 Jan 2015 11:38:06 +0100
Raw View
--089e014940267f4547050db3f723
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=E2=80=8BI think that the motivation section would benefit from a better sh=
ort
rational which I found only later in the rational part.
--=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/.
--089e014940267f4547050db3f723
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br>=E2=80=8BI think that the motivation section would ben=
efit from a better short rational which I found only later in the rational =
part.</div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--089e014940267f4547050db3f723--
.
Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Wed, 28 Jan 2015 12:00:53 +0100
Raw View
--089e013d17b6fccaca050db448c4
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Wed, Jan 28, 2015 at 11:38 AM, Klaim - Jo=C3=ABl Lamotte <mjklaim@gmail.=
com>
wrote:
>
> =E2=80=8BI think that the motivation section would benefit from a better =
short
> rational which I found only later in the rational part.
>
Other than that I found before that adding make function for eah type that
need it was indeed not
very generic. These proposal seem useful, in particular if it allows
another function needing to
to be able to build objects in a customized way even if the type dont have
new overloaded.
--=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/.
--089e013d17b6fccaca050db448c4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Wed, Jan 28, 2015 at 11:38 AM, Klaim - Jo=C3=ABl Lamotte <span dir=
=3D"ltr"><<a href=3D"mailto:mjklaim@gmail.com" target=3D"_blank">mjklaim=
@gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><br>=E2=80=8BI think that the motivation section would benefit fro=
m a better short rational which I found only later in the rational part.</d=
iv>
</blockquote></div><br></div><div class=3D"gmail_extra"><br></div><div clas=
s=3D"gmail_extra">Other than that I found before that adding make function =
for eah type that need it was indeed not=C2=A0</div><div class=3D"gmail_ext=
ra">very generic. These proposal seem useful, in particular if it allows an=
other function needing to=C2=A0</div><div class=3D"gmail_extra">to be able =
to build objects in a customized way even if the type dont have new overloa=
ded.</div><div class=3D"gmail_extra"><br></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--089e013d17b6fccaca050db448c4--
.
Author: Antony Polukhin <antoshkka@gmail.com>
Date: Wed, 28 Jan 2015 18:26:11 +0400
Raw View
--e89a8f50309c383032050db7277b
Content-Type: text/plain; charset=UTF-8
2015-01-24 13:47 GMT+04:00 Vicente J. Botet Escriba <
vicente.botet@wanadoo.fr>:
> Hi,
>
> I have written a draft proposal for a generic factory make function [1].
>
> Any comments or contributions are welcome.
>
> Vicente
>
> [1]
> https://github.com/viboes/std-make/blob/master/doc/proposal/factories/DXXXX_factories.md
>
There's an implementation of create function in Boost.HANA library:
https://github.com/ldionne/hana/blob/master/include/boost/hana/detail/create.hpp
which is close to what you're proposing.
create implementation looks more simple, has support for constexpr and
simpler to extend. Your implementation has an advantage of in_place_t.
There's also a make function:
https://github.com/ldionne/hana/blob/master/include/boost/hana/core/make.hpp
May be it would be better to combine all the solutions, add noexcept
detection:
template <template <typename ...> class T>
struct create {
template <typename ...X>
constexpr T<typename detail::std::decay<X>::type...>
operator()(X&& ...x) const noexcept(noexcept(
T<typename detail::std::decay<X>::type...>{
detail::std::forward<X>(x)...
}
))
{
return T<typename detail::std::decay<X>::type...>{
detail::std::forward<X>(x)...
};
}
// overloads for in_place_t
// ...
};
// not sure that this is a valid code
// I have no access to C++14 compiler
template <typename T>
constexpr create<T> make<T>{};
This could be possibly extended in the following manner:
template <class T>
struct create<unique_ptr<T> > {
template <typename ...X>
constexpr unique_ptr<T>
operator()(X&& ...x) const
{
return unique_ptr<T>{
new T(detail::std::forward<X>(x)...)
};
}
};
Usage example:
auto t1 = make<std::tuple>(10, "hello"s, 11s);
auto t1 = make<std::tuple>("hello"s, "word"s);
auto p1 = make<unique_ptr>(std::vector<int>());
auto p2 = make<unique_ptr>(int);
--
Best regards,
Antony Polukhin
--
---
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/.
--e89a8f50309c383032050db7277b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2015=
-01-24 13:47 GMT+04:00 Vicente J. Botet Escriba <span dir=3D"ltr"><<a hr=
ef=3D"mailto:vicente.botet@wanadoo.fr" target=3D"_blank">vicente.botet@wana=
doo.fr</a>></span>:<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"=
>
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
Hi,<br><br>I have written a draft proposal for a generic factory make f=
unction [1].<br><br>Any comments or contributions are welcome.<br><br>Vicen=
te<br><br>[1] <a href=3D"https://github.com/viboes/std-make/blob/master/doc=
/proposal/factories/DXXXX_factories.md">https://github.com/viboes/std-make/=
blob/master/doc/proposal/factories/DXXXX_factories.md</a><br></div></blockq=
uote></div><br clear=3D"all"></div><div class=3D"gmail_extra">There's a=
n implementation of create function in Boost.HANA library: <a href=3D"https=
://github.com/ldionne/hana/blob/master/include/boost/hana/detail/create.hpp=
">https://github.com/ldionne/hana/blob/master/include/boost/hana/detail/cre=
ate.hpp</a> which is close to what you're proposing.<br><br></div><div =
class=3D"gmail_extra">create implementation looks more simple, has support =
for constexpr and simpler to extend. Your implementation has an advantage o=
f in_place_t.<br><div class=3D"gmail_extra"><br></div>There's also a ma=
ke function: <a href=3D"https://github.com/ldionne/hana/blob/master/include=
/boost/hana/core/make.hpp">https://github.com/ldionne/hana/blob/master/incl=
ude/boost/hana/core/make.hpp</a><br><br></div><div class=3D"gmail_extra">Ma=
y be it would be better to combine all the solutions, add noexcept detectio=
n:<br></div><div class=3D"gmail_extra"><br>template <template <typena=
me ...> class T><br>struct create {<br>=C2=A0=C2=A0=C2=A0 template &l=
t;typename ...X><br>=C2=A0=C2=A0=C2=A0 constexpr T<typename detail::s=
td::decay<X>::type...><br>=C2=A0=C2=A0=C2=A0 operator()(X&&=
; ...x) const noexcept(noexcept(<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 T<typename detail::std::decay<X>::type...>{<br>=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 detail::std::forward=
<X>(x)...<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<br>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 )) <br>=C2=A0=C2=A0=C2=A0 {<br>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return T<typename detail::std::deca=
y<X>::type...>{<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 detail::std::forward<X>(x)...<br>=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 };<br>=C2=A0=C2=A0=C2=A0 }<br></div><div cla=
ss=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 // overloads for in_place_t<br>=C2=A0=
=C2=A0=C2=A0 // ...<br></div><div class=3D"gmail_extra">};<br><br>// not su=
re that this is a valid code<br></div><div class=3D"gmail_extra">// I have =
no access to C++14 compiler<br></div><div class=3D"gmail_extra">template &l=
t;typename T><br>constexpr create<T> make<T>{}; <br><br><br>=
</div><div class=3D"gmail_extra">This could be possibly extended in the fol=
lowing manner:<br><br></div><div class=3D"gmail_extra">template <class T=
><br>struct create<unique_ptr<T> > {<br>=C2=A0=C2=A0=C2=A0 t=
emplate <typename ...X><br>=C2=A0=C2=A0=C2=A0 constexpr unique_ptr<=
;T><br>=C2=A0=C2=A0=C2=A0 operator()(X&& ...x) const <br>=C2=A0=
=C2=A0=C2=A0 {<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return unique_=
ptr<T>{<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 new T(detail::std::forward<X>(x)...)<br>=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 };<br>=C2=A0=C2=A0=C2=A0 }<br>};<br></div><div cla=
ss=3D"gmail_extra"><br></div><div class=3D"gmail_extra">Usage example:<br><=
br>auto t1 =3D make<std::tuple>(10, "hello"s, 11s);<br>auto=
t1 =3D make<std::tuple>("hello"s, "word"s);</div=
><div class=3D"gmail_extra">auto p1 =3D make<unique_ptr>(std::vector&=
lt;int>());<br>auto p2 =3D make<unique_ptr>(int);<br><br></div><di=
v class=3D"gmail_extra">-- <br><div class=3D"gmail_signature">Best regards,=
<br>Antony Polukhin</div>
</div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--e89a8f50309c383032050db7277b--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Wed, 28 Jan 2015 19:26:23 +0100
Raw View
This is a multi-part message in MIME format.
--------------070301090107070409060500
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 28/01/15 08:32, german.gomez@personifyinc.com a =C3=A9crit :
>
>
> On Saturday, January 24, 2015 at 4:47:42 PM UTC+7, Vicente J. Botet=20
> Escriba wrote:
>
> Hi,
>
> I have written a draft proposal for a generic factory make
> function [1].
>
> Any comments or contributions are welcome.
>
> Vicente
>
> [1]
> https://github.com/viboes/std-make/blob/master/doc/proposal/factories=
/DXXXX_factories.md
> <https://github.com/viboes/std-make/blob/master/doc/proposal/factorie=
s/DXXXX_factories.md>
>
>
> I took a look to your idea. I thought, before opening the link, that=20
> it would be some kind of fancy thing,
> but actually I like the idea quite a bit. Especially that you can=20
> make<optional> or something else without
> and with a template parameter, and in each case it will forward=20
> arguments or will construct directly and
> deduce.
>
> Was just a quick look, but I think that something like that would be=20
> good to have into the standard,
> since now you cannot parametrize make_shared, make_unique,=20
> make_optional, but you could with
> make<shared_ptr>, make<unique_ptr>, etc, which leaves things more=20
> extendable for the users.
>
>
Glad to hear you would like to have something like this on the standard.
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/.
--------------070301090107070409060500
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 28/01/15 08:32,
<a class=3D"moz-txt-link-abbreviated" href=3D"mailto:german.gomez@per=
sonifyinc.com">german.gomez@personifyinc.com</a> a =C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:d85911c0-0198-43d5-acc9-7af5ff870c1f@isocpp.org"
type=3D"cite">
<div dir=3D"ltr"><br>
<br>
On Saturday, January 24, 2015 at 4:47:42 PM UTC+7, Vicente J.
Botet Escriba wrote:
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div bgcolor=3D"#FFFFFF" text=3D"#000000"> <font size=3D"+1">Hi,<=
br>
<br>
I have written a draft proposal for a generic factory make
function </font><font size=3D"+1">[1].<br>
<br>
Any comments or contributions are welcome.<br>
<br>
</font><font size=3D"+1">Vicente<br>
</font><br>
[1]
<a moz-do-not-send=3D"true"
href=3D"https://github.com/viboes/std-make/blob/master/doc/proposal/factori=
es/DXXXX_factories.md"
target=3D"_blank" rel=3D"nofollow"
onmousedown=3D"this.href=3D'https://www.google.com/url?q\75ht=
tps%3A%2F%2Fgithub.com%2Fviboes%2Fstd-make%2Fblob%2Fmaster%2Fdoc%2Fproposal=
%2Ffactories%2FDXXXX_factories.md\46sa\75D\46sntz\0751\46usg\75AFQjCNH1R-l-=
hliQjP6hQYN0Ztb-4xP6MA';return
true;"
onclick=3D"this.href=3D'https://www.google.com/url?q\75https%=
3A%2F%2Fgithub.com%2Fviboes%2Fstd-make%2Fblob%2Fmaster%2Fdoc%2Fproposal%2Ff=
actories%2FDXXXX_factories.md\46sa\75D\46sntz\0751\46usg\75AFQjCNH1R-l-hliQ=
jP6hQYN0Ztb-4xP6MA';return
true;">https://github.com/viboes/std-<wbr>make/blob/master/do=
c/proposal/<wbr>factories/DXXXX_factories.md</a></div>
</blockquote>
<div><br>
</div>
<div>I took a look to your idea. I thought, before opening the
link, that it would be some kind of fancy thing,</div>
<div>but actually I like the idea quite a bit. Especially that
you can make<optional> or something else without</div>
<div>and with a template parameter, and in each case it will
forward arguments or will construct directly and</div>
<div>deduce.</div>
<div><br>
</div>
<div>Was just a quick look, but I think that something like that
would be good to have into the standard,</div>
<div>since now you cannot parametrize make_shared, make_unique,
make_optional, but you could with</div>
<div>make<shared_ptr>, make<unique_ptr>, etc, which
leaves things more extendable for the users.</div>
<div><br>
</div>
<br>
</div>
</blockquote>
Glad to hear you would like to have something like this on the
standard.<br>
<br>
Vicente<br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--------------070301090107070409060500--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Wed, 28 Jan 2015 19:31:11 +0100
Raw View
This is a multi-part message in MIME format.
--------------020908090307000909020607
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 28/01/15 12:00, Klaim - Jo=C3=ABl Lamotte a =C3=A9crit :
>
>
> On Wed, Jan 28, 2015 at 11:38 AM, Klaim - Jo=C3=ABl Lamotte=20
> <mjklaim@gmail.com <mailto:mjklaim@gmail.com>> wrote:
>
>
> =E2=80=8BI think that the motivation section would benefit from a bet=
ter
> short rational which I found only later in the rational part.
>
>
>
Could you be more explicit? What would you like to be added?
> Other than that I found before that adding make function for eah type=20
> that need it was indeed not
> very generic. These proposal seem useful, in particular if it allows=20
> another function needing to
> to be able to build objects in a customized way even if the type dont=20
> have new overloaded.
>
>
I'm missing the last point. What do you mean by " even if the type dont=20
have new overloaded"?
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/.
--------------020908090307000909020607
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 28/01/15 12:00, Klaim - Jo=C3=ABl Lam=
otte
a =C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:CAOU91OOqo3cAKW8Kr1XJdH4niwVD5NEgnUDp=3DcQrTibArcjNXg@mail.gmai=
l.com"
type=3D"cite">
<div dir=3D"ltr"><br>
<div class=3D"gmail_extra"><br>
<div class=3D"gmail_quote">On Wed, Jan 28, 2015 at 11:38 AM,
Klaim - Jo=C3=ABl Lamotte <span dir=3D"ltr"><<a
moz-do-not-send=3D"true" href=3D"mailto:mjklaim@gmail.com"
target=3D"_blank">mjklaim@gmail.com</a>></span> wrote:<b=
r>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir=3D"ltr"><br>
=E2=80=8BI think that the motivation section would benefit =
from
a better short rational which I found only later in the
rational part.</div>
</blockquote>
</div>
<br>
</div>
<div class=3D"gmail_extra"><br>
</div>
</div>
</blockquote>
Could you be more explicit? What would you like to be added?<br>
<blockquote
cite=3D"mid:CAOU91OOqo3cAKW8Kr1XJdH4niwVD5NEgnUDp=3DcQrTibArcjNXg@mail.gmai=
l.com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">Other than that I found before that
adding make function for eah type that need it was indeed not=C2=
=A0</div>
<div class=3D"gmail_extra">very generic. These proposal seem
useful, in particular if it allows another function needing
to=C2=A0</div>
<div class=3D"gmail_extra">to be able to build objects in a
customized way even if the type dont have new overloaded.</div>
<div class=3D"gmail_extra"><br>
</div>
</div>
<br>
</blockquote>
I'm missing the last point. What do you mean by " even if the type
dont have new overloaded"?<br>
<br>
Vicente<br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--------------020908090307000909020607--
.
Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Thu, 29 Jan 2015 00:33:42 +0100
Raw View
--001a11c3a0e8456bbb050dbecd0c
Content-Type: text/plain; charset=UTF-8
On Wed, Jan 28, 2015 at 7:31 PM, Vicente J. Botet Escriba <
vicente.botet@wanadoo.fr> wrote:
> Could you be more explicit? What would you like to be added?
>
Well the motivation section says
"The goal is to be able to have a generic make factory that can be used in
place of..."
and goes on explaining what the proposal wants to achieve, but that do not
explain what problem this is solving or why it would be useful to have the
feature described available.
Saying that the make<> function would replace the other functions is not
what I call a "motivation".
However, the rational section have good points which I think should be at
least mentionned in
the motivation section, then developped in the rational section.
> Other than that I found before that adding make function for eah type
> that need it was indeed not
> very generic. These proposal seem useful, in particular if it allows
> another function needing to
> to be able to build objects in a customized way even if the type dont have
> new overloaded.
>
>
> I'm missing the last point. What do you mean by " even if the type dont
> have new overloaded"?
>
>
I meant that if I have a type like this:
template< class T >
class CustomContainer
{
//...
std::vector<std::unique_ptr<T>> m_elements;
public:
template< class... Args>
void create_record( Args&&... args )
{
// ....
m_elements.emplace_back( make<std::unique_ptr<T>>(
std::forward<Args>(args)...) );
}
};
I might be wrong but it seem to me to be easy to overload
make<unique_ptr<T>>()
if the user wants Ts to be built in a specific way, like a pool for example,
and it seems to me more flexible than overloading new for T and expect the
library code
to actually call new.
It might be uncommon anyway but for entity-semantic types it looks useful
to me.
Question:
what would this do?
auto x = make<K>();
What about this call to return make_unique by default and therefore allow
the author of K to specify a make<T>() overload for the general case?
It's just raw ideas I got reading your paper.
> Vicente
>
> --
>
> ---
> 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/.
>
--
---
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/.
--001a11c3a0e8456bbb050dbecd0c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Wed, Jan 28, 2015 at 7:31 PM, Vicente J. Botet Escriba <span dir=3D"=
ltr"><<a href=3D"mailto:vicente.botet@wanadoo.fr" target=3D"_blank">vice=
nte.botet@wanadoo.fr</a>></span> wrote:<br><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-co=
lor:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>Could you be more explicit? What would you like to be added?<br></=
div></div></blockquote><div><br></div><div>Well the motivation section says=
=C2=A0</div><div>"The goal is to be able to have a generic make factor=
y that can be used in place of..."</div><div>and goes on explaining wh=
at the proposal wants to achieve, but that do not=C2=A0</div><div>explain w=
hat problem this is solving or why it would be useful to have the feature d=
escribed available.</div><div>Saying that the make<> function would r=
eplace the other functions is not what I call a "motivation".</di=
v><div><br></div><div>However, the rational section have good points which =
I think should be at least mentionned in</div><div>the motivation section, =
then developped in the rational section.</div><div>=C2=A0</div><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1=
px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:=
1ex"><div bgcolor=3D"#FFFFFF" text=3D"#000000"><div></div><span class=3D"">
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">Other than that I found before that
adding make function for eah type that need it was indeed not=C2=
=A0</div>
<div class=3D"gmail_extra">very generic. These proposal seem
useful, in particular if it allows another function needing
to=C2=A0</div>
<div class=3D"gmail_extra">to be able to build objects in a
customized way even if the type dont have new overloaded.</div>
<div class=3D"gmail_extra"><br>
</div>
</div>
<br>
</blockquote></span>
I'm missing the last point. What do you mean by " even if the =
type
dont have new overloaded"?<span class=3D""><font color=3D"#888888"=
><br>
<br></font></span></div></blockquote><div><br></div><div><br></div><div=
>I meant that if I have a type like this:</div><div><br></div><div>template=
< class T ></div><div>class CustomContainer</div><div>{</div><div>//.=
...</div><div>=C2=A0 =C2=A0 std::vector<std::unique_ptr<T>> m_el=
ements;</div><div>public:</div><div><br></div><div>=C2=A0 =C2=A0template<=
; class... Args></div><div>=C2=A0 =C2=A0void create_record( Args&&am=
p;... args )</div><div>=C2=A0 =C2=A0{</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
// ....</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0m_elements.emplace_back( make&=
lt;std::unique_ptr<T>>( std::forward<Args>(args)...) );</div=
><div>=C2=A0 =C2=A0}</div><div>};</div><div><br></div><div>I might be wrong=
but it seem to me to be easy to overload make<unique_ptr<T>>()=
</div><div>if the user wants Ts to be built in a specific way, like a pool =
for example,</div><div>and it seems to me more flexible than overloading ne=
w for T and expect the library code</div><div>to actually call new.</div><d=
iv>It might be uncommon anyway but for entity-semantic types it looks usefu=
l to me.</div><div><br></div><div>Question:</div><div>what would this do?</=
div><div><br></div><div>auto x =3D make<K>();=C2=A0</div><div><br></d=
iv><div>What about this call to return make_unique by default and therefore=
allow=C2=A0</div><div>the author of K to specify a make<T>() overloa=
d for the general case?</div><div>=C2=A0</div><div>It's just raw ideas =
I got reading your paper.</div><div><br></div><div>=C2=A0</div><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1=
px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:=
1ex"><div bgcolor=3D"#FFFFFF" text=3D"#000000"><span class=3D""><font color=
=3D"#888888">
Vicente<br>
</font></span></div><div class=3D""><div class=3D"h5">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--001a11c3a0e8456bbb050dbecd0c--
.
Author: David Krauss <potswa@gmail.com>
Date: Thu, 29 Jan 2015 08:36:31 +0800
Raw View
--Apple-Mail=_F30AA754-02A8-4496-A87A-8B1FB763A19C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
> On 2015=E2=80=9301=E2=80=9329, at 7:33 AM, Klaim - Jo=C3=ABl Lamotte <mjk=
laim@gmail.com> wrote:
>=20
>=20
>=20
> On Wed, Jan 28, 2015 at 7:31 PM, Vicente J. Botet Escriba <vicente.botet@=
wanadoo.fr <mailto:vicente.botet@wanadoo.fr>> wrote:
> Could you be more explicit? What would you like to be added?
>=20
> Well the motivation section says=20
> "The goal is to be able to have a generic make factory that can be used i=
n place of..."
> and goes on explaining what the proposal wants to achieve, but that do no=
t=20
> explain what problem this is solving or why it would be useful to have th=
e feature described available.
> Saying that the make<> function would replace the other functions is not =
what I call a "motivation=E2=80=9D.
I imagine EWG asking these questions:
1. Why is make<std::shared_pointer> better than std::make_shared? Do the be=
nefits of this renaming justify the cost in complexity?
2. Can the new deduction functionality be retrofitted to the existing facto=
ry functions? (Could it be a separate proposal?)
3. Should the user never qualify make with std:: because it should be found=
by ADL? Why or why not?
--=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/.
--Apple-Mail=_F30AA754-02A8-4496-A87A-8B1FB763A19C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9301=
=E2=80=9329, at 7:33 AM, Klaim - Jo=C3=ABl Lamotte <<a href=3D"mailto:mj=
klaim@gmail.com" class=3D"">mjklaim@gmail.com</a>> wrote:</div><br class=
=3D"Apple-interchange-newline"><div class=3D""><div dir=3D"ltr" class=3D"">=
<br class=3D""><div class=3D"gmail_extra"><br class=3D""><div class=3D"gmai=
l_quote">On Wed, Jan 28, 2015 at 7:31 PM, Vicente J. Botet Escriba <span di=
r=3D"ltr" class=3D""><<a href=3D"mailto:vicente.botet@wanadoo.fr" target=
=3D"_blank" class=3D"">vicente.botet@wanadoo.fr</a>></span> wrote:<br cl=
ass=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-styl=
e:solid;padding-left:1ex">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000" class=3D"">
<div class=3D"">Could you be more explicit? What would you like to be a=
dded?<br class=3D""></div></div></blockquote><div class=3D""><br class=3D""=
></div><div class=3D"">Well the motivation section says </div><div cla=
ss=3D"">"The goal is to be able to have a generic make factory that can be =
used in place of..."</div><div class=3D"">and goes on explaining what the p=
roposal wants to achieve, but that do not </div><div class=3D"">explai=
n what problem this is solving or why it would be useful to have the featur=
e described available.</div><div class=3D"">Saying that the make<> fu=
nction would replace the other functions is not what I call a "motivation=
=E2=80=9D.</div></div></div></div></div></blockquote><div><br class=3D""></=
div><div>I imagine EWG asking these questions:</div><div><br class=3D""></d=
iv><div>1. Why is <font face=3D"Courier" class=3D"">make<std::shared_poi=
nter></font> better than <font face=3D"Courier" class=3D"">std::make_sha=
red</font>? Do the benefits of this renaming justify the cost in complexity=
?</div><div>2. Can the new deduction functionality be retrofitted to the ex=
isting factory functions? (Could it be a separate proposal?)</div><div>3. S=
hould the user never qualify <font face=3D"Courier" class=3D"">make</font> =
with <font face=3D"Courier" class=3D"">std::</font> because it should be fo=
und by ADL? Why or why not?</div></div></body></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--Apple-Mail=_F30AA754-02A8-4496-A87A-8B1FB763A19C--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 29 Jan 2015 02:39:57 +0200
Raw View
On 29 January 2015 at 02:36, David Krauss <potswa@gmail.com> wrote:
> I imagine EWG asking these questions:
> 1. Why is make<std::shared_pointer> better than std::make_shared? Do the
> benefits of this renaming justify the cost in complexity?
EWG wouldn't ask the second question, because there is no renaming proposed.
--
---
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/.
.
Author: David Krauss <potswa@gmail.com>
Date: Thu, 29 Jan 2015 08:52:06 +0800
Raw View
--Apple-Mail=_2167F6BE-DECB-43C6-82CF-30A452C114F2
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
> On 2015=E2=80=9301=E2=80=9329, at 8:39 AM, Ville Voutilainen <ville.vouti=
lainen@gmail.com> wrote:
>=20
> On 29 January 2015 at 02:36, David Krauss <potswa@gmail.com> wrote:
>> I imagine EWG asking these questions:
>> 1. Why is make<std::shared_pointer> better than std::make_shared? Do the
>> benefits of this renaming justify the cost in complexity?
>=20
> EWG wouldn't ask the second question, because there is no renaming propos=
ed.
I mean, in the sense that make< std::shared_pointer > is just another name =
for std::make_shared. The former isn=E2=80=99t inherently more generic, it=
=E2=80=99s just a different token sequence. (Unless you count the addition =
of _t, but that=E2=80=99s the second question: why couldn=E2=80=99t we have=
std::make_unique< _t, my_deleter >?)
--=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/.
--Apple-Mail=_2167F6BE-DECB-43C6-82CF-30A452C114F2
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9301=
=E2=80=9329, at 8:39 AM, Ville Voutilainen <<a href=3D"mailto:ville.vout=
ilainen@gmail.com" class=3D"">ville.voutilainen@gmail.com</a>> wrote:</d=
iv><br class=3D"Apple-interchange-newline"><div class=3D"">On 29 January 20=
15 at 02:36, David Krauss <<a href=3D"mailto:potswa@gmail.com" class=3D"=
">potswa@gmail.com</a>> wrote:<br class=3D""><blockquote type=3D"cite" c=
lass=3D"">I imagine EWG asking these questions:<br class=3D"">1. Why is mak=
e<std::shared_pointer> better than std::make_shared? Do the<br class=
=3D"">benefits of this renaming justify the cost in complexity?<br class=3D=
""></blockquote><br class=3D"">EWG wouldn't ask the second question, becaus=
e there is no renaming proposed.<br class=3D""></div></blockquote></div><br=
class=3D""><div class=3D"">I mean, in the sense that <font face=3D"Courier=
" class=3D"">make< std::shared_pointer ></font> is just another name =
for <font face=3D"Courier" class=3D"">std::make_shared</font>. The former i=
sn=E2=80=99t inherently more generic, it=E2=80=99s just a different token s=
equence. (Unless you count the addition of <font face=3D"Courier" clas=
s=3D"">_t</font>, but that=E2=80=99s the second question: why couldn=E2=80=
=99t we have <font face=3D"Courier" class=3D"">std::make_unique< _t, my_=
deleter ></font>?)</div></body></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--Apple-Mail=_2167F6BE-DECB-43C6-82CF-30A452C114F2--
.
Author: David Krauss <potswa@gmail.com>
Date: Thu, 29 Jan 2015 09:02:40 +0800
Raw View
--Apple-Mail=_3F4DF908-5F47-4071-B1BA-CA52EC310E64
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
> On 2015=E2=80=9301=E2=80=9329, at 8:36 AM, David Krauss <potswa@gmail.com=
> wrote:
>=20
> 3. Should the user never qualify make with std:: because it should be fou=
nd by ADL? Why or why not?
As long as I=E2=80=99m attempting to phrase my questions as they might be p=
osed by EWG, this one is wrong too. This might be a closer approximation:
3. The paper shows examples of usage inside namespace std, but it needs to =
show how the user should refer to make and _t. If it=E2=80=99s intended, sh=
ow how to customize non-standard classes, and standard library implementers=
will extrapolate from there.
--=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/.
--Apple-Mail=_3F4DF908-5F47-4071-B1BA-CA52EC310E64
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9301=
=E2=80=9329, at 8:36 AM, David Krauss <<a href=3D"mailto:potswa@gmail.co=
m" class=3D"">potswa@gmail.com</a>> wrote:</div><br class=3D"Apple-inter=
change-newline"><div class=3D""><span style=3D"font-family: Helvetica; font=
-size: 12px; font-style: normal; font-variant: normal; font-weight: normal;=
letter-spacing: normal; line-height: normal; orphans: auto; text-align: st=
art; text-indent: 0px; text-transform: none; white-space: normal; widows: a=
uto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; displa=
y: inline !important;" class=3D"">3. Should the user never qualify<span cla=
ss=3D"Apple-converted-space"> </span></span><font face=3D"Courier" cla=
ss=3D"" style=3D"font-size: 12px; font-style: normal; font-variant: normal;=
font-weight: normal; letter-spacing: normal; line-height: normal; orphans:=
auto; text-align: start; text-indent: 0px; text-transform: none; white-spa=
ce: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px=
;">make</font><span style=3D"font-family: Helvetica; font-size: 12px; font-=
style: normal; font-variant: normal; font-weight: normal; letter-spacing: n=
ormal; line-height: normal; orphans: auto; text-align: start; text-indent: =
0px; text-transform: none; white-space: normal; widows: auto; word-spacing:=
0px; -webkit-text-stroke-width: 0px; float: none; display: inline !importa=
nt;" class=3D""><span class=3D"Apple-converted-space"> </span>with<spa=
n class=3D"Apple-converted-space"> </span></span><font face=3D"Courier=
" class=3D"" style=3D"font-size: 12px; font-style: normal; font-variant: no=
rmal; font-weight: normal; letter-spacing: normal; line-height: normal; orp=
hans: auto; text-align: start; text-indent: 0px; text-transform: none; whit=
e-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width=
: 0px;">std::</font><span style=3D"font-family: Helvetica; font-size: 12px;=
font-style: normal; font-variant: normal; font-weight: normal; letter-spac=
ing: normal; line-height: normal; orphans: auto; text-align: start; text-in=
dent: 0px; text-transform: none; white-space: normal; widows: auto; word-sp=
acing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !i=
mportant;" class=3D""><span class=3D"Apple-converted-space"> </span>be=
cause it should be found by ADL? Why or why not?</span></div></blockquote><=
/div><br class=3D""><div class=3D"">As long as I=E2=80=99m attempting to ph=
rase my questions as they might be posed by EWG, this one is wrong too. Thi=
s might be a closer approximation:</div><div class=3D""><br class=3D""></di=
v><div class=3D"">3. The paper shows examples of usage inside <font face=3D=
"Courier" class=3D"">namespace std</font>, but it needs to show how the use=
r should refer to <font face=3D"Courier" class=3D"">make</font> and <font f=
ace=3D"Courier" class=3D"">_t</font>. If it=E2=80=99s intended, show how to=
customize non-standard classes, and standard library implementers will ext=
rapolate from there.</div></body></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--Apple-Mail=_3F4DF908-5F47-4071-B1BA-CA52EC310E64--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Thu, 29 Jan 2015 06:15:29 +0100
Raw View
This is a multi-part message in MIME format.
--------------090706070603050707010406
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 28/01/15 15:26, Antony Polukhin a =C3=A9crit :
> 2015-01-24 13:47 GMT+04:00 Vicente J. Botet Escriba=20
> <vicente.botet@wanadoo.fr <mailto:vicente.botet@wanadoo.fr>>:
>
> Hi,
>
> I have written a draft proposal for a generic factory make
> function [1].
>
> Any comments or contributions are welcome.
>
> Vicente
>
> [1]
> https://github.com/viboes/std-make/blob/master/doc/proposal/factories=
/DXXXX_factories.md
>
>
> There's an implementation of create function in Boost.HANA library:=20
> https://github.com/ldionne/hana/blob/master/include/boost/hana/detail/cre=
ate.hpp=20
> which is close to what you're proposing.
>
> create implementation looks more simple, has support for constexpr and=20
> simpler to extend. Your implementation has an advantage of in_place_t.
I have chosen overloading as extension mechanism to be more inline with=20
the standard (begin, end, swap, ...).
If the committee prefers traits than overloading, I'll adapt the proposal.
Concerning the constexpr point, I believe that any customizable factory=20
will have the issue. A library could use directly the customization=20
point instead which could be constexpr. I'll add a note on the rationale.
>
> There's also a make function:=20
> https://github.com/ldionne/hana/blob/master/include/boost/hana/core/make.=
hpp
>
> May be it would be better to combine all the solutions, add noexcept=20
> detection:
For the time been I have not take in account the factory of product=20
types as std::tuple. The factory I 'm proposing is one for sume types.=20
I'll need some time to see how both can be married, but mixing emplace=20
factories and product type factories seems to overlap. I will add a note=20
on this point.
>
> template <template <typename ...> class T>
> struct create {
> template <typename ...X>
> constexpr T<typename detail::std::decay<X>::type...>
> operator()(X&& ...x) const noexcept(noexcept(
> T<typename detail::std::decay<X>::type...>{
> detail::std::forward<X>(x)...
> }
> ))
> {
> return T<typename detail::std::decay<X>::type...>{
> detail::std::forward<X>(x)...
> };
> }
> // overloads for in_place_t
> // ...
> };
>
> // not sure that this is a valid code
> // I have no access to C++14 compiler
> template <typename T>
> constexpr create<T> make<T>{};
>
>
> This could be possibly extended in the following manner:
>
> template <class T>
> struct create<unique_ptr<T> > {
> template <typename ...X>
> constexpr unique_ptr<T>
> operator()(X&& ...x) const
> {
> return unique_ptr<T>{
> new T(detail::std::forward<X>(x)...)
> };
Shouldn't this be std::make_unique? This would correspond to an emplace=20
factory.
> }
> };
>
> Usage example:
>
> auto t1 =3D make<std::tuple>(10, "hello"s, 11s);
> auto t1 =3D make<std::tuple>("hello"s, "word"s);
> auto p1 =3D make<unique_ptr>(std::vector<int>());
> auto p2 =3D make<unique_ptr>(int);
>
>
Thanks for your feedback.
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/.
--------------090706070603050707010406
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 28/01/15 15:26, Antony Polukhin a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:CAKqmYPae65tH-RuoEfcwOEc_Z9k5G+f2sJFjT80qbVwaebMUWA@mail.gmail.=
com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">
<div class=3D"gmail_quote">2015-01-24 13:47 GMT+04:00 Vicente J.
Botet Escriba <span dir=3D"ltr"><<a moz-do-not-send=3D"true"
href=3D"mailto:vicente.botet@wanadoo.fr" target=3D"_blank">=
vicente.botet@wanadoo.fr</a>></span>:<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 bgcolor=3D"#FFFFFF" text=3D"#000000"> Hi,<br>
<br>
I have written a draft proposal for a generic factory
make function [1].<br>
<br>
Any comments or contributions are welcome.<br>
<br>
Vicente<br>
<br>
[1] <a moz-do-not-send=3D"true"
href=3D"https://github.com/viboes/std-make/blob/master/doc/proposal/factori=
es/DXXXX_factories.md">https://github.com/viboes/std-make/blob/master/doc/p=
roposal/factories/DXXXX_factories.md</a><br>
</div>
</blockquote>
</div>
<br clear=3D"all">
</div>
<div class=3D"gmail_extra">There's an implementation of create
function in Boost.HANA library: <a moz-do-not-send=3D"true"
href=3D"https://github.com/ldionne/hana/blob/master/include/boost/hana/deta=
il/create.hpp">https://github.com/ldionne/hana/blob/master/include/boost/ha=
na/detail/create.hpp</a>
which is close to what you're proposing.<br>
<br>
</div>
<div class=3D"gmail_extra">create implementation looks more
simple, has support for constexpr and simpler to extend. Your
implementation has an advantage of in_place_t.<br>
</div>
</div>
</blockquote>
I have chosen overloading as extension mechanism to be more inline
with the standard (begin, end, swap, ...). <br>
If the committee prefers traits than overloading, I'll adapt the
proposal. <br>
<br>
Concerning the constexpr point, I believe that any customizable
factory will have the issue. A library could use directly the
customization point instead which could be constexpr. I'll add a
note on the rationale.<br>
<blockquote
cite=3D"mid:CAKqmYPae65tH-RuoEfcwOEc_Z9k5G+f2sJFjT80qbVwaebMUWA@mail.gmail.=
com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">
<div class=3D"gmail_extra"><br>
</div>
There's also a make function: <a moz-do-not-send=3D"true"
href=3D"https://github.com/ldionne/hana/blob/master/include/boost/hana/core=
/make.hpp">https://github.com/ldionne/hana/blob/master/include/boost/hana/c=
ore/make.hpp</a><br>
<br>
</div>
<div class=3D"gmail_extra">May be it would be better to combine
all the solutions, add noexcept detection:<br>
</div>
</div>
</blockquote>
For the time been I have not take in account the factory of product
types as std::tuple. The factory I 'm proposing is one for sume
types. I'll need some time to see how both can be married, but
mixing emplace factories and product type factories seems to
overlap. I will add a note on this point.<br>
<blockquote
cite=3D"mid:CAKqmYPae65tH-RuoEfcwOEc_Z9k5G+f2sJFjT80qbVwaebMUWA@mail.gmail.=
com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra"><br>
template <template <typename ...> class T><br>
struct create {<br>
=C2=A0=C2=A0=C2=A0 template <typename ...X><br>
=C2=A0=C2=A0=C2=A0 constexpr T<typename
detail::std::decay<X>::type...><br>
=C2=A0=C2=A0=C2=A0 operator()(X&& ...x) const noexcept(no=
except(<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 T<typename
detail::std::decay<X>::type...>{<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 detail::std::forward<X>(x)...<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 )) <br>
=C2=A0=C2=A0=C2=A0 {<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return T<typename
detail::std::decay<X>::type...>{<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 detail::std::forward<X>(x)...<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 };<br>
=C2=A0=C2=A0=C2=A0 }<br>
</div>
<div class=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 // overloads for in_p=
lace_t<br>
=C2=A0=C2=A0=C2=A0 // ...<br>
</div>
<div class=3D"gmail_extra">};<br>
<br>
// not sure that this is a valid code<br>
</div>
<div class=3D"gmail_extra">// I have no access to C++14 compiler<br=
>
</div>
<div class=3D"gmail_extra">template <typename T><br>
constexpr create<T> make<T>{}; <br>
<br>
<br>
</div>
<div class=3D"gmail_extra">This could be possibly extended in the
following manner:<br>
<br>
</div>
<div class=3D"gmail_extra">template <class T><br>
struct create<unique_ptr<T> > {<br>
=C2=A0=C2=A0=C2=A0 template <typename ...X><br>
=C2=A0=C2=A0=C2=A0 constexpr unique_ptr<T><br>
=C2=A0=C2=A0=C2=A0 operator()(X&& ...x) const <br>
=C2=A0=C2=A0=C2=A0 {<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return unique_ptr<T=
>{<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 new T(detail::std::forward<X>(x)...)<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 };<br>
</div>
</div>
</blockquote>
Shouldn't this be std::make_unique? This would correspond to an
emplace factory.<br>
<blockquote
cite=3D"mid:CAKqmYPae65tH-RuoEfcwOEc_Z9k5G+f2sJFjT80qbVwaebMUWA@mail.gmail.=
com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 }<br>
};<br>
</div>
<div class=3D"gmail_extra"><br>
</div>
<div class=3D"gmail_extra">Usage example:<br>
<br>
auto t1 =3D make<std::tuple>(10, "hello"s, 11s);<br>
auto t1 =3D make<std::tuple>("hello"s, "word"s);</div>
<div class=3D"gmail_extra">auto p1 =3D
make<unique_ptr>(std::vector<int>());<br>
auto p2 =3D make<unique_ptr>(int);<br>
<br>
</div>
<br>
</div>
</blockquote>
Thanks for your feedback.<br>
Vicente<br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--------------090706070603050707010406--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Thu, 29 Jan 2015 06:45:42 +0100
Raw View
This is a multi-part message in MIME format.
--------------040708000902030300080800
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 29/01/15 00:33, Klaim - Jo=C3=ABl Lamotte a =C3=A9crit :
>
>
> On Wed, Jan 28, 2015 at 7:31 PM, Vicente J. Botet Escriba=20
> <vicente.botet@wanadoo.fr <mailto:vicente.botet@wanadoo.fr>> wrote:
>
> Could you be more explicit? What would you like to be added?
>
>
> Well the motivation section says
> "The goal is to be able to have a generic make factory that can be=20
> used in place of..."
> and goes on explaining what the proposal wants to achieve, but that do=20
> not
> explain what problem this is solving or why it would be useful to have=20
> the feature described available.
> Saying that the make<> function would replace the other functions is=20
> not what I call a "motivation".
>
> However, the rational section have good points which I think should be=20
> at least mentionned in
> the motivation section, then developped in the rational section.
I think Got it. Should I add how having the generic make<TC> form helps=20
to make more generic code.
>
>> Other than that I found before that adding make function for eah
>> type that need it was indeed not
>> very generic. These proposal seem useful, in particular if it
>> allows another function needing to
>> to be able to build objects in a customized way even if the type
>> dont have new overloaded.
>>
>>
> I'm missing the last point. What do you mean by " even if the type
> dont have new overloaded"?
>
>
>
> I meant that if I have a type like this:
>
> template< class T >
> class CustomContainer
> {
> //...
> std::vector<std::unique_ptr<T>> m_elements;
> public:
>
> template< class... Args>
> void create_record( Args&&... args )
> {
> // ....
> m_elements.emplace_back( make<std::unique_ptr<T>>(=20
> std::forward<Args>(args)...) );
> }
> };
>
> I might be wrong but it seem to me to be easy to overload=20
> make<unique_ptr<T>>()
> if the user wants Ts to be built in a specific way, like a pool for=20
> example,
> and it seems to me more flexible than overloading new for T and expect=20
> the library code
> to actually call new.
I understand the need to specialize the emplace factory for=20
unique_ptr<UserType>. I will check if this can be done with the proposed=20
customization interface. It is clear that specializing a trait would=20
make it possible.
The proposal doesn't consider specific make factories taking an allocator.
> It might be uncommon anyway but for entity-semantic types it looks=20
> useful to me.
>
> Question:
> what would this do?
>
> auto x =3D make<K>();
The type of x should be apply<K, void>::type.
>
> What about this call to return make_unique by default and therefore allow
> the author of K to specify a make<T>() overload for the general case?
The default forwards to the constructor or emplace constructor. No=20
allocation is intended in general.
The initial intent of the proposal is not restrict to smart pointers. I=20
think that what you are looking for is more a make_smart_pointer=20
factory, isn't it?
> It's just raw ideas I got reading your paper.
>
>
I don't think my proposal address the use cases you are describing.
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/.
--------------040708000902030300080800
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 29/01/15 00:33, Klaim - Jo=C3=ABl Lam=
otte
a =C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:CAOU91OPLEzLBhvJPy9JKApN0=3DrUPbsjG5GkGXtzfLpxm3r_5uA@mail.gmai=
l.com"
type=3D"cite">
<div dir=3D"ltr"><br>
<div class=3D"gmail_extra"><br>
<div class=3D"gmail_quote">On Wed, Jan 28, 2015 at 7:31 PM,
Vicente J. Botet Escriba <span dir=3D"ltr"><<a
moz-do-not-send=3D"true"
href=3D"mailto:vicente.botet@wanadoo.fr" target=3D"_blank">=
vicente.botet@wanadoo.fr</a>></span>
wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-=
style:solid;padding-left:1ex">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>Could you be more explicit? What would you like to
be added?<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Well the motivation section says=C2=A0</div>
<div>"The goal is to be able to have a generic make factory
that can be used in place of..."</div>
<div>and goes on explaining what the proposal wants to
achieve, but that do not=C2=A0</div>
<div>explain what problem this is solving or why it would be
useful to have the feature described available.</div>
<div>Saying that the make<> function would replace the
other functions is not what I call a "motivation".</div>
<div><br>
</div>
<div>However, the rational section have good points which I
think should be at least mentionned in</div>
<div>the motivation section, then developped in the rational
section.</div>
</div>
</div>
</div>
</blockquote>
I think Got it. Should I add how having the generic make<TC>
form helps to make more generic code.<br>
<blockquote
cite=3D"mid:CAOU91OPLEzLBhvJPy9JKApN0=3DrUPbsjG5GkGXtzfLpxm3r_5uA@mail.gmai=
l.com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">
<div class=3D"gmail_quote">
<div>=C2=A0</div>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-=
style:solid;padding-left:1ex">
<div bgcolor=3D"#FFFFFF" text=3D"#000000"><span class=3D"">
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">Other than that I found
before that adding make function for eah type
that need it was indeed not=C2=A0</div>
<div class=3D"gmail_extra">very generic. These
proposal seem useful, in particular if it allows
another function needing to=C2=A0</div>
<div class=3D"gmail_extra">to be able to build
objects in a customized way even if the type
dont have new overloaded.</div>
<div class=3D"gmail_extra"><br>
</div>
</div>
<br>
</blockquote>
</span> I'm missing the last point. What do you mean by
" even if the type dont have new overloaded"?<span
class=3D""><font color=3D"#888888"><br>
<br>
</font></span></div>
</blockquote>
<div><br>
</div>
<div><br>
</div>
<div>I meant that if I have a type like this:</div>
<div><br>
</div>
<div>template< class T ></div>
<div>class CustomContainer</div>
<div>{</div>
<div>//...</div>
<div>=C2=A0 =C2=A0 std::vector<std::unique_ptr<T>>
m_elements;</div>
<div>public:</div>
<div><br>
</div>
<div>=C2=A0 =C2=A0template< class... Args></div>
<div>=C2=A0 =C2=A0void create_record( Args&&... args )<=
/div>
<div>=C2=A0 =C2=A0{</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0// ....</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0m_elements.emplace_back(
make<std::unique_ptr<T>>(
std::forward<Args>(args)...) );</div>
<div>=C2=A0 =C2=A0}</div>
<div>};</div>
<div><br>
</div>
<div>I might be wrong but it seem to me to be easy to
overload make<unique_ptr<T>>()</div>
<div>if the user wants Ts to be built in a specific way,
like a pool for example,</div>
<div>and it seems to me more flexible than overloading new
for T and expect the library code</div>
<div>to actually call new.</div>
</div>
</div>
</div>
</blockquote>
I understand the need to specialize the emplace factory for
unique_ptr<UserType>. I will check if this can be done with
the proposed customization interface. It is clear that specializing
a trait would make it possible.<br>
<br>
The proposal doesn't consider specific make factories taking an
allocator. <br>
<blockquote
cite=3D"mid:CAOU91OPLEzLBhvJPy9JKApN0=3DrUPbsjG5GkGXtzfLpxm3r_5uA@mail.gmai=
l.com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">
<div class=3D"gmail_quote">
<div>It might be uncommon anyway but for entity-semantic
types it looks useful to me.</div>
<div><br>
</div>
<div>Question:</div>
<div>what would this do?</div>
<div><br>
</div>
<div>auto x =3D make<K>(); <br>
</div>
</div>
</div>
</div>
</blockquote>
The type of x should be apply<K, void>::type.<br>
<blockquote
cite=3D"mid:CAOU91OPLEzLBhvJPy9JKApN0=3DrUPbsjG5GkGXtzfLpxm3r_5uA@mail.gmai=
l.com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">
<div class=3D"gmail_quote">
<div><br>
</div>
<div>What about this call to return make_unique by default
and therefore allow=C2=A0</div>
<div>the author of K to specify a make<T>() overload
for the general case?</div>
</div>
</div>
</div>
</blockquote>
The default forwards to the constructor or emplace constructor. No
allocation is intended in general.<br>
The initial intent of the proposal is not restrict to smart
pointers. I think that what you are looking for is more a
make_smart_pointer factory, isn't it?<br>
<br>
<blockquote
cite=3D"mid:CAOU91OPLEzLBhvJPy9JKApN0=3DrUPbsjG5GkGXtzfLpxm3r_5uA@mail.gmai=
l.com"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"gmail_extra">
<div class=3D"gmail_quote">
<div>=C2=A0</div>
<div>It's just raw ideas I got reading your paper.</div>
<div><br>
</div>
<div>=C2=A0</div>
<br>
</div>
</div>
</div>
</blockquote>
I don't think my proposal address the use cases you are describing.<br>
Vicente<br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--------------040708000902030300080800--
.
Author: Scott Prager <splinterofchaos@gmail.com>
Date: Wed, 28 Jan 2015 22:24:59 -0800 (PST)
Raw View
------=_Part_41_1816567387.1422512699794
Content-Type: multipart/alternative;
boundary="----=_Part_42_273063910.1422512699794"
------=_Part_42_273063910.1422512699794
Content-Type: text/plain; charset=UTF-8
On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5, David Krauss wrote:
> I imagine EWG asking these questions:
>
> 1. Why is make<std::shared_pointer> better than std::make_shared? Do the
> benefits of this renaming justify the cost in complexity?
>
Personally, I find this feature more intriguing for use with user-defined
classes. I find myself writing "make_" functions all the time for every
type-dependent class I write, so I've been using something similar to
Hana's create class for a while. However, since I don't use "in_place_t" at
all, it would be more work to continue using that than switch to this since
I'd still have to overload it for every type.
Though, one thing I notice is that this implementation doesn't reduce
"std::reference_wrapper" to a normal reference like "std::make_pair" or
"_tuple". I actually think that would be a generally good feature.
--
---
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_42_273063910.1422512699794
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5=
, David Krauss wrote:<div> </div><blockquote class=3D"gmail_quote" sty=
le=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left=
: 1ex;"><div style=3D"word-wrap:break-word"><div><div></div><div>I imagine =
EWG asking these questions:</div><div><br></div><div>1. Why is <font face=
=3D"Courier">make<std::shared_pointer></font> better than <font face=
=3D"Courier">std::make_shared</font>? Do the benefits of this renaming just=
ify the cost in complexity?</div></div></div></blockquote><div><br></div><d=
iv>Personally, I find this feature more intriguing for use with user-define=
d classes. I find myself writing "make_" functions all the time for every t=
ype-dependent class I write, so I've been using something similar to Hana's=
create class for a while. However, since I don't use "in_place_t" at all, =
it would be more work to continue using that than switch to this since I'd =
still have to overload it for every type.</div><div><br></div><div>Though, =
one thing I notice is that this implementation doesn't reduce "std::referen=
ce_wrapper" to a normal reference like "std::make_pair" or "_tuple". I actu=
ally think that would be a generally good feature.</div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
------=_Part_42_273063910.1422512699794--
------=_Part_41_1816567387.1422512699794--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Thu, 29 Jan 2015 07:32:07 +0100
Raw View
This is a multi-part message in MIME format.
--------------040505050007010804060600
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 29/01/15 01:52, David Krauss a =C3=A9crit :
>
>> On 2015=E2=80=9301=E2=80=9329, at 8:39 AM, Ville Voutilainen=20
>> <ville.voutilainen@gmail.com <mailto:ville.voutilainen@gmail.com>> wrote=
:
>>
>> On 29 January 2015 at 02:36, David Krauss <potswa@gmail.com=20
>> <mailto:potswa@gmail.com>> wrote:
>>> I imagine EWG asking these questions:
>>> 1. Why is make<std::shared_pointer> better than std::make_shared? Do th=
e
>>> benefits of this renaming justify the cost in complexity?
>>
Please note that the intent of the library is specific to smart pointer=20
factories.
C++ separates allocation and construction
Lets say we have a function that return a pointer to T
template <class T>
T* f() {
T a;
...
return new T(a);
}
When single ownership is required, the function could return a unique_ptr<T=
>
template <class T>
unique_ptr<T> f() {
T a;
...
return make_unique<T>(a);
}
When shared ownership is required, the function could return a shared_ptr<T=
>
template <class T>
shared_ptr<T> f() {
T a;
...
return make_shared<T>(a);
}
When it is up to the user to select the ownership, the function would=20
return a type deduced from the type constructor and the type T
template <class TC, class T>
apply<TC,T> f() {
T a;
...
return make<TC>(a);
}
Now this function can be used not only with (smart)pointer types, but=20
also with optional and expected.
>> EWG wouldn't ask the second question, because there is no renaming=20
>> proposed.
>
Right. The intent is not to replace make_shared<T>(a) by=20
make<shared_ptr<_t>>(a) when we know we want shared ownership.
I will take the question as "Would the benefits of this use justify the=20
cost in complexity? What do you find complex? The customization or the=20
use? Would you prefer a trait customization? I understand that making=20
algorithms that work for any sequence (provide begin/end) are easier=20
than algorithms that work for any type constructor, as them need an=20
additional template parameter.
> I mean, in the sense that make< std::shared_pointer > is just another=20
> name for std::make_shared. The former isn=E2=80=99t inherently more gener=
ic,=20
> it=E2=80=99s just a different token sequence. (Unless you count the addit=
ion=20
> of _t, but that=E2=80=99s the second question: why couldn=E2=80=99t we ha=
ve=20
> std::make_unique< _t, my_deleter >?)
>
With my proposal this would be
std::make<std::unique_ptr<std::_t, my_deleter>>(x);
However std::unique_ptr<std::_t, my_deleter> could be a template=20
parameter of the function, and so the code will be
std::make<TC>(x);
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/.
--------------040505050007010804060600
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 29/01/15 01:52, David Krauss a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:0AF9985B-F61D-4FF6-B614-84FC06911667@gmail.com"
type=3D"cite">
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf=
-8">
<br class=3D"">
<div>
<blockquote type=3D"cite" class=3D"">
<div class=3D"">On 2015=E2=80=9301=E2=80=9329, at 8:39 AM, Ville =
Voutilainen
<<a moz-do-not-send=3D"true"
href=3D"mailto:ville.voutilainen@gmail.com" class=3D"">ville.=
voutilainen@gmail.com</a>>
wrote:</div>
<br class=3D"Apple-interchange-newline">
<div class=3D"">On 29 January 2015 at 02:36, David Krauss <<a
moz-do-not-send=3D"true" href=3D"mailto:potswa@gmail.com"
class=3D"">potswa@gmail.com</a>> wrote:<br class=3D"">
<blockquote type=3D"cite" class=3D"">I imagine EWG asking these
questions:<br class=3D"">
1. Why is make<std::shared_pointer> better than
std::make_shared? Do the<br class=3D"">
benefits of this renaming justify the cost in complexity?<br
class=3D"">
</blockquote>
<br class=3D"">
</div>
</blockquote>
</div>
</blockquote>
<br>
Please note that the intent of the library is specific to smart
pointer factories.<br>
C++ separates allocation and construction <br>
<br>
Lets say we have a function that return a pointer to T<br>
<br>
template <class T><br>
T* f() {<br>
=C2=A0 T a;<br>
=C2=A0 ...<br>
=C2=A0 return new T(a);<br>
}<br>
<br>
When single ownership is required, the function could return a
unique_ptr<T><br>
<br>
template <class T><br>
unique_ptr<T> f() {<br>
=C2=A0 T a;<br>
=C2=A0 ...<br>
=C2=A0=C2=A0
return make_unique<T>(a);<br>
}<br>
<br>
When shared ownership is required, the function could return a
shared_ptr<T><br>
<br>
template <class T><br>
shared_ptr<T> f() {<br>
=C2=A0 T a;<br>
=C2=A0 ...<br>
=C2=A0
return make_shared<T>(a);<br>
}<br>
<br>
When it is up to the user to select the ownership, the function
would return a type deduced from the type constructor and the type T<br=
>
<br>
template <class TC, class T><br>
apply<TC,T> f() {<br>
=C2=A0 T a;<br>
=C2=A0 ...<br>
=C2=A0 return make<TC>(a);<br>
}=C2=A0 <br>
<br>
Now this function can be used not only with (smart)pointer types,
but also with optional and expected.<br>
<br>
<blockquote
cite=3D"mid:0AF9985B-F61D-4FF6-B614-84FC06911667@gmail.com"
type=3D"cite">
<div>
<blockquote type=3D"cite" class=3D"">
<div class=3D"">EWG wouldn't ask the second question, because
there is no renaming proposed.<br class=3D"">
</div>
</blockquote>
</div>
<br class=3D"">
</blockquote>
Right. The intent is not to replace make_shared<T>(a) by
make<shared_ptr<_t>>(a) when we know we want shared
ownership. <br>
<br>
I will take the question as "Would the benefits of this use justify
the cost in complexity? What do you find complex? The customization
or the use? Would you prefer a trait customization? I understand
that making algorithms that work for any sequence (provide
begin/end) are easier than algorithms that work for any type
constructor, as them need an additional template parameter. <br>
<br>
<blockquote
cite=3D"mid:0AF9985B-F61D-4FF6-B614-84FC06911667@gmail.com"
type=3D"cite">
<div class=3D"">I mean, in the sense that <font class=3D""
face=3D"Courier">make< std::shared_pointer ></font> is
just another name for <font class=3D"" face=3D"Courier">std::make_s=
hared</font>.
The former isn=E2=80=99t inherently more generic, it=E2=80=99s just=
a different
token sequence. (Unless you count the addition of=C2=A0<font class=
=3D""
face=3D"Courier">_t</font>, but that=E2=80=99s the second questio=
n: why
couldn=E2=80=99t we have <font class=3D"" face=3D"Courier">std::mak=
e_unique<
_t, my_deleter ></font>?)</div>
<br>
</blockquote>
With my proposal this would be <br>
<br>
=C2=A0 std::make<std::unique_ptr<std::_t, my_deleter>>(x);<=
br>
<br>
However std::unique_ptr<std::_t, my_deleter> could be a
template parameter of the function, and so the code will be<br>
<br>
=C2=A0 std::make<TC>(x);<br>
<br>
Vicente<br>
<br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--------------040505050007010804060600--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Thu, 29 Jan 2015 07:41:17 +0100
Raw View
This is a multi-part message in MIME format.
--------------010209020402070002060100
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 29/01/15 02:02, David Krauss a =C3=A9crit :
>
>> On 2015=E2=80=9301=E2=80=9329, at 8:36 AM, David Krauss <potswa@gmail.co=
m=20
>> <mailto:potswa@gmail.com>> wrote:
>>
>> 3. Should the user never qualifymakewithstd::because it should be=20
>> found by ADL? Why or why not?
>
> As long as I=E2=80=99m attempting to phrase my questions as they might be=
=20
> posed by EWG, this one is wrong too. This might be a closer approximation=
:
>
> 3. The paper shows examples of usage inside namespace std, but it=20
> needs to show how the user should refer to make and _t. If it=E2=80=99s=
=20
> intended, show how to customize non-standard classes, and standard=20
> library implementers will extrapolate from there.
>
Agreed. I'll add some user level customizations and how the user make=20
use of make and _t.
To find make by ADL, the user will need to use the make customization=20
point instead of the std::make function.
make(type<TC>{}, a);
The std::make function just forwards to the customization point. The=20
default customization point uses the associated constructor of=20
apply<TC,T>, default, copy and emplace constructors.
Does this answer the question?
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/.
--------------010209020402070002060100
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 29/01/15 02:02, David Krauss a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:E0F72536-821F-4AA3-BDE9-994C9E0E1B87@gmail.com"
type=3D"cite">
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf=
-8">
<br class=3D"">
<div>
<blockquote type=3D"cite" class=3D"">
<div class=3D"">On 2015=E2=80=9301=E2=80=9329, at 8:36 AM, David =
Krauss <<a
moz-do-not-send=3D"true" href=3D"mailto:potswa@gmail.com"
class=3D"">potswa@gmail.com</a>> wrote:</div>
<br class=3D"Apple-interchange-newline">
<div class=3D""><span style=3D"font-family: Helvetica; font-size:
12px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
normal; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows:
auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;
float: none; display: inline !important;" class=3D"">3.
Should the user never qualify<span
class=3D"Apple-converted-space">=C2=A0</span></span><font
class=3D"" style=3D"font-size: 12px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" face=3D"Courier">make</font>=
<span
style=3D"font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; float:
none; display: inline !important;" class=3D""><span
class=3D"Apple-converted-space">=C2=A0</span>with<span
class=3D"Apple-converted-space">=C2=A0</span></span><font
class=3D"" style=3D"font-size: 12px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" face=3D"Courier">std::</font=
><span
style=3D"font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px; float:
none; display: inline !important;" class=3D""><span
class=3D"Apple-converted-space">=C2=A0</span>because it sho=
uld
be found by ADL? Why or why not?</span></div>
</blockquote>
</div>
<br class=3D"">
<div class=3D"">As long as I=E2=80=99m attempting to phrase my questi=
ons as
they might be posed by EWG, this one is wrong too. This might be
a closer approximation:</div>
<div class=3D""><br class=3D"">
</div>
<div class=3D"">3. The paper shows examples of usage inside <font
class=3D"" face=3D"Courier">namespace std</font>, but it needs to
show how the user should refer to <font class=3D"" face=3D"Courier"=
>make</font>
and <font class=3D"" face=3D"Courier">_t</font>. If it=E2=80=99s in=
tended,
show how to customize non-standard classes, and standard library
implementers will extrapolate from there.</div>
<br>
</blockquote>
Agreed. I'll add some user level customizations and how the user
make use of make and _t.<br>
<br>
To find make by ADL, the user will need to use the make
customization point instead of the std::make function. <br>
<br>
make(type<TC>{}, a);<br>
<br>
The std::make function just forwards to the customization point. The
default customization point uses the associated constructor of
apply<TC,T>, default, copy and emplace constructors.<br>
<br>
Does this answer the question?<br>
<br>
Vicente<br>
<br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--------------010209020402070002060100--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Thu, 29 Jan 2015 07:50:46 +0100
Raw View
This is a multi-part message in MIME format.
--------------000709010602060005040001
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 29/01/15 07:24, Scott Prager a =C3=A9crit :
>
>
> On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5, David Krauss wrote:
>
> I imagine EWG asking these questions:
>
> 1. Why is make<std::shared_pointer> better than std::make_shared?
> Do the benefits of this renaming justify the cost in complexity?
>
>
> Personally, I find this feature more intriguing for use with=20
> user-defined classes. I find myself writing "make_" functions all the=20
> time for every type-dependent class I write, so I've been using=20
> something similar to Hana's create class for a while. However, since I=20
> don't use "in_place_t" at all, it would be more work to continue using=20
> that than switch to this since I'd still have to overload it for every=20
> type.
Sorry, could you clarify what "that" and "this" referees to in the=20
previous sentence?
>
> Though, one thing I notice is that this implementation doesn't reduce=20
> "std::reference_wrapper" to a normal reference like "std::make_pair"=20
> or "_tuple". I actually think that would be a generally good feature.
>
Good point. I'd to take care of this case.
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/.
--------------000709010602060005040001
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 29/01/15 07:24, Scott Prager a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:8bf343b1-8287-4e33-89eb-ffd6df87209d@isocpp.org"
type=3D"cite">
<div dir=3D"ltr"><br>
<br>
On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5, David Krauss
wrote:
<div>=C2=A0</div>
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div style=3D"word-wrap:break-word">
<div>
<div>I imagine EWG asking these questions:</div>
<div><br>
</div>
<div>1. Why is <font face=3D"Courier">make<std::shared_poi=
nter></font>
better than <font face=3D"Courier">std::make_shared</font>?
Do the benefits of this renaming justify the cost in
complexity?</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Personally, I find this feature more intriguing for use
with user-defined classes. I find myself writing "make_"
functions all the time for every type-dependent class I write,
so I've been using something similar to Hana's create class
for a while. However, since I don't use "in_place_t" at all,
it would be more work to continue using that than switch to
this since I'd still have to overload it for every type.</div>
</div>
</blockquote>
Sorry, could you clarify what "that" and "this" referees to in the
previous sentence? <br>
<blockquote
cite=3D"mid:8bf343b1-8287-4e33-89eb-ffd6df87209d@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div><br>
</div>
<div>Though, one thing I notice is that this implementation
doesn't reduce "std::reference_wrapper" to a normal reference
like "std::make_pair" or "_tuple". I actually think that would
be a generally good feature.</div>
</div>
<br>
</blockquote>
Good point. I'd to take care of this case.<br>
<br>
Vicente<br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--------------000709010602060005040001--
.
Author: Scott Prager <splinterofchaos@gmail.com>
Date: Thu, 29 Jan 2015 11:42:38 -0800 (PST)
Raw View
------=_Part_704_772692708.1422560558384
Content-Type: multipart/alternative;
boundary="----=_Part_705_812729947.1422560558384"
------=_Part_705_812729947.1422560558384
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Thursday, January 29, 2015 at 1:50:47 AM UTC-5, Vicente J. Botet Escriba=
=20
wrote:
>
> Le 29/01/15 07:24, Scott Prager a =C3=A9crit :
> =20
>
>
> On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5, David Krauss wrote:=
=20
> =20
>
>> I imagine EWG asking these questions:
>>
>> 1. Why is make<std::shared_pointer> better than std::make_shared? Do=20
>> the benefits of this renaming justify the cost in complexity?
>> =20
>
> Personally, I find this feature more intriguing for use with=20
> user-defined classes. I find myself writing "make_" functions all the tim=
e=20
> for every type-dependent class I write, so I've been using something=20
> similar to Hana's create class for a while. However, since I don't use=20
> "in_place_t" at all, it would be more work to continue using that than=20
> switch to this since I'd still have to overload it for every type.
> =20
> Sorry, could you clarify what "that" and "this" referees to in the=20
> previous sentence?=20
>
Sorry, perhaps a bit unreferenced, but currently, after writing a type,=20
*Something*, I make a construction function using a utility I call *MakeT*.
constexpr auto something =3D MakeT<Something>{};
// ...
std::vector<X> xs;
std::vector<Something> ys;
std::transform(xs.begin(), xs.end(), std::back_inserter(ys), something);
I also might wrap *MakeT* in some sort of decorator to alter how it's made=
=20
or box it within another type. However, with this solution...
namespace std::experimental {=20
template <> struct Something<_t> : lift<Something>;=20
template <class T> struct type_constructor<Something<T>> : Something<_t>;=
=20
}=20
// ...=20
std::transform(xs.begin(), xs.end(), std::back_inserter(ys), [&](auto& x) {=
=20
return make<Something>(x); });=20
Since doing that for every type I make is considerably more work than using=
=20
*MakeT*, I couldn't see myself using *std::make* over *MakeT.* Which is not=
=20
to say that I don't find several advantages to your proposal over my *MakeT=
* or=20
Hana's *create.*=20
--=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/.
------=_Part_705_812729947.1422560558384
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Thursday, January 29, 2015 at 1:50:47 AM UTC-5,=
Vicente J. Botet Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"=
margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;=
">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>Le 29/01/15 07:24, Scott Prager a
=C3=A9crit :<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr"><br>
<br>
On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5, David Krauss
wrote:
<div> </div>
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
<div style=3D"word-wrap:break-word">
<div>
<div>I imagine EWG asking these questions:</div>
<div><br>
</div>
<div>1. Why is <font face=3D"Courier">make<std::shared_poi=
nter></font>
better than <font face=3D"Courier">std::make_shared</font>?
Do the benefits of this renaming justify the cost in
complexity?</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Personally, I find this feature more intriguing for use
with user-defined classes. I find myself writing "make_"
functions all the time for every type-dependent class I write,
so I've been using something similar to Hana's create class
for a while. However, since I don't use "in_place_t" at all,
it would be more work to continue using that than switch to
this since I'd still have to overload it for every type.</div>
</div>
</blockquote>
Sorry, could you clarify what "that" and "this" referees to in the
previous sentence? <br></div></blockquote><div><br></div><div>Sorry, pe=
rhaps a bit unreferenced, but currently, after writing a type, <i>Something=
</i>, I make a construction function using a utility I call <i>MakeT</i>.</=
div><div><br></div><div class=3D"prettyprint" style=3D"border: 1px solid rg=
b(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 25=
0);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">constexpr</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> something </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">MakeT</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify"><</span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">Something</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">>{};</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">// .=
...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>std<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">vector</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">X</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">></span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> xs</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>std</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">vector</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
><</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Somet=
hing</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ys</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>std</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">transform</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">xs</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">.</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">begin</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">(),</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> xs=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">end</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">(),</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">back_inserter</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">ys</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">),</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> something</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">);</span></div></code></div><div><br></div><div> I also might =
wrap <i>MakeT</i> in some sort of decorator to alter how it's made or =
box it within another type. However, with this solution...</div><div><br></=
div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187=
); word-wrap: break-word; background-color: rgb(250, 250, 250);"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;=
" class=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">experimental </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> <br></span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">template</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"><&g=
t;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Something</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">_t</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> lift</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy"><</span><span style=3D"color: #606;" class=3D"styled-by-prettify">So=
mething</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>=
;;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br></s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">template</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> type_constructor</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #606;" class=3D"st=
yled-by-prettify">Something</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">>></span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">Something</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">_t</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">>;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> <br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> <br><br></span><span style=3D"color: #800;" class=3D"styled=
-by-prettify">// ... </span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>std</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
transform</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">xs</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">begin</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(),</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> xs</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">.</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">end</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(),</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">back_ins=
erter</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">ys</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">),</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">[&](</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">&</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> x</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">return</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> make</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">Something</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">>(</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">x</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">});</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span></div></code></div><div><div><span style=3D"font-size: 13.3333339=
691162px;"><br></span>Since doing that for every type I make is considerabl=
y more work than using <i>MakeT</i>, I couldn't see myself using <i>std::ma=
ke</i> over <i>MakeT.</i> Which is not to say that I don't find s=
everal advantages to your proposal over my <i>MakeT</i> or Hana's <i>c=
reate.</i> </div></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
------=_Part_705_812729947.1422560558384--
------=_Part_704_772692708.1422560558384--
.
Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Thu, 29 Jan 2015 17:56:58 -0800 (PST)
Raw View
------=_Part_247_1722772640.1422583018078
Content-Type: multipart/alternative;
boundary="----=_Part_248_117747979.1422583018078"
------=_Part_248_117747979.1422583018078
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Thursday, January 29, 2015 at 11:42:38 AM UTC-8, Scott Prager wrote:
>
> On Thursday, January 29, 2015 at 1:50:47 AM UTC-5, Vicente J. Botet=20
> Escriba wrote:
>>
>> Le 29/01/15 07:24, Scott Prager a =C3=A9crit :
>> =20
>>
>>
>> On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5, David Krauss wrote:=
=20
>> =20
>>
>>> I imagine EWG asking these questions:
>>>
>>> 1. Why is make<std::shared_pointer> better than std::make_shared? Do=
=20
>>> the benefits of this renaming justify the cost in complexity?
>>> =20
>>
>> Personally, I find this feature more intriguing for use with=20
>> user-defined classes. I find myself writing "make_" functions all the ti=
me=20
>> for every type-dependent class I write, so I've been using something=20
>> similar to Hana's create class for a while. However, since I don't use=
=20
>> "in_place_t" at all, it would be more work to continue using that than=
=20
>> switch to this since I'd still have to overload it for every type.
>> =20
>> Sorry, could you clarify what "that" and "this" referees to in the=20
>> previous sentence?=20
>>
>
> Sorry, perhaps a bit unreferenced, but currently, after writing a type,=
=20
> *Something*, I make a construction function using a utility I call *MakeT=
*
> .
>
> constexpr auto something =3D MakeT<Something>{};
> // ...
> std::vector<X> xs;
> std::vector<Something> ys;
> std::transform(xs.begin(), xs.end(), std::back_inserter(ys), something);
>
>
I'm definitely in the dark as to the purpose of this proposal, so this is=
=20
probably a dumb question; but in the above code snippet, are you using=20
something as a sort of "call-the-constructor function", i.e., is it exactly=
=20
equivalent to
constexpr auto something =3D [](auto&&... args) { return=20
Something(std::forward<decltype(args)>(args)...); };
and, if overload sets were first-class citizens in C++, could you simply=20
write
std::transform(xs.begin(), xs.end(), std::back_inserter(ys),=20
Something::Something);
? Honestly not trying to derail the thread onto a discussion of overload=
=20
sets; just asking if that's the purpose of your MakeT, and if it's=20
equivalent to the generic lambda above, or if I've misunderstood its=20
purpose and implementation.
=20
> I also might wrap *MakeT* in some sort of decorator to alter how it's=20
> made or box it within another type. However, with this solution...
>
> namespace std::experimental {=20
> template <> struct Something<_t> : lift<Something>;=20
> template <class T> struct type_constructor<Something<T>> : Something<_t>;=
=20
> }=20
>
> // ...=20
> std::transform(xs.begin(), xs.end(), std::back_inserter(ys), [&](auto& x)=
=20
> { return make<Something>(x); });
>
Could you explain to me what lift and reverse_lift represent in this code?=
=20
Also, is
template <> struct Something<_t> : lift<Something>;=20
a typo for
template <> struct Something<_t> : lift<Something> {};
or is the former syntax actually valid? Without seeing the definition of=20
lift, it's hard to tell.
Thanks,
Arthur
--=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/.
------=_Part_248_117747979.1422583018078
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Thursday, January 29, 2015 at 11:42:38 AM UTC-8=
, Scott Prager wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">On Thursday, January 29, 2015 at 1:50:47 AM UTC-5, Vicente J. Bote=
t Escriba wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-=
left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>Le 29/01/15 07:24, Scott Prager a
=C3=A9crit :<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr"><br>
<br>
On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5, David Krauss
wrote:
<div> </div>
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
<div style=3D"word-wrap:break-word">
<div>
<div>I imagine EWG asking these questions:</div>
<div><br>
</div>
<div>1. Why is <font face=3D"Courier">make<std::shared_poi=
nter></font>
better than <font face=3D"Courier">std::make_shared</font>?
Do the benefits of this renaming justify the cost in
complexity?</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Personally, I find this feature more intriguing for use
with user-defined classes. I find myself writing "make_"
functions all the time for every type-dependent class I write,
so I've been using something similar to Hana's create class
for a while. However, since I don't use "in_place_t" at all,
it would be more work to continue using that than switch to
this since I'd still have to overload it for every type.</div>
</div>
</blockquote>
Sorry, could you clarify what "that" and "this" referees to in the
previous sentence? <br></div></blockquote><div><br></div><div>Sorry, pe=
rhaps a bit unreferenced, but currently, after writing a type, <i>Something=
</i>, I make a construction function using a utility I call <i>MakeT</i>.</=
div><div><br></div><div style=3D"border:1px solid rgb(187,187,187);word-wra=
p:break-word;background-color:rgb(250,250,250)"><code><div><span style=3D"c=
olor:#008">constexpr</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">auto</span><span style=3D"color:#000"> something </span><sp=
an style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span =
style=3D"color:#606">MakeT</span><span style=3D"color:#660"><</span><spa=
n style=3D"color:#606">Something</span><span style=3D"color:#660">>{};</=
span><span style=3D"color:#000"><br></span><span style=3D"color:#800">// ..=
..</span><span style=3D"color:#000"><br>std</span><span style=3D"color:#660"=
>::</span><span style=3D"color:#000">vector</span><span style=3D"color:#660=
"><</span><span style=3D"color:#000">X</span><span style=3D"color:#660">=
></span><span style=3D"color:#000"> xs</span><span style=3D"color:#660">=
;</span><span style=3D"color:#000"><br>std</span><span style=3D"color:#660"=
>::</span><span style=3D"color:#000">vector</span><span style=3D"color:#660=
"><</span><span style=3D"color:#606">Something</span><span style=3D"colo=
r:#660">></span><span style=3D"color:#000"> ys</span><span style=3D"colo=
r:#660">;</span><span style=3D"color:#000"><br>std</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#000">transform</span><span style=3D=
"color:#660">(</span><span style=3D"color:#000">xs</span><span style=3D"col=
or:#660">.</span><span style=3D"color:#008">begin</span><span style=3D"colo=
r:#660">(),</span><span style=3D"color:#000"> xs</span><span style=3D"color=
:#660">.</span><span style=3D"color:#008">end</span><span style=3D"color:#6=
60">(),</span><span style=3D"color:#000"> std</span><span style=3D"color:#6=
60">::</span><span style=3D"color:#000">back_inserter</span><span style=3D"=
color:#660">(</span><span style=3D"color:#000">ys</span><span style=3D"colo=
r:#660">),</span><span style=3D"color:#000"> something</span><span style=3D=
"color:#660">);</span></div></code></div><div><br></div></div></blockquote>=
<div><br></div><div>I'm definitely in the dark as to the purpose of this pr=
oposal, so this is probably a dumb question; but in the above code snippet,=
are you using something as a sort of "call-the-constructor function", i.e.=
, is it exactly equivalent to</div><div><br></div><font face=3D"courier new=
, monospace"> constexpr auto something =3D [](auto&&..=
.. args) { return Something(std::forward<decltype(args)>(args)...); };=
<br></font><br><div>and, if overload sets were first-class citizens in C++,=
could you simply write<br></div><div><br></div><div><font face=3D"courier =
new, monospace"> std::transform(xs.begin(), xs.end(), std::bac=
k_inserter(ys), Something::Something);</font></div><div><br></div><div>? &n=
bsp;Honestly not trying to derail the thread onto a discussion of overload =
sets; just asking if that's the purpose of your MakeT, and if it's equivale=
nt to the generic lambda above, or if I've misunderstood its purpose and im=
plementation.</div><div><br></div><div> </div><blockquote class=3D"gma=
il_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid=
;padding-left: 1ex;"><div dir=3D"ltr"><div>I also might wrap <i>MakeT</i>&n=
bsp;in some sort of decorator to alter how it's made or box it within anoth=
er type. However, with this solution...</div><div><br></div><div style=3D"b=
order:1px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(=
250,250,250)"><code><div><span style=3D"color:#008">namespace</span><span s=
tyle=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span st=
yle=3D"color:#000">experimental </span><span style=3D"color:#660">{</span><=
span style=3D"color:#000"> <br></span><span style=3D"color:#008">template</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660"><>=
</span><span style=3D"color:#000"> </span><span style=3D"color:#008">struct=
</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Someth=
ing</span><span style=3D"color:#660"><</span><span style=3D"color:#000">=
_t</span><span style=3D"color:#660">></span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">:</span><span style=3D"color:#000"> lift<=
/span><span style=3D"color:#660"><</span><span style=3D"color:#606">Some=
thing</span><span style=3D"color:#660">>;</span><span style=3D"color:#00=
0"> <br></span><span style=3D"color:#008">template</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660"><</span><span style=3D"color=
:#008">class</span><span style=3D"color:#000"> T</span><span style=3D"color=
:#660">></span><span style=3D"color:#000"> </span><span style=3D"color:#=
008">struct</span><span style=3D"color:#000"> type_constructor</span><span =
style=3D"color:#660"><</span><span style=3D"color:#606">Something</span>=
<span style=3D"color:#660"><</span><span style=3D"color:#000">T</span><s=
pan style=3D"color:#660">>></span><span style=3D"color:#000"> </span>=
<span style=3D"color:#660">:</span><span style=3D"color:#000"> </span><span=
style=3D"color:#606">Something</span><span style=3D"color:#660"><</span=
><span style=3D"color:#000">_t</span><span style=3D"color:#660">>;</span=
><span style=3D"color:#000"> <br></span><span style=3D"color:#660">}</span>=
<span style=3D"color:#000"> <br><br></span><span style=3D"color:#800">// ..=
.. </span><span style=3D"color:#000"><br>std</span><span style=3D"color:#660=
">::</span><span style=3D"color:#000">transform</span><span style=3D"color:=
#660">(</span><span style=3D"color:#000">xs</span><span style=3D"color:#660=
">.</span><span style=3D"color:#008">begin</span><span style=3D"color:#660"=
>(),</span><span style=3D"color:#000"> xs</span><span style=3D"color:#660">=
..</span><span style=3D"color:#008">end</span><span style=3D"color:#660">(),=
</span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#000">back_inserter</span><span style=3D"color:#=
660">(</span><span style=3D"color:#000">ys</span><span style=3D"color:#660"=
>),</span><span style=3D"color:#000"> </span><span style=3D"color:#660">[&a=
mp;](</span><span style=3D"color:#008">auto</span><span style=3D"color:#660=
">&</span><span style=3D"color:#000"> x</span><span style=3D"color:#660=
">)</span><span style=3D"color:#000"> </span><span style=3D"color:#660">{</=
span><span style=3D"color:#000"> </span><span style=3D"color:#008">return</=
span><span style=3D"color:#000"> make</span><span style=3D"color:#660"><=
</span><span style=3D"color:#606">Something</span><span style=3D"color:#660=
">>(</span><span style=3D"color:#000">x</span><span style=3D"color:#660"=
>);</span><span style=3D"color:#000"> </span><span style=3D"color:#660">});=
</span></div></code></div><div><div></div></div></div></blockquote><div><br=
></div><div>Could you explain to me what <font face=3D"courier new, monospa=
ce">lift</font> and <font face=3D"courier new, monospace">reverse_lift</fon=
t> represent in this code? Also, is</div><div><br></div><div><span st=
yle=3D"font-family: monospace; color: rgb(0, 0, 136);"> templa=
te</span><span style=3D"font-family: monospace; color: rgb(0, 0, 0);"> =
;</span><span style=3D"font-family: monospace; color: rgb(102, 102, 0);">&l=
t;></span><span style=3D"font-family: monospace; color: rgb(0, 0, 0);">&=
nbsp;</span><span style=3D"font-family: monospace; color: rgb(0, 0, 136);">=
struct</span><span style=3D"font-family: monospace; color: rgb(0, 0, 0);">&=
nbsp;</span><span style=3D"font-family: monospace; color: rgb(102, 0, 102);=
">Something</span><span style=3D"font-family: monospace; color: rgb(102, 10=
2, 0);"><</span><span style=3D"font-family: monospace; color: rgb(0, 0, =
0);">_t</span><span style=3D"font-family: monospace; color: rgb(102, 102, 0=
);">></span><span style=3D"font-family: monospace; color: rgb(0, 0, 0);"=
> </span><span style=3D"font-family: monospace; color: rgb(102, 102, 0=
);">:</span><span style=3D"font-family: monospace; color: rgb(0, 0, 0);">&n=
bsp;lift</span><span style=3D"font-family: monospace; color: rgb(102, 102, =
0);"><</span><span style=3D"font-family: monospace; color: rgb(102, 0, 1=
02);">Something</span><span style=3D"font-family: monospace; color: rgb(102=
, 102, 0);">>;</span><span style=3D"font-family: monospace; color: rgb(0=
, 0, 0);"> </span></div><div><br>a typo for<br><br><span style=3D"font=
-family: monospace; color: rgb(0, 0, 136);"> template</span><s=
pan style=3D"font-family: monospace; color: rgb(0, 0, 0);"> </span><sp=
an style=3D"font-family: monospace; color: rgb(102, 102, 0);"><></spa=
n><span style=3D"font-family: monospace; color: rgb(0, 0, 0);"> </span=
><span style=3D"font-family: monospace; color: rgb(0, 0, 136);">struct</spa=
n><span style=3D"font-family: monospace; color: rgb(0, 0, 0);"> </span=
><span style=3D"font-family: monospace; color: rgb(102, 0, 102);">Something=
</span><span style=3D"font-family: monospace; color: rgb(102, 102, 0);"><=
;</span><span style=3D"font-family: monospace; color: rgb(0, 0, 0);">_t</sp=
an><span style=3D"font-family: monospace; color: rgb(102, 102, 0);">></s=
pan><span style=3D"font-family: monospace; color: rgb(0, 0, 0);"> </sp=
an><span style=3D"font-family: monospace; color: rgb(102, 102, 0);">:</span=
><span style=3D"font-family: monospace; color: rgb(0, 0, 0);"> lift</s=
pan><span style=3D"font-family: monospace; color: rgb(102, 102, 0);"><</=
span><span style=3D"font-family: monospace; color: rgb(102, 0, 102);">Somet=
hing</span><span style=3D"font-family: monospace; color: rgb(102, 102, 0);"=
>> {};</span><br></div><br>or is the former syntax actually valid? Witho=
ut seeing the definition of <font face=3D"courier new, monospace">lift</fon=
t>, it's hard to tell.<div><br></div><div>Thanks,</div><div>Arthur</div></d=
iv>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
------=_Part_248_117747979.1422583018078--
------=_Part_247_1722772640.1422583018078--
.
Author: Scott Prager <splinterofchaos@gmail.com>
Date: Thu, 29 Jan 2015 20:29:43 -0800 (PST)
Raw View
------=_Part_0_449530236.1422592183248
Content-Type: multipart/alternative;
boundary="----=_Part_1_2076531773.1422592183249"
------=_Part_1_2076531773.1422592183249
Content-Type: text/plain; charset=UTF-8
On Thursday, January 29, 2015 at 8:56:58 PM UTC-5, Arthur O'Dwyer wrote:
>
>> constexpr auto something = MakeT<Something>{};
>> // ...
>> std::vector<X> xs;
>> std::vector<Something> ys;
>> std::transform(xs.begin(), xs.end(), std::back_inserter(ys), something);
>>
>>
> I'm definitely in the dark as to the purpose of this proposal, so this is
> probably a dumb question; but in the above code snippet, are you using
> something as a sort of "call-the-constructor function", i.e., is it exactly
> equivalent to
>
> constexpr auto something = [](auto&&... args) { return
> Something(std::forward<decltype(args)>(args)...); };
>
More like:
auto something = [](auto...args) { return
Something<decltype(args)...>(std::forward<decltype(args)>(args)...); };
except for the `std::reference_wrapper` awareness mentioned earlier, and
`constexpr`-friendly. It seems I don't have a recent version online, here's
an old
version: https://github.com/splinterofchaos/Pure/blob/master/Functional.h#L26-L31
(The boost/hana version is linked somewhere in the prior posts.)
> and, if overload sets were first-class citizens in C++, could you simply
> write
>
> std::transform(xs.begin(), xs.end(), std::back_inserter(ys),
> Something::Something);
>
Except for *Something* having template arguments, theoretically, yes. It
reminds me that I do remember someone proposing that the compiler should be
able to deduce the type based on the template arguments.
auto p = std::pair(1, x); // deduced to std::pair<int, X>
but I don't remember what became of it. Also, around the time generic
lambdas were proposed, there were suggestions of using *[]function* to
represent an overload set, but I don't remember a solid proposal.
Still, even if C++ had these features, I don't think they'd obviate the
need for factory functions. For one thing, being able to construct a type
from a single value of another type is a necessity for functional
programming, For example, with the above, I might try and construct a vector
auto v = vector(5);
but this would be ambiguous since *std::vector<T>(int)* constructs a vector
of *n* elements rather than a vector with one element, *n*. But I would
expect
auto v = make<std::vector>(5);
to do as expected, if appropriately specified. Or perhaps *make()* should
be overloaded to accept an *initializer_list* for this type of construction.
auto v = make<std::vector>({5});
> Could you explain to me what lift and reverse_lift represent in this
> code? Also, is
>
> template <> struct Something<_t> : lift<Something>;
>
> a typo for
>
> template <> struct Something<_t> : lift<Something> {};
>
I just copied and pasted from the proposal's example of specializing
*std::optional* or something, although I think I got it wrong. See the
section of the OP's proposal, How to customize the uses of type holder _t
and the type_constructor?
<https://github.com/viboes/std-make/blob/master/doc/proposal/factories/DXXXX_factories.md#how-to-customize-the-uses-of-type-holder-_t-and-the-type_constructor>
Though, one thing that's just occurred to me, how might I specify a type
with more than one *_t*? What if I wanted to represent a dual, i. e.
dual(x, y) <=> std::make_pair(y, x)
Maybe that'd be *reverse_lift*, but then what if I wanted a braided type?
braid(x, y, z) <=> std::make_tuple(y, x, z)
It might almost make sense to use *std::placeholder::_n* instead, but
that'd be troublesome for variadic types like *std::tuple*, which is the
problem I have with *std::bind*.
--
---
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_1_2076531773.1422592183249
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Thursday, January 29, 2015 at 8:56:58 PM UTC-5,=
Arthur O'Dwyer wrote:<div> </div><blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-lef=
t: 1ex;"><div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin=
:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><div><br></div><div style=3D"border:1px solid rgb(187,187,187);wor=
d-wrap:break-word;background-color:rgb(250,250,250)"><code><div><span style=
=3D"color:#008">constexpr</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#008">auto</span><span style=3D"color:#000"> something </span>=
<span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#606">MakeT</span><span style=3D"color:#660"><</span><=
span style=3D"color:#606">Something</span><span style=3D"color:#660">>{}=
;</span><span style=3D"color:#000"><br></span><span style=3D"color:#800">//=
...</span><span style=3D"color:#000"><br>std</span><span style=3D"color:#6=
60">::</span><span style=3D"color:#000">vector</span><span style=3D"color:#=
660"><</span><span style=3D"color:#000">X</span><span style=3D"color:#66=
0">></span><span style=3D"color:#000"> xs</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"><br>std</span><span style=3D"color:#6=
60">::</span><span style=3D"color:#000">vector</span><span style=3D"color:#=
660"><</span><span style=3D"color:#606">Something</span><span style=3D"c=
olor:#660">></span><span style=3D"color:#000"> ys</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"><br>std</span><span style=3D"=
color:#660">::</span><span style=3D"color:#000">transform</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">xs</span><span style=3D"=
color:#660">.</span><span style=3D"color:#008">begin</span><span style=3D"c=
olor:#660">(),</span><span style=3D"color:#000"> xs</span><span style=3D"co=
lor:#660">.</span><span style=3D"color:#008">end</span><span style=3D"color=
:#660">(),</span><span style=3D"color:#000"> std</span><span style=3D"color=
:#660">::</span><span style=3D"color:#000">back_inserter</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">ys</span><span style=3D"=
color:#660">),</span><span style=3D"color:#000"> something</span><span styl=
e=3D"color:#660">);</span></div></code></div><div><br></div></div></blockqu=
ote><div><br></div><div>I'm definitely in the dark as to the purpose of thi=
s proposal, so this is probably a dumb question; but in the above code snip=
pet, are you using something as a sort of "call-the-constructor function", =
i.e., is it exactly equivalent to</div><div><br></div><font face=3D"courier=
new, monospace"> constexpr auto something =3D [](auto&&am=
p;... args) { return Something(std::forward<<wbr>decltype(args)>(args=
)...); };<br></font></div></blockquote><div><br></div><div>More like:</div>=
<div><br></div><div>auto something =3D [](auto...args) { return Something&l=
t;decltype(args)...>(std::forward<decltype(args)>(args)...); };</d=
iv><div><br></div><div>except for the `std::reference_wrapper` awareness me=
ntioned earlier, and `constexpr`-friendly. It seems I don't have a recent v=
ersion online, here's an old version: https://github.com/splinterofcha=
os/Pure/blob/master/Functional.h#L26-L31</div><div>(The boost/hana version =
is linked somewhere in the prior posts.)</div><div><br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px =
#ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><font face=3D"courier new, =
monospace"></font><br><div>and, if overload sets were first-class citizens =
in C++, could you simply write<br></div><div><br></div><div><font face=3D"c=
ourier new, monospace"> std::transform(xs.begin(), xs.end(), s=
td::back_inserter(ys), Something::Something);</font></div></div></blockquot=
e><div><br></div><div>Except for <i>Something</i> having template argu=
ments, theoretically, yes. It reminds me that I do remember someone proposi=
ng that the compiler should be able to deduce the type based on the templat=
e arguments.</div><div><br></div><div><div class=3D"prettyprint" style=3D"b=
order: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-colo=
r: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subpretty=
print"><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> p </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">pair</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=3D"st=
yled-by-prettify">1</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
x</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">// deduced to std::=
pair<int, X></span></div></code></div></div><div><br></div><div>but I=
don't remember what became of it. Also, around the time generic lambdas we=
re proposed, there were suggestions of using <i>[]function</i> to repr=
esent an overload set, but I don't remember a solid proposal.</div><div><br=
></div><div>Still, even if C++ had these features, I don't think they'd obv=
iate the need for factory functions. For one thing, being able to construct=
a type from a single value of another type is a necessity for functional p=
rogramming, For example, with the above, I might try and construct a vector=
</div><div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 1=
87, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><co=
de 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"> v </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> vector</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(</span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span></div></code></div></div><div>but this would be ambiguous since <i>st=
d::vector<T>(int)</i> constructs a vector of <i>n</i> elements r=
ather than a vector with one element, <i>n</i>. But I would expect</div><di=
v><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187);=
word-wrap: break-word; background-color: rgb(250, 250, 250);"><code 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"> v </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> make</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify">s=
td</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">vector</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">>(</span><span st=
yle=3D"color: #066;" class=3D"styled-by-prettify">5</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">);</span></div></code></div></div>=
<div>to do as expected, if appropriately specified. Or perhaps <i>make()</i=
> should be overloaded to accept an <i>initializer_list</i> =
for this type of construction.</div><div><div class=3D"prettyprint" style=
=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background=
-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">auto<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> v </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> make</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">std</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">vector</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">>({</span><span style=3D"color: #066;" class=3D"=
styled-by-prettify">5</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">});</span></div></code></div></div><div><br></div><div> </d=
iv><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;=
border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div></div=
><div>Could you explain to me what <font face=3D"courier new, monospace">li=
ft</font> and <font face=3D"courier new, monospace">reverse_lift</font> rep=
resent in this code? Also, is</div><div><br></div><div><span style=3D=
"font-family:monospace;color:rgb(0,0,136)"> template</span><sp=
an style=3D"font-family:monospace;color:rgb(0,0,0)"> </span><span styl=
e=3D"font-family:monospace;color:rgb(102,102,0)"><></span><span style=
=3D"font-family:monospace;color:rgb(0,0,0)"> </span><span style=3D"fon=
t-family:monospace;color:rgb(0,0,136)">struct</span><span style=3D"font-fam=
ily:monospace;color:rgb(0,0,0)"> </span><span style=3D"font-family:mon=
ospace;color:rgb(102,0,102)">Something</span><span style=3D"font-family:mon=
ospace;color:rgb(102,102,0)"><</span><span style=3D"font-family:monospac=
e;color:rgb(0,0,0)">_<wbr>t</span><span style=3D"font-family:monospace;colo=
r:rgb(102,102,0)">></span><span style=3D"font-family:monospace;color:rgb=
(0,0,0)"> </span><span style=3D"font-family:monospace;color:rgb(102,10=
2,0)">:</span><span style=3D"font-family:monospace;color:rgb(0,0,0)"> =
lift</span><span style=3D"font-family:monospace;color:rgb(102,102,0)"><<=
/span><span style=3D"font-family:monospace;color:rgb(102,0,102)">Something<=
/span><span style=3D"font-family:monospace;color:rgb(102,102,0)">>;</spa=
n><span style=3D"font-family:monospace;color:rgb(0,0,0)"> </span></div=
><div><br>a typo for<br><br><span style=3D"font-family:monospace;color:rgb(=
0,0,136)"> template</span><span style=3D"font-family:monospace=
;color:rgb(0,0,0)"> </span><span style=3D"font-family:monospace;color:=
rgb(102,102,0)"><></span><span style=3D"font-family:monospace;color:r=
gb(0,0,0)"> </span><span style=3D"font-family:monospace;color:rgb(0,0,=
136)">struct</span><span style=3D"font-family:monospace;color:rgb(0,0,0)">&=
nbsp;</span><span style=3D"font-family:monospace;color:rgb(102,0,102)">Some=
thing</span><span style=3D"font-family:monospace;color:rgb(102,102,0)"><=
</span><span style=3D"font-family:monospace;color:rgb(0,0,0)">_<wbr>t</span=
><span style=3D"font-family:monospace;color:rgb(102,102,0)">></span><spa=
n style=3D"font-family:monospace;color:rgb(0,0,0)"> </span><span style=
=3D"font-family:monospace;color:rgb(102,102,0)">:</span><span style=3D"font=
-family:monospace;color:rgb(0,0,0)"> lift</span><span style=3D"font-fa=
mily:monospace;color:rgb(102,102,0)"><</span><span style=3D"font-family:=
monospace;color:rgb(102,0,102)">Something</span><span style=3D"font-family:=
monospace;color:rgb(102,102,0)">> {};</span></div></div></blockquote><di=
v><br></div><div>I just copied and pasted from the proposal's example of sp=
ecializing <i>std::optional</i> or something, although I think I got it wro=
ng. See the section of the OP's proposal, <a href=3D"https://github.co=
m/viboes/std-make/blob/master/doc/proposal/factories/DXXXX_factories.md#how=
-to-customize-the-uses-of-type-holder-_t-and-the-type_constructor" style=3D=
"font-size: 13px;">How to customize the uses of type holder _t and the type=
_constructor?</a></div><div><br></div><div>Though, one thing that's just oc=
curred to me, how might I specify a type with more than one <i>_t</i>? What=
if I wanted to represent a dual, i. e.</div><div><div class=3D"prettyprint=
" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; bac=
kground-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">dual</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">x</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> y</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify"><=3D></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">make_pair</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
y</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> x</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">)</span></div></code></div=
>Maybe that'd be <i>reverse_lift</i>, but then what if I wanted a braided t=
ype?</div><div><div class=3D"prettyprint" style=3D"border: 1px solid rgb(18=
7, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"=
><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">braid</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">x</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> y</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> z</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify"><=3D></span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">make_tuple</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">y</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> x</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> z</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">)</span></div></code></=
div>It might almost make sense to use <i>std::placeholder::_n</i> inst=
ead, but that'd be troublesome for variadic types like <i>std::tuple</i>, w=
hich is the problem I have with <i>std::bind</i>.</div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
------=_Part_1_2076531773.1422592183249--
------=_Part_0_449530236.1422592183248--
.
Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Fri, 30 Jan 2015 07:06:58 +0100
Raw View
This is a multi-part message in MIME format.
--------------010608090501080106020307
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Le 29/01/15 20:42, Scott Prager a =C3=A9crit :
>
>
> On Thursday, January 29, 2015 at 1:50:47 AM UTC-5, Vicente J. Botet=20
> Escriba wrote:
>
> Le 29/01/15 07:24, Scott Prager a =C3=A9crit :
>>
>>
>> On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5, David Krauss
>> wrote:
>>
>> I imagine EWG asking these questions:
>>
>> 1. Why is make<std::shared_pointer> better than
>> std::make_shared? Do the benefits of this renaming justify
>> the cost in complexity?
>>
>>
>> Personally, I find this feature more intriguing for use with
>> user-defined classes. I find myself writing "make_" functions all
>> the time for every type-dependent class I write, so I've been
>> using something similar to Hana's create class for a while.
>> However, since I don't use "in_place_t" at all, it would be more
>> work to continue using that than switch to this since I'd still
>> have to overload it for every type.
> Sorry, could you clarify what "that" and "this" referees to in the
> previous sentence?
>
>
> Sorry, perhaps a bit unreferenced, but currently, after writing a=20
> type, /Something/, I make a construction function using a utility I=20
> call /MakeT/.
>
> |
> constexprautosomething =3DMakeT<Something>{};
> // ...
> std::vector<X>xs;
> std::vector<Something>ys;
> |
|I suspect you mean here
||std::vector<Something<X>>ys;
|
> |
> std::transform(xs.begin(),xs.end(),std::back_inserter(ys),something);
> |
>
I like the high order MakeT "function".
> I also might wrap /MakeT/ in some sort of decorator to alter how it's=20
> made or box it within another type. However, with this solution...
>
> |
> namespacestd::experimental {
> template<>structSomething<_t>:lift<Something>;
> template<classT>structtype_constructor<Something<T>>:Something<_t>;
> }
>
> |
|Sorry, I should be more explicit in the proposal. This is not needed=20
for every type. lift and reverse_lift are helper for types like expected=20
that have two template parameters. I can remove both helper classes from=20
the proposal ||||and add them to an Appendix.||
The type holder _t is not needed neither. E.g. for a class as=20
expected<T,E> the user could define its own type constructor
template <class E>
struct expected_tc : type_constructor_tag {
template <class T>
using apply =3D expected <T,E>;
};
This is just what reverse_lift<expected, E> does.
Now the user can use
make<expected_tc<E>>(x);
I find however that it is more user friendly to be able to do
|
|| make<expected<_T, E>>(x);
an so we need
template <class E>
struct expected<std::experimental::_t, E>:=20
std::experimental::reverse_lift<expected, E> {};
but this is not absolutely needed. I can remove _t from the proposal and=20
add it to an Appendix.
|
The type_constructor trait is even not needed at all in the context of=20
the make function. I used it in the context of the monad bind function.=20
I will remove it from the proposal.
For class templates having one argument you can just do
make<TemplateClass>(x)
|
> |
> // ...
> std::transform(xs.begin(),xs.end(),std::back_inserter(ys),[&](auto&x){ret=
urnmake<Something>(x);});
> |
>
It is simple to define th high order MakeT function that returns a=20
"function" on top of make<T>
template <template <class> class T>
auto MakeT() { |return [](auto&x){returnmake<T>(x);|}
Your transform example could be
|
std::transform(xs.begin(),xs.end(),std::back_inserter(ys),MakeT<Something>(=
));
|
> Since doing that for every type I make is considerably more work than=20
> using /MakeT/, I couldn't see myself using /std::make/ over=20
> /MakeT./ Which is not to say that I don't find several advantages to=20
> your proposal over my /MakeT/ or Hana's /create./
>
I would consider the addition of the high order function if this make s=20
the proposal more acceptable.
Thanks for your feedback, it has helped me a lot to identify what is=20
mandatory, what are helpers and what can be built on top of the basic=20
proposal.
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/.
--------------010608090501080106020307
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">Le 29/01/15 20:42, Scott Prager a
=C3=A9crit=C2=A0:<br>
</div>
<blockquote
cite=3D"mid:88d87631-4381-4a9c-adba-78a59fb46e78@isocpp.org"
type=3D"cite">
<div dir=3D"ltr"><br>
<br>
On Thursday, January 29, 2015 at 1:50:47 AM UTC-5, Vicente J.
Botet Escriba wrote:
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>Le 29/01/15 07:24, Scott Prager a =C3=A9crit=C2=A0:<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr"><br>
<br>
On Wednesday, January 28, 2015 at 7:36:38 PM UTC-5,
David Krauss wrote:
<div>=C2=A0</div>
<blockquote class=3D"gmail_quote"
style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div style=3D"word-wrap:break-word">
<div>
<div>I imagine EWG asking these questions:</div>
<div><br>
</div>
<div>1. Why is <font face=3D"Courier">make<std::sh=
ared_pointer></font>
better than <font face=3D"Courier">std::make_shared=
</font>?
Do the benefits of this renaming justify the
cost in complexity?</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Personally, I find this feature more intriguing for
use with user-defined classes. I find myself writing
"make_" functions all the time for every
type-dependent class I write, so I've been using
something similar to Hana's create class for a while.
However, since I don't use "in_place_t" at all, it
would be more work to continue using that than switch
to this since I'd still have to overload it for every
type.</div>
</div>
</blockquote>
Sorry, could you clarify what "that" and "this" referees to
in the previous sentence? <br>
</div>
</blockquote>
<div><br>
</div>
<div>Sorry, perhaps a bit unreferenced, but currently, after
writing a type, <i>Something</i>, I make a construction
function using a utility I call <i>MakeT</i>.</div>
<div><br>
</div>
<div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187,
187); word-wrap: break-word; background-color: rgb(250, 250,
250);"><code class=3D"prettyprint">
<div class=3D"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">constexpr</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">auto</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">
something </span><span style=3D"color: #660;"
class=3D"styled-by-prettify">=3D</span><span style=3D"color=
:
#000;" class=3D"styled-by-prettify"> </span><span
style=3D"color: #606;" class=3D"styled-by-prettify">MakeT</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #606;" class=3D"styled-by-prettify">Somethi=
ng</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">>{};=
</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span><span style=3D"color: #800;"
class=3D"styled-by-prettify">// ...</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
std</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">::</span><span style=3D"color:
#000;" class=3D"styled-by-prettify">vector</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">X</span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify"> xs</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
std</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">::</span><span style=3D"color:
#000;" class=3D"styled-by-prettify">vector</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #606;" class=3D"styled-by-prettify">Somethi=
ng</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify"> ys</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span></div>
</code></div>
</div>
</blockquote>
<code>I suspect you mean here <br>
<br>
=C2=A0 </code><code class=3D"prettyprint"><span style=3D"color: #000;=
"
class=3D"styled-by-prettify">std</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">::</span><span style=3D"color: #000;"
class=3D"styled-by-prettify">vector</span><span style=3D"color:
#660;" class=3D"styled-by-prettify"><</span><span style=3D"color=
:
#606;" class=3D"styled-by-prettify">Something</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><X>></=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> ys</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
</span></code>
<blockquote
cite=3D"mid:88d87631-4381-4a9c-adba-78a59fb46e78@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187,
187); word-wrap: break-word; background-color: rgb(250, 250,
250);"><code class=3D"prettyprint">
<div class=3D"subprettyprint"><span style=3D"color: #000;"
class=3D"styled-by-prettify">std</span><span style=3D"color=
:
#660;" class=3D"styled-by-prettify">::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">transfo=
rm</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify">xs</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">.</span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">begin</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(),</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> xs</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">.</span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">end</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">(),</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify">back_in=
serter</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify">ys</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">),</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify">
something</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">);</span></div>
</code></div>
<div><br>
</div>
</div>
</blockquote>
I like the high order MakeT "function".<br>
<blockquote
cite=3D"mid:88d87631-4381-4a9c-adba-78a59fb46e78@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>=C2=A0I also might wrap <i>MakeT</i>=C2=A0in some sort of deco=
rator
to alter how it's made or box it within another type. However,
with this solution...</div>
<div><br>
</div>
<div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187,
187); word-wrap: break-word; background-color: rgb(250, 250,
250);"><code class=3D"prettyprint">
<div class=3D"subprettyprint"><span style=3D"color: #008;"
class=3D"styled-by-prettify">namespace</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify">experim=
ental
</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">{</span><span style=3D"color:
#000;" class=3D"styled-by-prettify"> <br>
</span><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify"><>=
;</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">struct<=
/span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">Somethi=
ng</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">_t</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">:</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"> lift</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #606;" class=3D"styled-by-prettify">Somethi=
ng</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">>;</=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> <br>
</span><span style=3D"color: #008;"
class=3D"styled-by-prettify">template</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #008;" class=3D"styled-by-prettify">class</=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> T</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">struct<=
/span><span
style=3D"color: #000;" class=3D"styled-by-prettify">
type_constructor</span><span style=3D"color: #660;"
class=3D"styled-by-prettify"><</span><span
style=3D"color: #606;" class=3D"styled-by-prettify">Somethi=
ng</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">T</span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">>>=
;</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">:</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #606;" class=3D"styled-by-prettify">Somethi=
ng</span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #000;" class=3D"styled-by-prettify">_t</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">>;</=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> <br>
</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">}</span><span style=3D"color:
#000;" class=3D"styled-by-prettify"> <br>
<br>
</span></div>
</code></div>
</div>
</blockquote>
<code>Sorry, I should be more explicit in the proposal. This is not
needed for every type. lift and reverse_lift are helper for types
like expected that have two template parameters. I can remove both
helper classes from the proposal </code><code><code><code>and add
them to an Appendix.</code></code><br>
<br>
The type holder _t is not needed neither. E.g. for a class as
expected<T,E> the user could define its own type constructor<br=
>
<br>
=C2=A0 template <class E><br>
=C2=A0 struct expected_tc : type_constructor_tag {<br>
=C2=A0=C2=A0=C2=A0 template <class T><br>
=C2=A0=C2=A0=C2=A0 using apply =3D expected <T,E>;<br>
=C2=A0 }; <br>
<br>
This is just what reverse_lift<expected, E> does.<br>
<br>
Now the user can use<br>
<br>
=C2=A0 make<expected_tc<E>>(x);<br>
<br>
I find however that it is more user friendly to be able to do<br>
</code><br>
<code><code>=C2=A0 make<expected<_T, E>>(x);<br>
<br>
an so we need<br>
<br>
=C2=A0 template <class E><br>
=C2=A0 struct expected<std::experimental::_t, E>:
std::experimental::reverse_lift<expected, E> {};<br>
<br>
but this is not absolutely needed. I can remove _t from the
proposal and add it to an Appendix. <br>
</code><br>
The type_constructor trait is even not needed at all in the
context of the make function. I used it in the context of the
monad bind function. I will remove it from the proposal.<br>
<br>
For class templates having one argument you can just do<br>
<br>
=C2=A0 make<TemplateClass>(x)<br>
</code>
<blockquote
cite=3D"mid:88d87631-4381-4a9c-adba-78a59fb46e78@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187,
187); word-wrap: break-word; background-color: rgb(250, 250,
250);"><code class=3D"prettyprint">
<div class=3D"subprettyprint"><span style=3D"color: #800;"
class=3D"styled-by-prettify">// ... </span><span
style=3D"color: #000;" class=3D"styled-by-prettify"><br>
std</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">::</span><span style=3D"color:
#000;" class=3D"styled-by-prettify">transform</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify">xs</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">.</span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">begin</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(),</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> xs</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">.</span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">end</sp=
an><span
style=3D"color: #660;" class=3D"styled-by-prettify">(),</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify">back_in=
serter</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify">ys</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">),</spa=
n><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: #008;" class=3D"styled-by-prettify">auto</s=
pan><span
style=3D"color: #660;" class=3D"styled-by-prettify">&</=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> x</spa=
n><span
style=3D"color: #660;" class=3D"styled-by-prettify">)</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #008;" class=3D"styled-by-prettify">return<=
/span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> make</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span
style=3D"color: #606;" class=3D"styled-by-prettify">Somethi=
ng</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">>(</=
span><span
style=3D"color: #000;" class=3D"styled-by-prettify">x</span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">);</spa=
n><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">});</sp=
an><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
></div>
</code></div>
<div>
<div><span style=3D"font-size: 13.3333339691162px;"><br>
</span></div>
</div>
</div>
</blockquote>
It is simple to define th high order MakeT function that returns a
"function" on top of make<T><br>
<br>
=C2=A0 template <template <class> class T> <br>
=C2=A0 auto MakeT() { <code class=3D"prettyprint"><span style=3D"color:
#660;" class=3D"styled-by-prettify">return [](</span><span
style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><spa=
n
style=3D"color: #660;" class=3D"styled-by-prettify">&</span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify"> x</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span
style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span
style=3D"color: #008;" class=3D"styled-by-prettify">return</span><s=
pan
style=3D"color: #000;" class=3D"styled-by-prettify"> make</span><sp=
an
style=3D"color: #660;" class=3D"styled-by-prettify"><T</span><sp=
an
style=3D"color: #660;" class=3D"styled-by-prettify">>(</span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify">x</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span
style=3D"color: #000;" class=3D"styled-by-prettify"> </span></code>=
}<br>
<br>
Your transform example could be<br>
<br>
<div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187,
187); word-wrap: break-word; background-color: rgb(250, 250,
250);"><code class=3D"prettyprint">
<div class=3D"subprettyprint"><span style=3D"color: #000;"
class=3D"styled-by-prettify">std</span><span style=3D"color:
#660;" class=3D"styled-by-prettify">::</span><span
style=3D"color: #000;" class=3D"styled-by-prettify">transform</=
span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify">xs</span><s=
pan
style=3D"color: #660;" class=3D"styled-by-prettify">.</span><sp=
an
style=3D"color: #008;" class=3D"styled-by-prettify">begin</span=
><span
style=3D"color: #660;" class=3D"styled-by-prettify">(),</span><=
span
style=3D"color: #000;" class=3D"styled-by-prettify"> xs</span><=
span
style=3D"color: #660;" class=3D"styled-by-prettify">.</span><sp=
an
style=3D"color: #008;" class=3D"styled-by-prettify">end</span><=
span
style=3D"color: #660;" class=3D"styled-by-prettify">(),</span><=
span
style=3D"color: #000;" class=3D"styled-by-prettify"> std</span>=
<span
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><s=
pan
style=3D"color: #000;" class=3D"styled-by-prettify">back_insert=
er</span><span
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an
style=3D"color: #000;" class=3D"styled-by-prettify">ys</span><s=
pan
style=3D"color: #660;" class=3D"styled-by-prettify">),</span><s=
pan
style=3D"color: #000;" class=3D"styled-by-prettify">
MakeT<Something</span><span style=3D"color: #660;"
class=3D"styled-by-prettify">>());</span></div>
</code></div>
=C2=A0
<blockquote
cite=3D"mid:88d87631-4381-4a9c-adba-78a59fb46e78@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>
<div>Since doing that for every type I make is considerably
more work than using <i>MakeT</i>, I couldn't see myself
using <i>std::make</i>=C2=A0over <i>MakeT.</i>=C2=A0Which is no=
t to
say that I don't find several advantages to your proposal
over my <i>MakeT</i>=C2=A0or Hana's <i>create.</i>=C2=A0</div>
</div>
</div>
<br>
</blockquote>
I would consider the addition of the high order function if this
make s the proposal more acceptable.<br>
<br>
Thanks for your feedback, it has helped me a lot to identify what is
mandatory, what are helpers and what can be built on top of the
basic proposal.<br>
<br>
Vicente<br>
</body>
</html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
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 />
--------------010608090501080106020307--
.