I have a class which is what I want to index
e.g.
TValue * operator [](int i) {return(TValue*)(FValueList->Items[i]););
FValueList is a TList
But when I try to do the assignment
TValue * Value
Value = List[i];
I get a compile error that 'List' of type TValueList cannot be assigned
to TValue.
What am I doing wrong?
This looks correct.
> Value = List[i];
> What am I doing wrong?
It's just how you're using your list. Presumably, List is a pointer
to a TList, so what you really need to do is this:
Value = (*List)[i];
...to dereference the pointer, and then call the operator[] on the
object.
So you know why you got the error... the way you wrote it, your code
was trying to dereference the element number [i] in an array of
TLists. So the return value of that expression was a TList*, which
didn't match the TValue * type of "Value". :)
--
Chris (TeamB)
Thanks again!