C++Now 2015 trip report

In January, I applied to be a student volunteer at C++Now 2015, and I was very excited to be one of the few selected people. C++Now is organised by Boost and held annually in Aspen, Colorado, in the States. It’s a rather small conference (I believe we were around 150 people), and that’s one of the things that make the conference really fantastic. It was very lively and social and the environment created by all attendees was just great, be it during the talks, lunches or one of the other social sessions. If you’re curious about the talks at the conference and what else was happening, read on!

Getting to Aspen was a bit of a story of it’s own. I had a flight from Heathrow to Chicago, then to Denver and finally to Aspen. In Denver, there were rumours of a snow storm in Aspen, but luckily it turned out to be little more than a bit of snowfall so after 25 hours of travelling I finally arrived in Aspen. At the hotel, I received a very friendly welcome from the organiser of the student volunteer program and a few other attendees hanging out in the lobby, which nearly made me forget the long travel.

Luckily, the next day (Monday), there was only the welcome reception in the afternoon so we had some time off in the morning to explore our surroundings. Aspen was stunning, the scenery was so beautiful and the hotel was amazing as well. The town itself looked a bit weird at first: it was a bit of a ghost town, which is pretty normal given it was May and it’s a ski resort. The houses all looked a bit weird, nothing like I’ve seen before, but it was quite nice and had a certain flair to it. As student volunteers, our job was to help with running the conference, which for example included recording all the sessions. So in the afternoon we helped with food preparations for the conference and prepared the name badges for the attendees. When people started to arrive a bit later, everybody was just hanging out at the bar and it was very interesting meeting so many new people!

On Tuesday morning the conference started and I was scheduled to record the first session, the keynote from Andrew Sutton about Generic Programming with Concepts. With concepts, one can constrain template arguments to express clear intent of what valid types must satisfy. It’s also possible to overload based on concepts and they make compiler error messages related to templates a lot more readable. Here‘s an easy-to-understand example. Concepts (or rather “Concepts Lite”) are currently being finalised and are on their way of ending up in an ISO Technical Specification (TS) of the language.

The next talk was also one of the highlights of the week: Ben Deane from Blizzard talked about Testing Battle.net (before deploying to millions of players). He showed the problems that arose in their code base with unit testing, in particular with testing online matchmaking, and identified the use of dependency injection, narrow interfaces and not doing work in constructors as huge helpers in making code better testable. In the remainder of his talk, he spoke about testing efficiency and auto-generating test inputs.

The subsequent talk was another highlight: Scott Schurr talked about constexpr: C++ At Compile Time. With constexpr, it is possible to evaluate expressions and computations at compile time, with familiar C++ syntax instead of template metaprogramming. For example, the following computation (using C++11 constexpr) will be performed entirely at compile time:

The subsequent talk was another highlight: Scott Schurr talked about constexpr: C++ At Compile Time. With constexpr, it is possible to evaluate expressions and computations at compile time, with familiar C++ syntax instead of template metaprogramming. For example, the following computation (using C++11 constexpr) will be performed entirely at compile time:

constexpr int factorial(int n) {
    return n <= 1 ? 1 : (n * factorial(n-1));
}
int main() {
    constexpr int i = factorial(5); // assembly code generated: mov DWORD PTR [rbp-4], 120
    return 0;
}

I highly recommend watching his talk when it comes online. He gives a beginner-friendly introduction to the subject, shows many examples and explains the difference between C++11 and C++14 constexpr. After the talk, it was easy to find a group of people to have dinner together, and afterwards, there was even another session, about the future of boost. We finished at around 10pm. It was a fantastic day with so many interesting and educating talks.

Wednesday was a great day as well – quite focused on weather forecasting. It started with a keynote on numerical weather prediction and what problems their lab faces in their (partial) transition from Fortran to C++. Next I went to a talk from Sylwester Arabas who presented two of his libraries for atmospheric research with a very cool “hello world” example of weather simulation in modern C++. After that the people from biicode made a very convincing argument for a dependency manager in C++. It seemed like they learned a lot from biicode and they are ramping up their next big project together with the community.

Thursday started with a great keynote from Eric Niebler – he talked about Ranges for the Standard Library. Following the definition (and example) of the standards proposal, a range is an object that refers to a sequence of elements, conceptually similar to a pair of iterators. A prime motivation for ranges is that they allow the syntax std::vector v { /*...*/ }; std::sort(v);, but ranges and this simplified syntax has much further consequences. Ranges (or range adaptors) can be chained to create lazy computational pipelines, for example this code sums the first 10 squares:

int total = std::accumulate(view::iota(1) | view::transform([](int x){ return x*x; }) | view::take(10), 0);

Writing code like this is already possible with the range-v3 library. Unfortunately, it doesn’t work in Visual Studio 2015 yet, but it looks like it could finally happen as Microsoft announced that they plan to add expression-SFINAE in a post-RTM update of VS 2015. Back to the talk – until the C++Now video is online, I seriously recommend watching this one

One general take home message from the conference for me is that I will definitely have a good look at functional programming. It was quite a hot topic at the conference, and many of the newly added and proposed C++ language features like ranges or even concepts seem to have their origin in functional programming. Knowing a functional language seems to be something that broadens a programmer’s mind enormously, even if your day to day programming language is not a purely functional one. A recommendation I got is Learn You a Haskell, and I like that tutorial a lot so far!

There’s another two talks from that day I really recommend: First, Functions Want To Be Free, which argues for free functions over class member functions. This goes hand-in-hand with what Herb Sutter and Scott Meyers (Effective C++, Item 23) recommend, “Prefer non-member non-friend functions to member functions”. The second talk is Big Projects, and CMake, and Git, Oh My!, and it’s a must see for anybody using CMake and Git in a medium-to-large size project. I don’t fully agree with certain minor details of how he does things (this post is already too long to go into details, but I had a great chat with the speaker after the talk), but his general project structure and guidelines are great and very insightful for anybody using CMake and Git.

On Friday, Louis Dionne gave a presentation about his library, Hana, C++ metaprogramming: a paradigm shift (cool presentation tool by the way: reveal-js). He is a metaprogramming wizard and I am not even going to try to explain what he was talking about, but his library seems to make stuff like compile-time computations or introspection a lot more beautiful and more accessible. In the afternoon, there was a really good tutorial on Using Spirit X3. Quoting from their documentation“Boost Spirit X3 is an object-oriented, recursive-descent parser for C++. It allows you to write grammars using a format similar to Extended Backus Naur Form (EBNF)”. I’ve never used a parser library and written grammars in C++ before and at the end of the tutorial I had written a nearly complete JSON parser (with a lot of help though!).

Saturday was the last day of the conference and mainly consisted of a few closing words from Jon Kalb and awards for the best sessions. It was a truly incredible week!

The conference also featured a daily Library in a Week session, whose topic was to brainstorm about an application configuration library (like boost::program_options), and continue to work on it during the week. Sadly I only went to a couple of the sessions, I just didn’t manage to squeeze that in as well between everything else. There were many more great talks than the ones I mentioned here, and the slides for most of the talks are available on Github. The videos we recorded should be up in a couple of month or so.

On Sunday after the conference, I flew to Santa Monica where I had the whole Monday to spend before having a direct flight back to Heathrow. It was really cool there, I tried airbnb for my first time and it was great!

What remains is a week fully packed with C++ and I didn’t have so much fun in a long time. I learned so much and I met great people. I am very thankful that Boost provided me with this great experience and I am so much looking forward to coming back in 2016!

Leave a comment