#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template< class _T >
void displayvect( vector<_T>& v ) {
for( unsigned x = 0; x < v.size(); ++x )
cout << v[x] << \" \" << endl;
cout << endl;
}
enum SortMode { INT, DOUBLE };
class sorttest {
int x;
double y;
static SortMode sm;
public:
sorttest( int i, double f ) : x(i), y(f) {}
bool operator<( sorttest& t ) {
switch( sm ) {
case INT: return x < t.x;
case DOUBLE: return y < t.y;
}
return false;
}
static void setSort( SortMode s ) { sm = s; }
friend ostream& operator<<( ostream& os, sorttest& st );
};
|