[ACCEPTED]-C++ std::async vs async/await in C#-async-await

Accepted answer
Score: 23

Not really, assuming I'm reading this std::async documentation correctly.

C# 5's 13 async/await feature involves a complex compiler 12 transformation of the asynchronous method 11 so that you can write code which looks pretty 10 much synchronous, but has points of asynchrony. The 9 compiler builds a state machine for you, creates 8 appropriate callbacks etc.

EDIT: While I 7 previously believed that std::async simply forced 6 you to pass in a callback explicitly, it 5 looks like it's even more primitive than 4 that. Either way, I believe it's mostly/completely 3 a library feature whereas C# 5's asynchronous methods 2 are mostly a language feature with library support.

EDIT: As 1 noted further in comments, it looks like it's on its way for VC++...

Score: 1

CPPASYNC (provided in another answer) looks 11 like what you are looking for. The "Async" part 10 is easy and the performance looks good (likely 9 better than the C# implementation). It's 8 ugly b/c you need special "Await" wrappers 7 around async callback calls. Some Boost 6 networking is provided, and they're easy 5 to make, but you can't just "Await" anything: Async 4 any method/function,

Within an Async function, await 3 either:
- An Async function
- An await wrapper 2 (simple to make) around an asynchronous 1 function (that takes a callback)

More Related questions