experimental

CppCon 2016: Iterator Haiku--Casey Carter

Have you registered for CppCon 2017 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2016 for you to enjoy. Here is today’s feature:

Iterator Haiku

by Casey Carter

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Iterator Haiku: How five iterator categories blossomed into seven, and Sentinels trimmed them back to five again. Recently proposed changes to the ranges TS distill its seven iterator categories back to five without sacrificing any expressive power. Removing operations that are extraneous in the Sentinel world eliminates a potential source of programming errors.

Yielding Generators--Kirit Sælensminde

The series continue!

Yielding Generators

by Kirit Sælensminde

From the article:

We've seen how the promise_type together with the coroutine return type handles the interactions between the caller and the coroutine itself.

Our target is to be able to do something pretty simple:

generator count() {
    std::cout << "Going to yield 1" << std::endl;
    co_yield 1;
    std::cout << "Going to yield 2" << std::endl;
    co_yield 2;
    std::cout << "Going to yield 3" << std::endl;
    co_yield 3;
    std::cout << "count() is done" << std::endl;
}

CppCon 2016: There and Back Again: An Incremental C++ Modules Design--Richard Smith

Have you registered for CppCon 2017 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2016 for you to enjoy. Here is today’s feature:

There and Back Again: An Incremental C++ Modules Design

by Richard Smith

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

The Clang project has been working on Modules in one form or another for many years. It started off with C and Objective-C many years ago. Today, we have a C++ compiler that can transparently use C++ Modules with existing C++ code, and we have deployed that at scale. However, this is very separate from the question of how to integrate a modular compilation model into the language itself. That is an issue that several groups working on C++ have been trying to tackle over the last few years.

Based on our experience deploying the core technology behind Modules, we have learned a tremendous amount about how they interact with existing code. This has informed the particular design we would like to see for C++ Modules, and it centers around incremental adoption. In essence, how do we take the C++ code we have today, and migrate it to directly leverage C++ Modules in its very syntax, while still interacting cleanly with C++ code that will always and forever be stuck in a legacy mode without Modules.

In this talk we will present our ideas on how C++ Modules should be designed in order to interoperate seamlessly with existing patterns, libraries, and codebases. However, these are still early days for C++ Modules. We are all still experimenting and learning about what the best design is likely to be. Here, we simply want to present a possible and still very early design direction for this feature.

CppCon 2016: C++ Coroutines: Under the covers--Gor Nishanov

Have you registered for CppCon 2017 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2016 for you to enjoy. Here is today’s feature:

C++ Coroutines: Under the covers

by Gor Nishanov

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Coroutines feel like magic. Functions that can suspend and resume in the middle of the execution without blocking a thread! We will look under the covers to see what transformations compilers perform on coroutines, what happens when a coroutine is started, suspended, resumed or cancelled. We will look at optimizations that can make a coroutine disappear into thin air.

Playing with C++ Coroutines--Sumant Tambe

An old presentation about coroutines:

Playing with C++ Coroutines

by Sumant Tambe

From the article:

While looking for some old photos, I stumbled upon my own presentation on C++ coroutines, which I never posted online to a broader audience. I presented this material in SF Bay ACCU meetup and at the DC Polyglot meetup in early 2016! Yeah, it's been a while. It's based on much longer blogpost about Asynchronous RPC using modern C++. So without further ado...

It had to be done - Abusing co_await for optionals--redditsoaddicting

The future is not here yet that it's already full of resources!

It had to be done - Abusing co_await for optionals

by redditsoaddicting

From the article:

I finally got around to playing with coroutines in the context of non-future types. I always guessed this could be done. For optionals specifically, the idea is that you do auto x = co_await foo(); and either x is the value in the optional or the function immediately returns an empty optional...

Fuzzing beast with libFuzzer

A short blog post about my experience in fuzzing beast during my boost review

Fuzzing beast with libFuzzer

by Jens Weller

From the article:

During the weekend I wanted to take a closer look at beast, a http library proposed for boost. I planned to write an http client class, as thats something I'll need in some project later anyways. I've been looking at beast on and off for a few month now, and started by reviewing the documentation and examples to get a feel for the library it self.

A more realistic coroutine--Kirit Sælensminde

What’s the point of coroutines?

A more realistic coroutine

by Kirit Sælensminde

From the article:

Having gotten something working, we still have a small problem. We have a coroutine that we can start, and we can choose when to suspend it, but we can't yet resume it.

The coroutines TS describes a class std::experimental::coroutine_handle which is our interface to the coroutine itself. It's a template which is supposed to be told the promise_type we're using...

5 years of Meeting C++

Meeting C++ exists now for 5 years, lets celebrate on the blog:

5 years of Meeting C++

by Jens Weller

From the article:

Just a little bit more then 5 years ago, Meeting C++ went public. Since then, it has been a wild ride and huge success. Today, Meeting C++ reaches over 50k in social media, the conference it self has grown from 150 to 600 in its 5 editions...

My first coroutine--Kirit Sælensminde

What's the point of coroutines?

My first coroutine

by Kirit Sælensminde

From the article:

There are more and more examples coming out of how to convert things like the use of futures into coroutines, and you may be forgiven for thinking that there is also some magic that happens in boost::future or std::future that lets this work, but that's not the case.

In C++ a coroutine is any function that contains one of the coroutine keywords in its body, that is any of co_return, co_yield or co_await.

What we're going to do is to write a very basic mechanism that allows us to use co_return to return a value from a coroutine. Coroutines are really a generalisation of a function call, and what this is going to allow us to do is to treat a coroutine as a function call. If we can't do this then we don't stand much chance of doing anything more interesting with them, but it will give us a good starter on how the machinery works...