The wait is over: coroutines in C++

Spread the love

Long ago, I wrote about using the PPL to achieve a .NET 4.0 level of parity for async programming in C++. Since then, a lot of work has gone into raising this level of parity to .NET 4.5 and beyond. Introducing… C++ coroutines.

Sure, there have been various tricks and extensions to approximate this in the past. But this is actually ending up in the C++ standard!

Gor Nishanov, a major champion/designer of this new feature, describes coroutines as a negative overhead abstraction, where you end up with something “not only simpler, shorter, neater, tighter than before, but also much faster.” (He also spends a good amount of time on the origins of coroutines via Melvin Conway, which I also previously wrote about.)

For a few practical samples, you can peruse the following resources:

3 thoughts on “The wait is over: coroutines in C++

  1. Jesse

    This + modules + the proposed ‘ranges/views/spans’ stuff may finally make C++ quite nice indeed.

    The only thing left to hope for is insanely quick adoption of those above 3 items… and a decent class library capable of performing useful stuffs (but that’s too much to wish for I suppose :))

    1. Brian Rogers Post author

      While we’re discussing unrealistic dreams, let’s add to this an editing experience for C++ as nice as C# in Visual Studio!

      1. Jesse

        Nonsense! We all want “Find all References” to not find any references at all. We want it to do a plain text search instead (i.e. click on Foo.Create and watch it find all .Creates in your project)!

        I encourage everyone to keep submitting that feedback on every machine with VS installed so they get the message.

Leave a Reply to Jesse Cancel reply

Your email address will not be published. Required fields are marked *