M
Michele
Hello everybody,
I don't have clear in my mind how to use templates and overloaded
operator with them...
I hope someone may give me an hint...
I use a library aTemplate which has defined:
AddFirst(), First(), Last() etc,
but it doesn't have a function to access to the element.
I have to use an iterator aTemplateIterator which has defined:
Set(), ..., and:
operator++()
operator T*()
my code is the following:
class myElement {
public:
int key;
int value;
};
class myTable {
public:
myElement item;
...
}
class myObjectData {
public:
aTemplate<myTable> header;
.....
}
When I try to access to the element by using the operator I have problems.
myObjectData* info;
aTemplateIterator<myTable> aIter(info->header);
aIter.First(); //First() is a method of aTemplate
while (aIter != NULL) {
int i = *aIter.item.key; //here stands the error
aIter.operator++(1); //this is fine
}
Error is: "item is not a member of aTemplateIterator<myTable>"
QUESTION: How can I access to item.key?
thanks to anyone who could give me an answer...
michele
I don't have clear in my mind how to use templates and overloaded
operator with them...
I hope someone may give me an hint...
I use a library aTemplate which has defined:
AddFirst(), First(), Last() etc,
but it doesn't have a function to access to the element.
I have to use an iterator aTemplateIterator which has defined:
Set(), ..., and:
operator++()
operator T*()
my code is the following:
class myElement {
public:
int key;
int value;
};
class myTable {
public:
myElement item;
...
}
class myObjectData {
public:
aTemplate<myTable> header;
.....
}
When I try to access to the element by using the operator I have problems.
myObjectData* info;
aTemplateIterator<myTable> aIter(info->header);
aIter.First(); //First() is a method of aTemplate
while (aIter != NULL) {
int i = *aIter.item.key; //here stands the error
aIter.operator++(1); //this is fine
}
Error is: "item is not a member of aTemplateIterator<myTable>"
QUESTION: How can I access to item.key?
thanks to anyone who could give me an answer...
michele