C++20 compatible changes (#85703)
`std::hash<T>::result_type` is deprecated since C++17 and removed in c++20, so use `c10::invoke_result_t` to define it
Fixes https://github.com/pytorch/pytorch/issues/85603
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85703
Approved by: https://github.com/ezyang