C++的一个关于结构体和类的小疑点

C++的一个关于结构体和类的小问题
是这样的,我写了一个程序,然后忽然发现出错在其中一个小函数上,于是把这部分截取下做个测试
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;


class Node{
public:
float x;
float y;
};

float dis(Node a, Node b)
{
return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));  
}

int main()
{
Node arry[100000];
arry[0].x=0.0;
arry[0].y=0.0;
arry[1].x=1.0;
arry[1].y=1.0;
cout<<distance(arry[0], arry[1]);
system("pause");
}

这个是错误的程序,后来参考了一下别人的程序,写成这样就是对的,这让我很费解,求问第一个程序错在哪个用法。
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;


typedef struct node
{
    double x;
    double y;
}point;


double dist(point a, point b)
{
    return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
}


int main()
{
point arry[100];
arry[0].x=0;
arry[0].y=0;
arry[1].x=1;
arry[1].y=1;
cout<<dist(arry[0],arry[1])<<endl;
system("pause");
}

------解决思路----------------------
std::distance用错地方了吧?

你这代码应该编译报错的
------解决思路----------------------
额,min能接受三个参数的?是在哪个标准定义的?
return min(dis(arry[start], arry[start + 1]), dis(arry[start + 1], arry[end]), dis(arry[start], arry[end]));