Iterators and pointers

The following are equivalent ways to dereference an iterator:

vector<DigitizerChannel>::iterator itChan = m_vChannels.begin();
PerformFFTFwd((*itChan).m_vfRawData, fft_result);
PerformFFTFwd(itChan->m_vfRawData, fft_result);

In the above, (*itChan).m_vfRawData is equivalent to itChan->m_vfRawData.
They both mean “access m_vfRawData from what is pointed to by itChan”. ┬áitChan is a vector iterator, as the declaration indicates.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>