Topic: Iterator to a Pointer accessing


Author: "Stephen Miller" <stephen@pagemiller.com>
Date: Tue, 9 Oct 2001 17:59:01 GMT
Raw View
I have an iterator that points, well not points but is an iterator of a
vector that contains pointers, to a pointer.

ie vector<Class *> vCon;
vector<Class *>::iterator iter;

(code to set iter to a specific place in vector)
Now, Class has overloaded several operators (in my case I overloaded the
operator <<.

The question is, why doesn't
*(*iter) << rvalue;   work?

My error is this...
..c:65: invalid operands `Class *' and `char' to binary `operator <<'

The Class isn't really called that but you get the idea, source file names
changed to protect innocent naming schemes.

-- Steve
----------------------------------------
stephen@pagemiller.com
----------------------------------------

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: "James Russell Kuyper Jr." <kuyper@wizard.net>
Date: Wed, 10 Oct 2001 08:16:09 GMT
Raw View
Stephen Miller wrote:
>
> I have an iterator that points, well not points but is an iterator of a
> vector that contains pointers, to a pointer.
>
> ie vector<Class *> vCon;
> vector<Class *>::iterator iter;
>
> (code to set iter to a specific place in vector)
> Now, Class has overloaded several operators (in my case I overloaded the
> operator <<.
>
> The question is, why doesn't
> *(*iter) << rvalue;   work?
>
> My error is this...
> ..c:65: invalid operands `Class *' and `char' to binary `operator <<'
>
> The Class isn't really called that but you get the idea, source file names
> changed to protect innocent naming schemes.

It isn't sufficient to overload operator<<(); you have to overload it
for suitable type for rvalue. You haven't specified what type 'rvalue'
is, though the error message suggests that it's a 'char'. How did you
declare the overloaded operator?

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]