Vector iterators

后端 未结 7 1102
再見小時候
再見小時候 2021-01-29 04:45

I have a the following code.

vector* irds = myotherobj->getIRDs();//gets a pointer to the vector
for(vector::iterator it = ir         


        
7条回答
  •  独厮守ぢ
    2021-01-29 05:22

    When I iterate over the vector pointer irds, what exactly am I iterating over? Is it a copy of each element, or am I working with the actual object in the vector when I say (*it).doSomething(),

    When you iterate over a vector you work with the object itself, not a copy of it.

提交回复
热议问题