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 *