1
| | #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 { NONE, INT, DOUBLE, CHAR };
class sorttest {
int x;
double y;
char g;
static SortMode sm[3];
bool intersort( SortMode s, sorttest& t, int ind = 0 ) {
if( (ind < 3) && sm[ind] ) {
switch( s ) {
case INT:
if( x == t.x )
return intersort( sm[ind+1], t, ind+1 );
return x < t.x;
case DOUBLE:
if( y == t.y )
return intersort( sm[ind+1], t, ind+1 );
return y < t.y;
case CHAR:
if( g == t.g )
return intersort( sm[ind+1], t, ind+1 );
return g < t.g;
}
}
|