Why aren't template type parameters inferred as 'const'?

Viewed 659

Possible Duplicate:
deducing references to const from rvalue arguments

If I have

template<class T>
void foo(T &) { }

and I call it as foo((const int)5), given that the argument is a const int, why doesn't the compiler automatically infer T to be const int?

2 Answers
Related