What does the auto c ++ keyword do?

I recently met the auto keyword in C ++.

In code:

auto maxIterator = std::max_element(&spec[0], &spec[sampleSize]);
float maxVol = *maxIterator;

// Normalize
if (maxVol != 0)
  std::transform(&spec[0], &spec[sampleSize], &spec[0], [maxVol] (float dB) -> float { return dB / maxVol; });

This is due to the launch of the frequency analysis of the audio stream. On the website: http://katyscode.wordpress.com/2013/01/16/cutting-your-teeth-on-fmod-part-4-frequency-analysis-graphic-equalizer-beat-detection-and-bpm -estimation /

I searched the forums, but it says there is no point to the keyword. Can someone explain this here.

I am new to C ++, so please try not to make the answers too complicated. Many thanks.

Did make maxIterator also make a pointer?

+4
source share
2 answers

maxIterator. spec - float [], maxIterator - float *.

+2

++ 11 auto . , maxIterator.

auto

+2

All Articles