Loading…
C++Now 2018 has ended
Wednesday, May 9 • 11:00am - 12:30pm
Rethinking Pointers

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

Feedback form is now closed.
"Do not use owning raw pointers, use a smart pointer instead." — And yet it is common to use them when writing a linked list, for example.

"Use a reference when a pointer is non-null." — But the standard library interfaces themselves don't follow this advice all the time.

We're at a point where a simple question "I need to point to some other object" requires a complicated lecture about raw vs. smart pointers, references and the danger of putting references inside angle brackets. Clearly we can do better.

Let's take a step back, and look at the bigger picture:
What are the common pointer-like types?
Which properties do they have in common, which are unique?
What are the possible situations that require pointer-like types?
Which properties do those situations require?

This talk will answer those questions and so provide the definitive guide to choosing the correct pointer types.
We'll be discussing whether or not `optional<T&>` or `std::observer_ptr` are necessary, talk about the difference in applications for `T&`, `gsl::non_null<T>` and `std::reference_wrapper<T>`, and look how the type system can help us catch lifetime issues.

Speakers
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.


Wednesday May 9, 2018 11:00am - 12:30pm MDT
Flug Auditorium
  presentation