I don't understand how the argument deduction rule works in this case. I have the following simple code snippet:
template<typename T>
void fn(T const &&t) {
std::cout << __PRETTY_FUNCTION__ << std::endl;
std::cout << typeid(decltype(t)).name() << std::endl;
}
int main() {
int const *ar = nullptr;
std::cout << typeid(ar).name() << std::endl;
fn(std::move(ar));
}
The result I get is as follows:
PKi
void fn(const T &&) [T = const int *]
PKi
What I don't understand is why T is inferred as const int *. Why the const did not get pattern matched?