Why can you do this
int a;
const double &m = a;
But when you do this
int a;
double &m = a;
you get an error?
error: non-const lvalue reference to type 'double' cannot bind to a value of unrelated type 'int'
Edit:
To be more specific I am trying to understand the reason non-const references can't bind temp objects.
See Question&Answers more detail:os