Re: Help understanding pointers to classes within containers...
deancoo wrote:
[color=blue]
> Yup, that was it. Thank you Rolf. The compiler hint was:
>
> "request for member `int_value' in `
> (&j)->__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator*()
> const "[/color]
The compiler says that what the iterator's operator* returns is not
something that has a member int_value, i.e. you cannot do
(*the_iterator).int_value. Btw, I guess this is not the whole message.
Usually, g++ also tells you what the actual type is.
[color=blue]
> I haven't worked with templates a whole lot so I'm not able to interpret
> the above message very well.[/color]
Fair enough. But if you have code that the compiler doesn't accept and you
want to post it here, it's always a good idea to include the error
messages. Even if you don't know what the messages mean, someone else here
might.
[color=blue]
> Are there any tips anyone might offer for working with containers and
> interpreting compiler messages? Thanks. Again.[/color]
Well, much of the standard library is heavily template based, and compiler
error messages do tend to get a bit cryptic in connection with templates,
so it is sometimes hard to find out what is meant. But after you have seen
some, you will get a feel for it. |