Is 'auto const' and 'const auto' the same?

steffen picture steffen · May 22, 2012 · Viewed 15.9k times · Source

Is there a semantic difference between auto const and const auto, or do they mean the same thing?

Answer

AJG85 picture AJG85 · May 22, 2012

The const qualifier applies to the type to the immediate left unless there is nothing to the left then it applies to the type to the immediate right. So yup it's the same.