I have a simple sorting function to sort two vectors based on the value of the first vector. Here is the code.
template <typename T1,typename T2> bool sort2compare(pair<T1,T2> &a, pair<T1,T2> &b)
{
return a.first < b.first;
};
template <typename T1,typename T2> void sort2(vector<T1> &x,vector<T2> &y)
{
//sort both x and y based on the value in x
size_t i;
vector< pair<T1,T2> > b;
for (i=0;i<x.size();i++)
{
b.push_back(pair<T1,T2>(x[i],y[i]));
}
sort(b.begin(),b.end(),sort2compare<T1,T2>);
for (i=0;i<x.size();i++)
{
x[i]=b[i].first;
y[i]=b[i].second;
}
};
The VS2005 compiler seems fine with the code, but VS6.0 complains about
"unresolved external symbol "bool __cdecl sort2compare(struct std::pair<double,double> &,struct std::pair<double,double> &)"