Thanks a bunch for your reply. That's how I was accessing it but I kept getting errors, which I now know was because I was trying to change the values by altering the returned value (can't be done...duh).
Here's a snippet of code I'm working with that I think should be enough to get by. The node class is similar to what you saw above.
using namespace std;
void sort::selectionSort(vector<node> v)
time_t start, end;
start = time(NULL);
for(int i = 0; i < (v.size()-1); i++)
for(int j = 1; j < v.size(); j++)
if(v[j].getData() < v[i].getData())
swap(v, j, i);
end = time(NULL);
cout << end-start << " seconds elapsed while sorting " << v.size() << " items with Selection sort.\
for(int i = 0; i < v.size(); i++)
std::cout << v[i].getData() << endl;
void swap(vector<node> a, int small, int big)
int d = a[small].getData();
The error message I keep getting is
undefined reference to `sort::swap(std::vector<node, std::allocator<node> >, int, int)'
EDIT: I figured out the problem. I wasn't properly defining the method in the implementation file.
Instead of void sort::swap, I was doing void swap. Thanks very much for your help. +1Edited by floatingDivs - 4/21/11 at 1:15pm