如何为成员函数正确调用 invoke_result?或者专门针对运算符成员函数。我试过 std::invoke_result<T::operator[], size_type>
没有成功。在这种情况下,正确的语法是什么?
最佳答案
不要。使用 decltype(std::declval<T&>()[size_type{}])
或类似的东西(根据需要调整值类别和简历资格)。
invoke_result
适用于您有可调用/可调用对象的情况。你没有,所以不要试图将方钉锤入圆孔。
关于c++ - invoke_result with member (operator[]) 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56910387/