Universal/Forwarding References - A Key to More Modern C++

Nicolai Josuttis

online
90 minute session
beginner
intermediate
14:30-16:00, Wednesday, 13th July 2022

Universal/forwarding references were introduced in C++11 mainly for perfect forwarding of move semantics.

However, over time they became more and more a key feature in various situations of C++. One example is the implementation for the range-based for loop.

With C++20 they even get an important for ordinary application programmers. You need them to be able to implement generic code that works for both containers and views.

Time to look carefully at T&&, auto&& (and maybe their cousin decltype(auto)) in detail.

universal reference
forwarding reference
auto&&
decltype(auto)
range-based for loop
views

Nicolai Josuttis

Nicolai Josuttis (www.josuttis.com) is well known in the C++ Community for speaking and writing with authority about C++ (being the author of "C++20 - The Complete Guid", "C+++17 - The Complete Guide", "C++ Move Semantics - The Complete Guide", "The C++ Standard Library", and "C++ Templates" (coauthor)) but is also an innovative presenter. He is an active member of C++ standardization committee for more than 20 years now.