pythontutor-dev / pythontutor

11 stars 4 forks source link

C++ mystery with multiple levels of references #6

Open pgbovine opened 4 years ago

pgbovine commented 4 years ago

too tired to debug now ... C++ example:

#include <utility>
template <typename T>
void foo(T&& t)
{ }
int x = 5;
int* px = &x;
int& rx = x;
int&& rrx = std::move(x);

int main() {

  foo(rx);
}