由于某些原因,std::invoke_result_t<T>
有效,但std::invoke_result<T>::type
无效。我以为它们是等效的:
template <typename T>
class BOO {
public:
BOO(T func) {}
typedef std::invoke_result_t<T> returnType; // THIS WORKS
typedef std::invoke_result<T>::type
returnType; // SYNTAX ERROR IDENTIFIER 'type'
returnType member;
};
int main() {
BOO boo([]() { return bool(); });
}