CppCon 2017: Michael Park “Enhanced Support for Value Semantics in C++17”

preview_player
Показать описание


Value semantics has been promoted in the C++ community for a long time, for reasons such as referential transparency, avoidance of memory management issues, and even efficiency in some cases. Move semantics in C++11 was a big step in language-level support for value semantics. In this talk, we’ll cover steps taken in C++17 for enhanced library-support for value semantics. Specifically, we’ll focus on `std::optional`, `std::variant`, and `std::any`.

We’ll discuss what they are, their motivating use cases, and most importantly, identify existing patterns that can be improved by replacing it with one of these utilities. We’ll also cover some of the details such as: `std::monostate`, `std::variant`’s `valueless_by_exception` state, subtle difference in behavior between `std::optional<T>` and `std::variant<std::monostate, T>`, etc.

The goal of the talk is to inform you of new library features in C++17, and to convince you of their usefulness and ultimately to add them to your toolbox.

Michael Park: Mesosphere, Software Engineer

I’m a committer for the Apache Mesos project, and work as a Distributed Systems Engineer at Mesosphere. Within the realm of computer science, I’m very much intrigued by language design, compiler construction, and distributed systems. I’m also an active member of the ISO C++ Standards Committee.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

I was just watching this great talk, and Michael got to the part about kill(-1).  So I googled "man kill" to get the spec up.  Is the FBI going to investigate me now?!

howardhinnant
Автор

Good talk, very smart. However when many tech people talk, they seem to occasionally slur their words (sometimes from speaking too quickly) or trail off (the volume level) at the end of a sentence. This happened near the beginning on the word "can't" or was it "can"? "Can not" is more clear, when saying "can't" when one is not an experienced speaker for recorded events. Of course people who know the answer fill in the correct affirmative or negative, but not if someone who is learning, which is the point of the talk. I do love std::variant and std::visit. :)

cppmsg
Автор

Now for completeness we need exhaustive matching for std::optional and std::variant

marusamamarusama
Автор

Why doesn't optional support reference types?

noxabellus
Автор

I liked this talk, but I feel like he wasn't as prepared as he could've been. Also, while it's good for him to be proud of the work he's done on the standard (it's impressive work) being more up-front about it combined with softening it with humor is good in front of an audience.

Watch the talks of some other people who've done really impressive work.

Omnifarious