Topic: report typo : N3784 Improvements to std::future<T>
Author: Akira Takahashi <faithandbrave@gmail.com>
Date: Sun, 15 Dec 2013 21:58:08 -0800 (PST)
Raw View
------=_Part_1428_24644974.1387173488355
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Hi,
I found few minor typo.
N3784 Improvements to std::future<T> and Related APIs
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3784.pdf
1. `then` example.
`int` hasn't `to_string` member function.
#include <future>
using namespace std;
int main() {
future<int> f1 =3D async([]() { return 123; });
future<string> f2 =3D f1.then([](future<int> f) {
return f.get().to_string(); // here .get() won=92t block
});
}
should be:
return to_string(f.get()); // here .get() won=92t block
2. `unwrap` example.
`future` need template argument.
#include <future>
using namespace std;
int main() {
future<future<int>> outer_future =3D async([]{
future<int> inner_future =3D async([] {
return 1;
});
return inner_future;
});
future<int> inner_future =3D outer_future.unwrap();
inner_future.then([](future f) { // need template argument
do_work(f);
});
}
should be:
inner_future.then([](future<int> f) {
Thanks,
Akira
=3D=3D
Akira Takahashi
site: sites.google.com/site/faithandbrave/about/en
--=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_1428_24644974.1387173488355
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi,<div>I found few minor typo.</div><div><br></div><div>N=
3784 Improvements to std::future<T> and Related APIs<br></div><div>ht=
tp://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3784.pdf<br></div><d=
iv><br></div><div>1. `then` example.</div><div>`int` hasn't `to_string` mem=
ber function.</div><div><br></div><div><div>#include <future></div><d=
iv>using namespace std;</div><div>int main() {</div><div> futu=
re<int> f1 =3D async([]() { return 123; });</div><div> f=
uture<string> f2 =3D f1.then([](future<int> f) {</div><div>&nbs=
p; return f.get().to_string(); // here .get() won=92t =
block</div><div> });</div><div>}</div></div><div><br></div><di=
v>should be:</div><div><br></div><div> return to=
_string(f.get()); // here .get() won=92t block<br></div><div><br></div><div=
><br></div><div>2. `unwrap` example.</div><div>`future` need template argum=
ent.</div><div><br></div><div><div>#include <future></div><div>using =
namespace std;</div><div>int main() {</div><div> future<fut=
ure<int>> outer_future =3D async([]{</div><div>  =
; future<int> inner_future =3D async([] {</div><div> &nb=
sp; return 1;</div><div> &n=
bsp; });</div><div> return inner_future;</div><d=
iv> });</div><div><br></div><div> future<int&g=
t; inner_future =3D outer_future.unwrap();</div><div><br></div><div> =
inner_future.then([](future f) { // need template argument</div><div=
> do_work(f);</div><div> });</div><=
div>}</div></div><div><br></div><div>should be:</div><div><br></div><div><d=
iv> inner_future.then([](future<int> f) {</div></div><di=
v><br></div><div><br></div><div>Thanks,</div><div>Akira</div><div><br></div=
><div>=3D=3D</div><div>Akira Takahashi</div><div>site: sites.google.co=
m/site/faithandbrave/about/en</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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_1428_24644974.1387173488355--
.