CppCon 2019 has ended
Back To Schedule
Friday, September 20 • 13:30 - 14:30
Using C++20's Three-way Comparison <=>

Log in to save this to your schedule, view media, leave feedback and see who's attending!

C++20 adds the "spaceship operator" <=> for three-way comparison, fundamentally changing the way we implement comparison. But there are a lot more changes: Comparison categories will give more structure, and the new operator rewriting rules will massively reduce boilerplate. And like most C++ features, there are a couple of caveats we need to be aware of.

This talk will cover all the changes and give guidelines on how to use them. It will be very practical, answering questions like: How do I write a comparison operator for my classes? How do I write it for a generic container? How should I implement algorithms to leverage the three-way comparison? How do I handle all the types written without <=>?

Whether you are writing concrete applications or generic library code, you will have the necessary knowledge to apply the new features. And even if you cannot use C++20 in the foreseeable future, you will have a deeper understanding on proper comparison design.

avatar for Jonathan Müller

Jonathan Müller

Student, RWTH Aachen University
Jonathan is a Computer Science graduate currently studying Physics. In his spare time he works on various C++ open source libraries for memory allocation, cache-friendly containers or parsing. He also blogs about C++ and library development at foonathan.net.

Friday September 20, 2019 13:30 - 14:30
Summit 4/5

Attendees (147)