Going Deep (HD) - Channel 9

C++ and Beyond 2012: Scott Meyers - Universal References in C++11


Listen Later

Scott Meyers presents "Universal References in C++11". This was filmed at C++ and Beyond 2012. This is the full session in all of its splendor. Huge thanks to Scott for allowing C9 to provide this excellent C++11 content to the world. From Scott's recently published article in the October 2012 edition of ACCU's Overload: Given that rvalue references are declared using "&&", it seems reasonable to assume that the presence of "&&" in a type declaration indicates an rvalue reference. That is not the case: Widget&& var1 = someWidget; // here, "&&" means rvalue reference
auto&& var2 = var1; // here, "&&" does not mean rvalue reference
template
void f(std::vector&& param); // here, "&&" means rvalue reference
template
void f(T&& param); // here, "&&" does not mean rvalue reference
In this article, I describe the two meanings of "&&" in type declarations, explain how to tell them apart, and introduce new terminology that makes it possible to unambiguously communicate which meaning of "&&" is intended. Distinguishing the different meanings is important, because if you think "rvalue reference" whenever you see "&&" in a type declaration, you'll misread a lot of C++11 code. Tune in. Scott's an incredible presenter and it's well worth your time to both read his article and watch his presentation on the subject. Great stuff! Download slides
...more
View all episodesView all episodes
Download on the App Store

Going Deep (HD) - Channel 9By Microsoft