Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
它比您编码的要简单一些。而且你忘记调用你的函数:
template <typename A, typename B> auto foo(A&& a, B&& b) -> decltype((a.*b)()) { return ((std::forward<A>(a)).*(std::forward<B>(b)))(); }