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&lt;T&gt; 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 &lt;future&gt;</div><d=
iv>using namespace std;</div><div>int main() {</div><div>&nbsp; &nbsp; futu=
re&lt;int&gt; f1 =3D async([]() { return 123; });</div><div>&nbsp; &nbsp; f=
uture&lt;string&gt; f2 =3D f1.then([](future&lt;int&gt; f) {</div><div>&nbs=
p; &nbsp; &nbsp; &nbsp; return f.get().to_string(); // here .get() won=92t =
block</div><div>&nbsp; &nbsp; });</div><div>}</div></div><div><br></div><di=
v>should be:</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; 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 &lt;future&gt;</div><div>using =
namespace std;</div><div>int main() {</div><div>&nbsp; &nbsp; future&lt;fut=
ure&lt;int&gt;&gt; outer_future =3D async([]{</div><div>&nbsp; &nbsp; &nbsp=
; &nbsp; future&lt;int&gt; inner_future =3D async([] {</div><div>&nbsp; &nb=
sp; &nbsp; &nbsp; &nbsp; &nbsp; return 1;</div><div>&nbsp; &nbsp; &nbsp; &n=
bsp; });</div><div>&nbsp; &nbsp; &nbsp; &nbsp; return inner_future;</div><d=
iv>&nbsp; &nbsp; });</div><div><br></div><div>&nbsp; &nbsp; future&lt;int&g=
t; inner_future =3D outer_future.unwrap();</div><div><br></div><div>&nbsp; =
&nbsp; inner_future.then([](future f) { // need template argument</div><div=
>&nbsp; &nbsp; &nbsp; &nbsp; do_work(f);</div><div>&nbsp; &nbsp; });</div><=
div>}</div></div><div><br></div><div>should be:</div><div><br></div><div><d=
iv>&nbsp; &nbsp; inner_future.then([](future&lt;int&gt; 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:&nbsp;sites.google.co=
m/site/faithandbrave/about/en</div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1428_24644974.1387173488355--

.