[cs13001] itrators

Mikhail Nesterenko mikhail at cs.kent.edu
Wed May 4 15:37:08 EDT 2016


rs wrote:
> Can the value of a vector element  be changed by dereferencing that element
> iterator , same way is done with pointers of dynamic arrays?

Certainly. All the functionally available to pointers is also
applicable to iterators. 

You can dereference an iterator and assign access or modify the value
that the iterator points to. You can use indexing operator with
iterator as well. For example:

	 iter[0]=55;

is legal. I modified the below example to include illustrative operations.

    http://vega.cs.kent.edu/~mikhail/classes/csi/Examples/Vectors/iterators.cpp

Thanks,
-- 
Mikhail


More information about the cs13001 mailing list