CppCon 2020 has ended
Back To Schedule
Wednesday, September 16 • 14:10 - 14:40
The Many Shades of reference_wrapper

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

Feedback form is now closed.
You may have heard of std::reference_wrapper's role in make_tuple, but this is not today's topic. The role that reference_wrapper plays is larger than unwrapping references in C++ standard library API. It is the language's response to the need for references with rebinding semantics, which may explain why such a small utility is still receiving love and polishes in C++20.
To put it in the other way, every reference in Python is rebindable -- with garbage collection, of course. But the semantics in common implies that reference_wrapper may be very useful. This talk will go through these use cases, see how reference_wrapper's design carefully enables them through details. The talk will also compare reference_wrapper with other facilities in the language and the standard library to give you hints about how to choose from the reference-like types.

avatar for Zhihao Yuan

Zhihao Yuan

R&D Software Engineer, Broadcom Inc.
Zhihao Yuan is an R&D Software Engineer at Symantec, a division of Broadcom. He participated in standardizing designated initializers and improved narrowing conversions in C++20 but ends up almost exclusively programmed in Python last year and only recently picked up C++14 again... Read More →

Wednesday September 16, 2020 14:10 - 14:40 MDT