help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: STL iterator question


From: Thomas Maeder
Subject: Re: STL iterator question
Date: Sat, 26 Mar 2005 19:34:33 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

Christian Christmann <plfriko@yahoo.de> writes:

> my program contains a class with a STL vector std::vector<int> data and an
> integer variable "currentbit" which indicates the current position while
> traversing the vector.

[snip]

Next time please post minimal code rather than describing it.


> vector<int>::const_iterator iter = *data[currentbit+1]

If data is of type std::vector<int>, data[currentbit+1] is of type int
(or int &). You can't apply unary * to either int nor int &.


> but the compiler complains:
>
>  invalid type argument of `unary *'
>
> What's wrong? How can I assing an iterator to a particular position
> in the vector?

vector<int>::const_iterator iter(data.begin()+currentbit);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]