L
Lordaeron
class Data1
{
int i;
char c[4];
}
class Data2
{
int i;
char d[5];
double dd;
}
template <typename T> class TableObject
{
public:
list<T*> links;
typename list<T*>::iterator ite;
TableObject(){
//do insert Data1 or Data2 into links
}
~TableObject(){}
Sort(){
ite=links.begin();
int i=0;
while ((ite+i)<links.end()){
if (*(ite+i).i>*(ite+i+1).i){//<-it seems impossible work
iter_swap((ite+i),(ite+i+1))
}
i++;
}
}
at the mark "<-"
how can i make it work like that?
can in template, so the Type is unknow at compile time.
so i can't do that?
{
int i;
char c[4];
}
class Data2
{
int i;
char d[5];
double dd;
}
template <typename T> class TableObject
{
public:
list<T*> links;
typename list<T*>::iterator ite;
TableObject(){
//do insert Data1 or Data2 into links
}
~TableObject(){}
Sort(){
ite=links.begin();
int i=0;
while ((ite+i)<links.end()){
if (*(ite+i).i>*(ite+i+1).i){//<-it seems impossible work
iter_swap((ite+i),(ite+i+1))
}
i++;
}
}
at the mark "<-"
how can i make it work like that?
can in template, so the Type is unknow at compile time.
so i can't do that?