自动关键字无法推断出正确的类型

我收到此错误,我不明白为什么? 有人可以向我解释如何解决此错误 错误在这里:auto [s,d] = Pi.sumdiff(10,50);

template <class T>
std::ostream& operator <<(std::ostream& os, const Point<T>& p)
{
    return os << "The x is: " << p.x << " and y is: " << p.y << endl;
}


int main()
{
    cout << Pi << endl;
    auto [s,d] = Pi.sumdiff(10, 50);
    cout << s << '\t' << d;
    return 0;
}
template <class T>
class Point
{
    T x, y;
public:
    Point():Point(0,0)
    {}
    Point(T _x, T _y):x(_x),y(_y)
    {}
    template <class T> friend std::ostream& operator <<(std::ostream& os, const Point<T>& p);
    auto sumdiff(const T& a,const T& b) { const T sum = a + b; const T diff = a - b; return std::make_pair(sum, diff); }
};
Point<int> Pi;
评论