Skip to content

Instantly share code, notes, and snippets.

@dgodfrey206
Created June 21, 2015 21:16
Show Gist options
  • Save dgodfrey206/091f668a6ec906a83ec4 to your computer and use it in GitHub Desktop.
Save dgodfrey206/091f668a6ec906a83ec4 to your computer and use it in GitHub Desktop.
Reference collapsing
#include <utility>
template<class T> struct TD;
template<class T> void f(T&& x) { TD<decltype(x)>(); }
// T & = T&
// T && = T&&
// T& & = T&
// T& && = T&
// T&& & = T&
// T&& && = T&&
int main() {
f(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment