Opened 12 years ago
Closed 10 years ago
#4710 closed Feature Requests (fixed)
c++11 compliance: : Missing async()
Reported by: | Dave Abrahams | Owned by: | viboes |
---|---|---|---|
Milestone: | Boost 1.52.0 | Component: | thread |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | async standard | Cc: | viboes |
Description
The lack of an async()
call makes futures awfully cumbersome to use. I hacked up this nullary prototype for C++03. It's better than nothing!
#include <boost/thread.hpp> #include <boost/utility/result_of.hpp> template <class F> boost::detail::thread_move_t<boost::unique_future<typename boost::result_of<F()>::type> > async(F f) { typedef typename boost::result_of<F()>::type R; boost::packaged_task<R> pt( f ); typedef boost::unique_future<R> future; future ret = pt.get_future(); boost::thread( boost::move(pt) ).detach(); return boost::move(ret); }
Change History (9)
comment:1 by , 12 years ago
Component: | threads → thread |
---|---|
Type: | Bugs → Feature Requests |
comment:2 by , 11 years ago
Cc: | added |
---|---|
Keywords: | async standard added |
comment:3 by , 11 years ago
Summary: | Missing async() → c++11 complicance: : Missing async() |
---|
comment:4 by , 11 years ago
Summary: | c++11 complicance: : Missing async() → c++11 compliance: : Missing async() |
---|
comment:5 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 10 years ago
Milestone: | To Be Determined → Boost 1.52.0 |
---|
follow-up: 8 comment:7 by , 10 years ago
comment:8 by , 10 years ago
Replying to viboes:
Add
template <class F, class... Args> future<typename result_of<F(Args...)>::type> async(F&& f, Args&&... args); template <class F, class... Args> future<typename result_of<F(Args...)>::type> async(launch policy, F&& f, Args&&... args);to conform with c++11.
I will implement these prototypes later on.
For the time been, the minimal request has benn done.
comment:9 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Merged from trunk [80450].
Note:
See TracTickets
for help on using tickets.
Add
to conform with c++11.